Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update humanfriendly to 10.0 #202

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

pyup-bot
Copy link
Collaborator

This PR updates humanfriendly from 4.18 to 10.0.

Changelog

10.0

----------------------------

**Noteworthy changes:**

- Merged pull request `45`_ to resolve the issue caused by the conditional
:pypi:`pyreadline` requirement on Windows not supporting Python 3.9+.

- Updated the readme to use Python 3 in the example (reported in issue `56`_).
Also added a mention of the ``humanfriendly --demo`` command.

- Removed the ``humanfriendly.compat.unittest`` alias that presumably no-one is
using at this point; it had been rendered useless quite a long time ago
(requested in issue `53`_).

**Internal changes:**

- Merged pull request `54`_ which migrates the :pypi:`humanfriendly` project
from Travis CI to GitHub Actions and from Coveralls.io to Codecov.

- Fixed a deprecation warning concerning ``setup.cfg`` and some Sphinx
documentation errors.

.. _Release 10.0: https://github.com/xolox/python-humanfriendly/compare/9.2...10.0
.. _45: https://github.com/xolox/python-humanfriendly/pull/45
.. _53: https://github.com/xolox/python-humanfriendly/issues/53
.. _54: https://github.com/xolox/python-humanfriendly/pull/54
.. _56: https://github.com/xolox/python-humanfriendly/issues/56

9.2

---------------------------

Maintenance release:

- Merged pull request `46`_ which fixes several :pypi:`flake8` warnings.

- Merged pull request `49`_ which marks Python 3.9 support final.

- Merged pull request `51`_ which helps to stabilize the test suite.

- Merged pull request `52`_ which updates the :mod:`humanfriendly.sphinx`
module to include Sphinx extension metadata that has become mandatory in a
recent Sphinx release. After merging the pull request I added additional
metadata including the version.

.. _Release 9.2: https://github.com/xolox/python-humanfriendly/compare/9.1...9.2
.. _46: https://github.com/xolox/python-humanfriendly/pull/46
.. _49: https://github.com/xolox/python-humanfriendly/pull/49
.. _51: https://github.com/xolox/python-humanfriendly/pull/51
.. _52: https://github.com/xolox/python-humanfriendly/pull/52

9.1

---------------------------

Added :func:`~humanfriendly.compat.on_macos()` function to detect Apple MacOS
(I need this in an upcoming :pypi:`coloredlogs` release and don't want to have
to think about how to detect MacOS again in the future 😇).

.. _Release 9.1: https://github.com/xolox/python-humanfriendly/compare/9.0...9.1

9.0

---------------------------

The major version number was bumped because the bug fix for
:func:`~humanfriendly.text.pluralize()` is backwards incompatible
and (even though this seems like very "cosmetic" functionality)
version numbers are cheap, so who cares 😉.

**Bug fixes:**

- Changed :func:`~humanfriendly.format_number()` to properly support negative
numbers (as suggested in `issue 40`_).

- Changed :func:`~humanfriendly.text.pluralize()` to generate "1.5 seconds"
instead of "1.5 second" (as suggested in `issue 43`_).

**Enhancements:**

- Enhanced :func:`~humanfriendly.text.concatenate()` to support ``conjunction``
and ``serial_comma`` keyword arguments (as suggested in `issue 30`_).

- Added :func:`~humanfriendly.text.pluralize_raw()` to select singular or
plural form without prefixing the count to the text that is returned.

.. _Release 9.0: https://github.com/xolox/python-humanfriendly/compare/8.2...9.0
.. _issue 30: https://github.com/xolox/python-humanfriendly/issues/30
.. _issue 40: https://github.com/xolox/python-humanfriendly/issues/40
.. _issue 43: https://github.com/xolox/python-humanfriendly/issues/43

8.2

---------------------------

Added a simple case insensitive dictionary implementation, for details refer to
the new :mod:`humanfriendly.case` module.

.. _Release 8.2: https://github.com/xolox/python-humanfriendly/compare/8.1...8.2

8.1

---------------------------

**Enhancements:**

- Make it possible to opt out of the output capturing that
:func:`humanfriendly.testing.run_cli()` sets up by default.

- Improve feature parity between :class:`humanfriendly.testing.CaptureOutput`
and my :pypi:`capturer` package to the point where most of the
:pypi:`humanfriendly` test suite can now run without :pypi:`capturer`.

**Internal changes:**

- Refactored the test suite to import all names separately instead of referring
to identifiers via their modules (my preferences have changed since this code
was written a long time ago).

.. _Release 8.1: https://github.com/xolox/python-humanfriendly/compare/8.0...8.1

8.0

---------------------------

This release is backwards incompatible in several ways, see the notes below.

**Enhancements:**

- Adopt :func:`functools.wraps()` to make decorator functions more robust.

- Make the :class:`~humanfriendly.terminal.spinners.Spinner` class more
customizable. The interval at which spinners are updated and the characters
used to draw the animation of spinners can now be customized by callers.
This was triggered by `executor issue 2`_.

.. note:: The text cursor hiding behavior of spinners has been removed
         because it was found to be problematic (sometimes the text cursor
         would be hidden but not made visible again, which is disorienting
         to say the least).

- Improve test skipping based on exception types.

The :class:`humanfriendly.testing.TestCase` class was originally created to
enable skipping of tests that raise specific exception types on Python 2.6.
This involved patching test methods, which had the unfortunate side effect
of generating confusing :pypi:`pytest` output on test failures.

Since then :pypi:`unittest2` was integrated which provided real
skipping of tests however removing the old test skipping support
from the :mod:`humanfriendly.testing` module would have resulted
in a backwards incompatible change, so I never bothered. I've now
decided to bite the bullet and get this over with:

1. I've implemented an alternative (finer grained) strategy based on a
  decorator function that applies to individual test methods, for
  details see :func:`humanfriendly.testing.skip_on_raise()`.

2. I've removed the test method wrapping from the
  :class:`humanfriendly.testing.TestCase` class.

.. note:: This change is backwards incompatible, in fact it breaks the
         test suites of two other projects of mine (:pypi:`executor` and
         :pypi:`vcs-repo-mgr`) because they depend on the old test method
         wrapping approach. Both test suites will need to be migrated to
         the :func:`~humanfriendly.testing.skip_on_raise()` decorator.

**Internal changes:**

- The "deprecated imports" feature provided by :mod:`humanfriendly.deprecation`
has been adopted to clean up the maze of (almost but not quite) cyclic import
dependencies between modules.

- HTML to ANSI functionality has been extracted to a new
:mod:`humanfriendly.terminal.html` module.

- Support for spinners has been extracted to a new
:mod:`humanfriendly.terminal.spinners` module.

- The use of positional arguments to initialize
:class:`~humanfriendly.terminal.spinners.Spinner` objects has been deprecated
using the new :func:`humanfriendly.deprecation.deprecated_args()` decorator
function.

.. _Release 8.0: https://github.com/xolox/python-humanfriendly/compare/7.3...8.0
.. _executor issue 2: https://github.com/xolox/python-executor/issues/2

7.3

---------------------------

**Enhancements:**

Added the :func:`humanfriendly.deprecation.deprecated_args()` decorator function
which makes it easy to switch from positional arguments to keyword arguments
without dropping backwards compatibility.

.. note:: I'm still working on the humanfriendly 8.0 release which was going to
       break backwards compatibility in several ways if it wasn't for the
       tools provided by the new :mod:`humanfriendly.deprecation` module.

.. _Release 7.3: https://github.com/xolox/python-humanfriendly/compare/7.2...7.3

7.2

---------------------------

**Enhancements:**

Support for backwards compatible aliases that emit deprecation warnings
(:mod:`humanfriendly.deprecation`).

.. note:: I'm currently working on several large refactorings that involve
       moving things around between modules and dreaded having to extend the
       existing maze of (almost but not quite) cyclic import dependencies
       between modules. This new functionality will be adopted to untangle
       the existing maze in the upcoming humanfriendly 8.0 release, which
       bumps the major version number due to this very large change in how
       backwards compatibility is implemented. It is my hope that this new
       functionality will prove to be robust enough to unburden me from the
       less elegant aspects of preserving backwards compatibility 😁.

**Documentation:**

Get rid of broken references and noise in the online documentation once and for all:

- :pypi:`Sphinx` was emitting a screen full of warnings about unknown
references. These were bothering me because testing the integration between
Sphinx and :mod:`humanfriendly.deprecation` involved lots of broken
references as well.

- Additionally the :mod:`humanfriendly.compat` module introduced a lot of noise
into the generated documentation because imported classes and their members
were being included in the documentation, this is now also fixed.

- Finally I decided to start using ``sphinx-build -nW`` to complain loudly when
even just one broken reference is found. This should encourage the discipline
to never introduce broken references again!

**Tests:**

Fixed :mod:`unittest` deprecation warnings in the test suite.

.. _Release 7.2: https://github.com/xolox/python-humanfriendly/compare/7.1.1...7.2

7.1.1

-----------------------------

Fix Python 3 incompatibility (``distutils.spawn``).

Much to my dismay this morning I ran into the following traceback on a Python

7.1

---------------------------

**Enhancements:**

- Enable Windows native support for ANSI escape sequences. This was brought to
my attention in `coloredlogs issue 71`_ and `coloredlogs pull request 72`_.
My experiences with ANSI escape sequences started out as part of the
:pypi:`coloredlogs` package but eventually I moved the support for ANSI
escape sequences to the :pypi:`humanfriendly` package. This explains how it
now makes sense to integrate the Windows native ANSI escape sequence support
in :pypi:`humanfriendly` as well.

**Bug fixes:**

- Accept pluralized disk size units (`26`_). I'm not claiming this is a full
solution to the problem, far from it. It does lessen the pain a bit (IMHO).

- Make sure the selected pager is available before trying to run it. While
testing :pypi:`humanfriendly` on Windows 10 I noticed that ``humanfriendly
--help`` resulted in nothing but a traceback, because :man:`less` wasn't
available. That's not human friendly at all 😕 (even if it is Windows 😈).

.. _Release 7.1: https://github.com/xolox/python-humanfriendly/compare/7.0...7.1
.. _coloredlogs issue 71: https://github.com/xolox/python-coloredlogs/issues/71
.. _coloredlogs pull request 72: https://github.com/xolox/python-coloredlogs/pull/72
.. _26: https://github.com/xolox/python-humanfriendly/issues/26

7.0

---------------------------

After an unplanned but extended hiatus from the development and maintenance of
my open source projects I'm now finally starting to pick up some momentum, so
I'm trying to make the best of it:

- Merge pull request `24`_: Fix bug in :func:`~humanfriendly.parse_length()` that rounded floats.
- Merge pull request `32`_: Update hyperlinks in readme.
- Merge pull request `33`_: Drop support for Python 2.6 and 3.0-3.4
- Merge pull request `35`_: SVG badge in readme.
- Merge pull request `36`_: Add support for nanoseconds and microseconds time units
- Fixed :func:`~humanfriendly.tables.format_rst_table()` omission from
``humanfriendly.tables.__all__``.
- Start testing on Python 3.8 and 3.9-dev.

.. _Release 7.0: https://github.com/xolox/python-humanfriendly/compare/6.1...7.0
.. _24: https://github.com/xolox/python-humanfriendly/pull/24
.. _32: https://github.com/xolox/python-humanfriendly/pull/32
.. _33: https://github.com/xolox/python-humanfriendly/pull/33
.. _35: https://github.com/xolox/python-humanfriendly/pull/35
.. _36: https://github.com/xolox/python-humanfriendly/pull/36

6.1

---------------------------

- Added a ``:pypy:`… role for easy linking to packages on the Python Package
Index, for details refer to :func:`humanfriendly.sphinx.pypi_role()`.

- Wasted quite a bit of time debugging a MacOS failure on Travis CI caused by a
broken :man:`pip` installation, fixed by using ``get-pip.py`` to bootstrap an
installation that actually works 😉.

.. _Release 6.1: https://github.com/xolox/python-humanfriendly/compare/6.0...6.1

6.0

---------------------------

**Noteworthy changes:**

- Enable :class:`~humanfriendly.testing.MockedProgram` to customize the shell
script code of mocked programs. This was added to make it easy to mock a
program that is expected to generate specific output (I'm planning to use
this in the :pypi:`linux-utils` test suite).

- Defined ``__all__`` for all public modules that previously lacked "export
control" and decided to bump the major version number as a precaution:

- These changes should not have any impact on backwards compatibility,
 unless I forgot entries, in which case callers can get
 :exc:`~exceptions.ImportError` exceptions...

- Imports of public modules were previously exported (implicitly) and this
 pollutes code completion suggestions which in turn can encourage bad
 practices (not importing things using their "canonical" name).

- I started developing the ``humanfriendly`` package years before I learned
 about the value of defining ``__all__`` and so some modules lacked a
 definition until now. I decided that now was as good a time as any
 to add those definitions 😇.

**Miscellaneous changes:**

- Simplified the headings in ``docs/api.rst`` so that only the module names
remain. This was done because Sphinx doesn't support nested links in HTML
output and thus generated really weird "Table of Contents" listings.

- Fixed the reStructuredText references in the documentation of
:func:`~humanfriendly.prompts.prompt_for_choice()`. This function is imported
from :mod:`humanfriendly.prompts` to :mod:`humanfriendly` (for backwards
compatibility) where it can't use relative references to refer to the other
functions in the :mod:`humanfriendly.prompts` module.

- Changed the ``Makefile`` to default to Python 3 for development, make sure
``flake8`` is always up-to-date and silence the few targets whose commands
were not already silenced.

- Embedded quite a few Python API references into recent changelog entries,
just because I could (I ❤️  what hyperlinks can do for the usability of
technical documentation, it gives a lot more context).

.. _Release 6.0: https://github.com/xolox/python-humanfriendly/compare/5.0...6.0

5.0

---------------------------

- Added custom ``:man:`… role for easy linking to Linux manual pages to
the :mod:`humanfriendly.sphinx` module.

- Changed rendering of pretty tables to expand tab characters to spaces:

Until now pretty tables did not take the variable width of tab characters
into account which resulted in tables whose "line drawing characters" were
visually misaligned. Tabs are now expanded to spaces using
``str.expandtabs()``.

- Stop testing on Python 2.6 and drop official support. The world (including
Travis CI) has moved on and preserving Python 2.6 compatibility was clearly
starting to drag the project down...

I decided to bump the major version number because each of these changes can be
considered backwards incompatible in one way or another and version numbers are
cheap anyway so there 😛.

.. _Release 5.0: https://github.com/xolox/python-humanfriendly/compare/4.18...5.0
Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant