Skip to content

Update coolname to 5.0.0 - #237

Open
pyup-bot wants to merge 1 commit into
masterfrom
pyup-update-coolname-1.1.0-to-5.0.0
Open

Update coolname to 5.0.0#237
pyup-bot wants to merge 1 commit into
masterfrom
pyup-update-coolname-1.1.0-to-5.0.0

Conversation

@pyup-bot

Copy link
Copy Markdown
Collaborator

This PR updates coolname from 1.1.0 to 5.0.0.

Changelog

5.0.0

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

This major release has new features and significant internal changes, but it is compatible with 4.x in any normal usage
as described in documentation, and you can upgrade from 4.x with minimal unit test coverage.

There are implementation changes that *theoretically* can break user code in undocumented scenarios.
Even if it breaks, most likely, it will take a minute to fix.

**What's new in the default generator:**

* Complete typing support, tested with mypy ``strict = True``.

* Added a few more words, and fixed one spelling mistake.

.. collapse:: Boring technical details

 * :py:class:`RandomGenerator` and global methods like :py:func:`generate_slug` now live in the top-level
   ``coolname`` namespace.
   It won't affect your code if you've been importing directly from ``coolname`` as per documentation.

   Basically, instead of this:

   .. code-block:: python

     >>> from coolname import generate_slug, RandomGenerator
     >>> generate_slug
     <bound method RandomGenerator.generate_slug of <coolname.impl.RandomGenerator object at 0x7a7cb248d6a0>>
     >>> RandomGenerator
     <class 'coolname.impl.RandomGenerator'>

   You will see this (notice no ``impl``):

   .. code-block:: python

     >>> generate_slug
     <bound method RandomGenerator.generate_slug of <coolname.RandomGenerator object at 0x75038bacde80>>
     >>> RandomGenerator
     <class 'coolname.RandomGenerator'>

**In custom generators:**

* Default parameter value changed: ``ensure_unique=True``. Custom generators can forget about it
and still generate sequences without repeating words.
Consider also using ``ensure_unique_prefix`` (disabled by default).

* :doc:`New parameters <parameters-table>` for advanced words/phrases lists:
``strip_whitespace``, ``allow_whitespace``, ``separator``.

* What is considered a valid word? It's now controlled by ``word_regex`` parameter, ``\w+`` by default.

* Stricter config validation for custom generators, with more helpful error messages.

* Custom generator can be rendered into text representation via
:py:meth:`~coolname.RandomGenerator.render` and :py:meth:`~coolname.RandomGenerator.write`.
Useful in debugging and logging.

* New public API for manipulating configuration files:
 - :py:func:`~coolname.loader.load_config`
 - :py:func:`~coolname.loader.filter_config`
 - :py:func:`~coolname.loader.save_config_as_module`

* Type :py:class:`~coolname.types.CoolnameConfigT` formally describes config dict.

* Config in ``*.txt`` allows comment after a word/phrase, Python-style:

 .. code-block::

      this was allowed before
     one
     two   this is now allowed too

.. collapse:: Boring technical details

 * Using arbitrary types (such as int) is word/phrase lists is now *strictly forbidden*,
   not just "undocumented and fails in most circumstances".

   For example, the following invalid configuration always raises an exception:

   .. code-block:: python

     {
       "all": {
         "type": "phrases",
         "phrases": [[1,2], [3,4]]}   don't do this
     }

 * ``RandomGenerator`` does not accept :py:class:`collections.abc.Mapping` as config anymore,
   only plain ``dict`` as described by type ``coolname.types.CoolnameConfigT``.

4.2.0

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

* Backported changes in word lists from 5.0.0

* Better mypy support

4.1.0

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

* Added a few words

4.0.0

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

* **Breaking change:** Python 3.10+ is required (because of packaging - see below).
Tests cover Python 3.10-3.14 and PyPy 3.10-3.11.

* Switched to modern packaging with ``pyproject.toml``. This should not affect user experience.
Support for egg files is officially dropped, but the package is still pure Python and should work in bundles
(such as PyInstaller - see documentation).

* Added a lot of adjectives

* Minor optimizations

3.0.0

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

* **Breaking change:** Python 3.6 is not supported anymore. Tests cover Python 3.7-3.14 and PyPy 3.7-3.11.

* Better type hints (now checked with mypy)

* Minor bug fixed, concerning abnormal configs (most likely didn't affect anyone)

* More mythical animals + one mistake fixed + few other words

2.2.0

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

* More dogs, cats and cows!

2.1.0

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

* Support OpenSSL FIPS by using ``hashlib.md5(..., usedforsecurity=False)``

2.0.0

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

* Support for old Python versions (<3.5) is dropped, because it's 2022

* Command line usage and pipx support.

* With additional owls and bitterns
Links

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant