Changelog
### 0.31.2
```
What's Changed
Bugs fixed:
- broken support for `Optional[List]` (but not `Optional[list]`), a narrower case of the problem fixed earlier (issue 216) by neithere, thanks to thorwhalen
Full changelog: https://argh.readthedocs.io/en/latest/changes.html
Full diff: https://github.com/neithere/argh/compare/v0.31.1...v0.31.2
```
### 0.31.1
```
*This text is a brief summary of the full changelog entry: https://argh.readthedocs.io/en/latest/changes.html#version-0-31-1-2024-01-19*
What's Changed
Bugs fixed:
- broken support for type alias `List` (issue 216), thanks to thorwhalen.
Enhancements:
- cleaned up the README, rearranged other documentation.
**Full diff**: https://github.com/neithere/argh/compare/v0.31.0...v0.31.1
```
### 0.31.0
```
What's Changed
This release is a major step forward for Argh. It paves the way to a fully annotations-driven approach where decorators will remain a mere legacy.
*This text is a brief summary of the full changelog entry: https://argh.readthedocs.io/en/latest/changes.html#version-0-31-0-2023-12-30*
Breaking changes:
* The typing hints introspection feature is automatically enabled for any command (function) which does **not** have any arguments specified via `arg` decorator.
* A small change in the legacy argument mapping policy `BY_NAME_IF_HAS_DEFAULT` concerning the order of variadic positional vs. keyword-only arguments.
* Removed the previously deprecated decorator `expects_obj`.
Enhancements:
* Type hints: basic usage to infer argument types (fixes 203) by neithere in https://github.com/neithere/argh/pull/211
* Support realtime output through a pipe (fixes 145) by neithere in https://github.com/neithere/argh/pull/202
* High-level functions `argh.dispatch_command()` and `argh.dispatch_commands()`
now accept a new parameter `old_name_mapping_policy`.
Deprecated:
- the `namespace` argument in `argh.dispatch()` and `argh.parse_and_resolve()`.
Rationale: continued API cleanup. It's already possible to mutate the
namespace object between parsing and calling the endpoint; it's unlikely that
anyone would need to specify a custom namespace class or pre-populate it
before parsing. Please file an issue if you have a valid use case.
Other changes:
- Refactoring.
**Full Diff**: https://github.com/neithere/argh/compare/v0.30.5...v0.31.0
```
### 0.30.5
```
What's Changed
* fix: nargs + list as default value (212) by neithere in https://github.com/neithere/argh/pull/213
(thanks to pioio for bug report)
* feat: argspec guessing: if `nargs` is not specified but the default value is a list, `nargs="*"` is assumed and passed to argparse.
**Full Changelog**: https://github.com/neithere/argh/compare/v0.30.4...v0.30.5
Please refer to the official changelog for more details: https://argh.readthedocs.io/en/latest/changes.html
```
### 0.30.4
```
What's Changed
There were complaints about the lack of a deprecation cycle for the legacy name
mapping policy. This version addresses the issue:
- The handling introduced in v.0.30.2 (raising an exception for clarity)
is retained for cases when no name mapping policy is specified but function
signature contains defaults in non-kwonly args **and kwonly args are also
defined**::
def main(alpha, beta=1, *, gamma=2): error — explicit policy required
In a similar case but when **kwonly args are not defined** Argh now assumes
the legacy name mapping policy (`BY_NAME_IF_HAS_DEFAULT`) and merely issues
a deprecation warning with the same message as the exception mentioned above::
def main(alpha, beta=2): `[-b BETA] alpha` + DeprecationWarning
This ensures that most of the old scripts still work the same way despite the
new policy being used by default and enforced in cases when it's impossible
to resolve the mapping conflict.
Please note that this "soft" handling is to be removed in version v0.33
(or v1.0 if the former is not deemed necessary). The new name mapping policy
will be used by default without warnings, like in v0.30.
— by neithere
**Full Changelog**: https://github.com/neithere/argh/compare/v0.30.3...v0.30.4
```
### 0.30.3
```
What's Changed
* fix: regression — `arg` deco failing with underscore in positional arg name (fixes 208) by neithere in https://github.com/neithere/argh/pull/209 (thanks to kaetir for a report with a reproducible example)
**Full Changelog**: https://github.com/neithere/argh/compare/v0.30.2...v0.30.3
```
### 0.30.2
```
What's Changed
* fix: raise exception for non-migrated commands (fixes 206) by neithere (reported and valuable feedback given by valentin-feron) in https://github.com/neithere/argh/pull/207
**Full Changelog**: https://github.com/neithere/argh/compare/v0.30.1...v0.30.2
```
### 0.30.1
```
What's Changed
Bugs fixed:
- Regression: certain special values in argument default value would cause an exception (204 reported by mfussenegger, fixed by neithere)
Enhancements:
- Improved the tutorial by neithere
- Added a more informative error message when the reason is likely to be related to the migration from Argh v0.29 to a version with a new argument name mapping policy by neithere
Other changes:
- Added `py.typed` marker file for PEP-561 by neithere
Details
Commits: https://github.com/neithere/argh/compare/v0.30.0...v0.30.1
Full changelog: https://argh.readthedocs.io/en/latest/changes.html#version-0-30-1
```
### 0.30.0
```
What's Changed
* Remove previously deprecated code (closes 184) by neithere in https://github.com/neithere/argh/pull/188
* Type annotations for existing code (closes 185) by neithere in https://github.com/neithere/argh/pull/189
* Deprecate `help` command alias and `expects_obj` decorator by neithere in https://github.com/neithere/argh/pull/192
* Document usage with class methods (closes 138) by neithere in https://github.com/neithere/argh/pull/194
* Remove pre_call, expose finer control over dispatching (re 63) by neithere in https://github.com/neithere/argh/pull/193
* Add support for Python 3.12 (closes 196) by neithere in https://github.com/neithere/argh/pull/195
* Refactor assembling module (closes 197) by neithere in https://github.com/neithere/argh/pull/198
* Keyword-only arguments as options (closes 191) by neithere in https://github.com/neithere/argh/pull/199
**Full Changelog**: https://github.com/neithere/argh/compare/v0.29.4...v0.30.0
```
### 0.30.0alpha
```
What's Changed
* Remove previously deprecated code (closes 184) by neithere in https://github.com/neithere/argh/pull/188
* Type annotations for existing code (closes 185) by neithere in https://github.com/neithere/argh/pull/189
* Deprecate `help` command alias and `expects_obj` decorator by neithere in https://github.com/neithere/argh/pull/192
* Document usage with class methods (closes 138) by neithere in https://github.com/neithere/argh/pull/194
* Remove pre_call, expose finer control over dispatching (re 63) by neithere in https://github.com/neithere/argh/pull/193
* Add support for Python 3.12 (closes 196) by neithere in https://github.com/neithere/argh/pull/195
* Refactor assembling module (closes 197) by neithere in https://github.com/neithere/argh/pull/198
* Keyword-only arguments as options (closes 191) by neithere in https://github.com/neithere/argh/pull/199
**Full Changelog**: https://github.com/neithere/argh/compare/v0.29.4...v0.30.0-alpha
```
### 0.29.4
```
Bugs fixed:
- Test coverage reported as <100% when argcomplete is installed (187)
```
### 0.29.3
```
This is a technical release for packaging purposes.
```
### 0.29.2
```
This is a technical release for packaging purposes.
```
### 0.29.1
```
This is a technical release for packaging purposes.
```
### 0.29.0
```
What's Changed
Backwards incompatible changes:
* Wrapped exceptions now cause ``dispatching.dispatch()`` to raise ``SystemExit(1)``
instead of returning without error. For most users, this means failed commands
will now exit with a failure status instead of a success (by ekimekim in 161).
Deprecated:
* Renamed arguments in `add_commands()` (165 / 178):
- `namespace` → `group_name`
- `namespace_kwargs` → `group_kwargs`
The old names are deprecated and will be removed in v.0.30.
Enhancements:
* Can control exit status (see Backwards Incompatible Changes above) when raising
``CommandError`` using the ``code`` keyword arg.
Bugs fixed:
* Positional arguments should not lead to removal of short form of keyword argument by neithere in 181
Other changes:
* Avoid depending on iocapture by using pytest's built-in feature by mr-c in 177
* chore: publishing to prod PyPI by neithere in 173
* test: add coverage for action="count" (127) by neithere in 183
New Contributors
* ekimekim made their first contribution in https://github.com/neithere/argh/pull/161
* mr-c made their first contribution in https://github.com/neithere/argh/pull/177
**Full Changelog**: https://github.com/neithere/argh/compare/v0.28.1...v0.29.0
```
### 0.28.1
```
What's Changed
* Add Github workflow to publish the release to PyPI by neithere in https://github.com/neithere/argh/pull/167
* fix: argcomplete-related test by neithere in 172 (reported in 169 by kloczek)
* fix: assumed prog name in tests by neithere in 171 (reported in 170 by mgorny)
**Full Changelog**: https://github.com/neithere/argh/compare/v0.28.0...v0.28.1
Thanks to everyone who reported
```
### 0.28.0
```
A major modernisation and cleanup.
Backward incompatible changes:
- Dropped support for Python 2.7 and 3.7.
Deprecated features, to be removed in v.0.30:
- `argh.assembling.SUPPORTS_ALIASES`.
- Always `True` for recent versions of Python.
- `argh.io.safe_input()` AKA `argh.interaction.safe_input()`.
- Not relevant anymore. Please use the built-in `input()` instead.
- argument `pre_call` in `dispatch()`.
Even though this hack seems to have been used in some projects, it was never part of the official API and never recommended.
Describing your use case in the discussion about shared arguments (63) can help improve the library to accomodate it in a proper way.
- Argument help as annotations.
- Annotations will only be used for types after v.0.30.
- Please replace any instance of:
def func(foo: "Foobar"):
with the following::
arg('-f', '--foo', help="Foobar")
def func(foo):
It will be decided later how to keep this functionality "DRY" (don't repeat yourself) without conflicts with modern conventions and tools.
- Added deprecation warnings for some arguments deprecated back in v.0.26.
**Full Changelog**: https://github.com/neithere/argh/compare/v0.27.2...v0.28.0
```
### 0.27.2
```
Minor packaging fix:
* chore: include file required by tox.ini in the sdist (155)
```
### 0.27.1
```
Minor building and packaging fixes:
* docs: add Read the Docs config (160)
* chore: include tox.ini in the sdist (155)
Contributors:
mtelka (155)
```
### 0.27.0
```
This is the last version to support Python 2.7.
Backward incompatible changes:
- Dropped support for Python 2.6.
Enhancements:
- Added support for Python 3.7 through 3.11.
- Support introspection of function signature behind the `wraps` decorator (issue 111).
Fixed bugs:
- When command function signature contained ``**kwargs`` *and* positionals without defaults and with underscores in their names, a weird behaviour could be observed (issue 104).
- Fixed introspection through decorators (issue 111).
- Switched to Python's built-in `unittest.mock` (PR 154).
- Fixed bug with `skip_unknown_args=True` (PR 134).
- Fixed tests for Python 3.9.7+ (issue 148).
Other changes:
- Included the license files in manifest (PR 112).
- Extended the list of similar projects (PR 87).
- Fixed typos and links in documentation (PR 110, 116, 156).
- Switched CI to Github Actions (PR 153).
Contributors:
dwf (105), jwilk (110), jakirkham (112), brilee, sanga (116), Gidgidonihah (134), mrdavidlaing (153), jelly (154), mtelka (154), hugovk (reviewing PRs).
```
Links
- PyPI: https://pypi.org/project/argh
- Changelog: https://data.safetycli.com/changelogs/argh/
- Docs: https://pythonhosted.org/argh/
Changelog
### 2.14.0
```
--------------
Upcoming deprecation
~~~~~~~~~~~~~~~~~~~~
* This version, Babel 2.14, is the last version of Babel to support Python 3.7.
Babel 2.15 will require Python 3.8 or newer.
* We had previously announced Babel 2.13 to have been the last version to support
Python 3.7, but being able to use CLDR 43 with Python 3.7 was deemed important
enough to keep supporting the EOL Python version for one more release.
Possibly backwards incompatible changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* ``Locale.number_symbols`` will now have first-level keys for each numbering system.
Since the implicit default numbering system still is ``"latn"``, what had previously
been e.g. ``Locale.number_symbols['decimal']`` is now ``Locale.number_symbols['latn']['decimal']``.
* Babel no longer directly depends on either ``distutils`` or ``setuptools``; if you had been
using the Babel setuptools command extensions, you would need to explicitly depend on ``setuptools`` –
though given you're running ``setup.py`` you probably already do.
Features
~~~~~~~~
* CLDR/Numbers: Add support of local numbering systems for number symbols by kajte in :gh:`1036`
* CLDR: Upgrade to CLDR 43 by rix0rrr in :gh:`1043`
* Frontend: Allow last_translator to be passed as an option to extract_message by AivGitHub in :gh:`1044`
* Frontend: Decouple `pybabel` CLI frontend from distutils/setuptools by akx in :gh:`1041`
* Numbers: Improve parsing of malformed decimals by Olunusib and akx in :gh:`1042`
Infrastructure
~~~~~~~~~~~~~~
* Enforce trailing commas (enable Ruff COM rule and autofix) by akx in :gh:`1045`
* CI: use GitHub output formats by akx in :gh:`1046`
```
### 2.13.1
```
--------------
This is a patch release to fix a few bugs.
Fixes
~~~~~
* Fix a typo in ``_locales_to_names`` by Dl84 in :gh:`1038` (issue :gh:`1037`)
* Fix ``setuptools`` dependency for Python 3.12 by opryprin in :gh:`1033`
```
### 2.13.0
```
--------------
Upcoming deprecation (reverted)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* It was previously announced that this version, Babel 2.13, would be the last version of
Babel to support Python 3.7. Babel 2.14 will still support Python 3.7.
Features
~~~~~~~~
* Add flag to ignore POT-Creation-Date for updates by joeportela in :gh:`999`
* Support 't' specifier in keywords by jeanas in :gh:`1015`
* Add f-string parsing for Python 3.12 (PEP 701) by encukou in :gh:`1027`
Fixes
~~~~~
* Various typing-related fixes by akx in :gh:`979`, in :gh:`978`, :gh:`981`, :gh:`983`
* babel.messages.catalog: deduplicate _to_fuzzy_match_key logic by akx in :gh:`980`
* Freeze format_time() tests to a specific date to fix test failures by mgorny in :gh:`998`
* Spelling and grammar fixes by scop in :gh:`1008`
* Renovate lint tools by akx in :gh:`1017`, :gh:`1028`
* Use SPDX license identifier by vargenau in :gh:`994`
* Use aware UTC datetimes internally by scop in :gh:`1009`
New Contributors
~~~~~~~~~~~~~~~~
* mgorny made their first contribution in :gh:`998`
* vargenau made their first contribution in :gh:`994`
* joeportela made their first contribution in :gh:`999`
* encukou made their first contribution in :gh:`1027`
```
### 2.12.1
```
--------------
Fixes
~~~~~
* Version 2.12.0 was missing the ``py.typed`` marker file. Thanks to Alex Waygood for the fix! :gh:`975`
* The copyright year in all files was bumped to 2023.
```
### 2.12.0
```
--------------
Deprecations & breaking changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Python 3.6 is no longer supported (:gh:`919`) - Aarni Koskela
* The `get_next_timezone_transition` function is no more (:gh:`958`) - Aarni Koskela
* `Locale.parse()` will no longer return `None`; it will always return a Locale or raise an exception.
Passing in `None`, though technically allowed by the typing, will raise. (:gh:`966`)
New features
~~~~~~~~~~~~
* CLDR: Babel now uses CLDR 42 (:gh:`951`) - Aarni Koskela
* Dates: `pytz` is now optional; Babel will prefer it but will use `zoneinfo` when available. (:gh:`940`) - ds-cbo
* General: Babel now ships type annotations, thanks to Jonah Lawrence's work in multiple PRs.
* Locales: modifiers are now retained when parsing locales (:gh:`947`) - martin f. krafft
* Messages: JavaScript template string expression extraction is now smarter. (:gh:`939`) - Johannes Wilm
* Numbers: NaN and Infinity are now better supported (:gh:`955`) - Jonah Lawrence
* Numbers: Short compact currency formats are now supported (:gh:`926`) - Jonah Lawrence
* Numbers: There's now a `Format.compact_decimal` utility function. (:gh:`921`) - Jonah Lawrence
Bugfixes
~~~~~~~~
* Dates: The cache for parsed datetime patterns is now bounded (:gh:`967`) - Aarni Koskela
* Messages: Fuzzy candidate matching accuracy is improved (:gh:`970`) - Jean Abou Samra
* Numbers: Compact singular formats and patterns with no numbers work correctly (:gh:`930`, :gh:`932`) - Jonah Lawrence, Jun Omae
Improvements & cleanup
~~~~~~~~~~~~~~~~~~~~~~
* Dates: `babel.dates.UTC` is now an alias for `datetime.timezone.utc` (:gh:`957`) - Aarni Koskela
* Dates: `babel.localtime` was slightly cleaned up. (:gh:`952`) - Aarni Koskela
* Documentation: Documentation was improved by Maciej Olko, Jonah Lawrence, lilinjie, and Aarni Koskela.
* Infrastructure: Babel is now being linted with pre-commit and ruff. - Aarni Koskela
```
### 2.11.0
```
--------------
Upcoming deprecation
~~~~~~~~~~~~~~~~~~~~
* This version, Babel 2.11, is the last version of Babel to support Python 3.6.
Babel 2.12 will require Python 3.7 or newer.
Improvements
~~~~~~~~~~~~
* Support for hex escapes in JavaScript string literals :gh:`877` - Przemyslaw Wegrzyn
* Add support for formatting decimals in compact form :gh:`909` - Jonah Lawrence
* Adapt parse_date to handle ISO dates in ASCII format :gh:`842` - Eric L.
* Use `ast` instead of `eval` for Python string extraction :gh:`915` - Aarni Koskela
* This also enables extraction from static f-strings.
F-strings with expressions are silently ignored (but won't raise an error as they used to).
Infrastructure
~~~~~~~~~~~~~~
* Tests: Use regular asserts and ``pytest.raises()`` :gh:`875` – Aarni Koskela
* Wheels are now built in GitHub Actions :gh:`888` – Aarni Koskela
* Small improvements to the CLDR downloader script :gh:`894` – Aarni Koskela
* Remove antiquated `__nonzero__` methods :gh:`896` - Nikita Sobolev
* Remove superfluous `__unicode__` declarations :gh:`905` - Lukas Juhrich
* Mark package compatible with Python 3.11 :gh:`913` - Aarni Koskela
* Quiesce pytest warnings :gh:`916` - Aarni Koskela
Bugfixes
~~~~~~~~
* Use email.Message for pofile header parsing instead of the deprecated ``cgi.parse_header`` function. :gh:`876` – Aarni Koskela
* Remove determining time zone via systemsetup on macOS :gh:`914` - Aarni Koskela
Documentation
~~~~~~~~~~~~~
* Update Python versions in documentation :gh:`898` - Raphael Nestler
* Align BSD-3 license with OSI template :gh:`912` - Lukas Kahwe Smith
```
### 2.10.3
```
--------------
This is a bugfix release for Babel 2.10.2, which was mistakenly packaged with outdated locale data.
Thanks to Michał Górny for pointing this out and Jun Omae for verifying.
This and future Babel PyPI packages will be built by a more automated process,
which should make problems like this less likely to occur.
```
### 2.10.2
```
--------------
This is a bugfix release for Babel 2.10.1.
* Fallback count="other" format in format_currency() (:gh:`872`) - Jun Omae
* Fix get_period_id() with ``dayPeriodRule`` across 0:00 (:gh:`871`) - Jun Omae
* Add support for ``b`` and ``B`` period symbols in time format (:gh:`869`) - Jun Omae
* chore(docs/typo): Fixes a minor typo in a function comment (:gh:`864`) - Frank Harrison
```
### 2.10.1
```
--------------
This is a bugfix release for Babel 2.10.0.
* Messages: Fix ``distutils`` import. Regressed in :gh:`843`. (:gh:`852`) - Nehal J Wani
* The wheel file is no longer marked as universal, since Babel only supports Python 3.
```
### 2.10.0
```
--------------
Upcoming deprecation
~~~~~~~~~~~~~~~~~~~~
* The ``get_next_timezone_transition()`` function is marked deprecated in this version and will be removed
likely as soon as Babel 2.11. No replacement for this function is planned; based on discussion in
:gh:`716`, it's likely the function is not used in any real code. (:gh:`852`) - Aarni Koskela, Paul Ganssle
Improvements
~~~~~~~~~~~~
* CLDR: Upgrade to CLDR 41.0. (:gh:`853`) - Aarni Koskela
* The ``c`` and ``e`` plural form operands introduced in CLDR 40 are parsed, but otherwise unsupported. (:gh:`826`)
* Non-nominative forms of units are currently ignored.
* Messages: Implement ``--init-missing`` option for ``pybabel update`` (:gh:`785`) - ruro
* Messages: For ``extract``, you can now replace the built-in ``.*`` / ``_*`` ignored directory patterns
with ones of your own. (:gh:`832`) - Aarni Koskela, Kinshuk Dua
* Messages: Add ``--check`` to verify if catalogs are up-to-date (:gh:`831`) - Krzysztof Jagiełło
* Messages: Add ``--header-comment`` to override default header comment (:gh:`720`) - Mohamed Hafez Morsy, Aarni Koskela
* Dates: ``parse_time`` now supports 12-hour clock, and is better at parsing partial times.
(:gh:`834`) - Aarni Koskela, David Bauer, Arthur Jovart
* Dates: ``parse_date`` and ``parse_time`` now raise ``ParseError``, a subclass of ``ValueError``, in certain cases.
(:gh:`834`) - Aarni Koskela
* Dates: ``parse_date`` and ``parse_time`` now accept the ``format`` parameter.
(:gh:`834`) - Juliette Monsel, Aarni Koskela
Infrastructure
~~~~~~~~~~~~~~
* The internal ``babel/_compat.py`` module is no more (:gh:`808`) - Hugo van Kemenade
* Python 3.10 is officially supported (:gh:`809`) - Hugo van Kemenade
* There's now a friendly GitHub issue template. (:gh:`800`) – Álvaro Mondéjar Rubio
* Don't use the deprecated format_number function internally or in tests - Aarni Koskela
* Add GitHub URL for PyPi (:gh:`846`) - Andrii Oriekhov
* Python 3.12 compatibility: Prefer setuptools imports to distutils imports (:gh:`843`) - Aarni Koskela
* Python 3.11 compatibility: Add deprecations to l*gettext variants (:gh:`835`) - Aarni Koskela
* CI: Babel is now tested with PyPy 3.7. (:gh:`851`) - Aarni Koskela
Bugfixes
~~~~~~~~
* Date formatting: Allow using ``other`` as fallback form (:gh:`827`) - Aarni Koskela
* Locales: ``Locale.parse()`` normalizes variant tags to upper case (:gh:`829`) - Aarni Koskela
* A typo in the plural format for Maltese is fixed. (:gh:`796`) - Lukas Winkler
* Messages: Catalog date parsing is now timezone independent. (:gh:`701`) - rachele-collin
* Messages: Fix duplicate locations when writing without lineno (:gh:`837`) - Sigurd Ljødal
* Messages: Fix missing trailing semicolon in plural form headers (:gh:`848`) - farhan5900
* CLI: Fix output of ``--list-locales`` to not be a bytes repr (:gh:`845`) - Morgan Wahl
Documentation
~~~~~~~~~~~~~
* Documentation is now correctly built again, and up to date (:gh:`830`) - Aarni Koskela
```
### 2.9.1
```
-------------
Bugfixes
~~~~~~~~
* The internal locale-data loading functions now validate the name of the locale file to be loaded and only
allow files within Babel's data directory. Thank you to Chris Lyne of Tenable, Inc. for discovering the issue!
```
### 2.9.0
```
-------------
Upcoming version support changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* This version, Babel 2.9, is the last version of Babel to support Python 2.7, Python 3.4, and Python 3.5.
Improvements
~~~~~~~~~~~~
* CLDR: Use CLDR 37 – Aarni Koskela (:gh:`734`)
* Dates: Handle ZoneInfo objects in get_timezone_location, get_timezone_name - Alessio Bogon (:gh:`741`)
* Numbers: Add group_separator feature in number formatting - Abdullah Javed Nesar (:gh:`726`)
Bugfixes
~~~~~~~~
* Dates: Correct default Format().timedelta format to 'long' to mute deprecation warnings – Aarni Koskela
* Import: Simplify iteration code in "import_cldr.py" – Felix Schwarz
* Import: Stop using deprecated ElementTree methods "getchildren()" and "getiterator()" – Felix Schwarz
* Messages: Fix unicode printing error on Python 2 without TTY. – Niklas Hambüchen
* Messages: Introduce invariant that _invalid_pofile() takes unicode line. – Niklas Hambüchen
* Tests: fix tests when using Python 3.9 – Felix Schwarz
* Tests: Remove deprecated 'sudo: false' from Travis configuration – Jon Dufresne
* Tests: Support Py.test 6.x – Aarni Koskela
* Utilities: LazyProxy: Handle AttributeError in specified func – Nikiforov Konstantin (:gh:`724`)
* Utilities: Replace usage of parser.suite with ast.parse – Miro Hrončok
Documentation
~~~~~~~~~~~~~
* Update parse_number comments – Brad Martin (:gh:`708`)
* Add __iter__ to Catalog documentation – CyanNani123
```
### 2.8.1
```
-------------
This is solely a patch release to make running tests on Py.test 6+ possible.
Bugfixes
~~~~~~~~
* Support Py.test 6 - Aarni Koskela (:gh:`747`, :gh:`750`, :gh:`752`)
```
### 2.8.0
```
-------------
Improvements
~~~~~~~~~~~~
* CLDR: Upgrade to CLDR 36.0 - Aarni Koskela (:gh:`679`)
* Messages: Don't even open files with the "ignore" extraction method - sebleblanc (:gh:`678`)
Bugfixes
~~~~~~~~
* Numbers: Fix formatting very small decimals when quantization is disabled - Lev Lybin, miluChen (:gh:`662`)
* Messages: Attempt to sort all messages – Mario Frasca (:gh:`651`, :gh:`606`)
Docs
~~~~
* Add years to changelog - Romuald Brunet
* Note that installation requires pytz - Steve (Gadget) Barnes
```
### 2.7.0
```
-------------
Possibly incompatible changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
These may be backward incompatible in some cases, as some more-or-less internal
APIs have changed. Please feel free to file issues if you bump into anything
strange and we'll try to help!
* General: Internal uses of ``babel.util.odict`` have been replaced with
``collections.OrderedDict`` from The Python standard library.
Improvements
~~~~~~~~~~~~
* CLDR: Upgrade to CLDR 35.1 - Alberto Mardegan, Aarni Koskela (:gh:`626`, :gh:`643`)
* General: allow anchoring path patterns to the start of a string - Brian Cappello (:gh:`600`)
* General: Bumped version requirement on pytz - chrisbrake (:gh:`592`)
* Messages: `pybabel compile`: exit with code 1 if errors were encountered - Aarni Koskela (:gh:`647`)
* Messages: Add omit-header to update_catalog - Cédric Krier (:gh:`633`)
* Messages: Catalog update: keep user comments from destination by default - Aarni Koskela (:gh:`648`)
* Messages: Skip empty message when writing mo file - Cédric Krier (:gh:`564`)
* Messages: Small fixes to avoid crashes on badly formatted .po files - Bryn Truscott (:gh:`597`)
* Numbers: `parse_decimal()` `strict` argument and `suggestions` - Charly C (:gh:`590`)
* Numbers: don't repeat suggestions in parse_decimal strict - Serban Constantin (:gh:`599`)
* Numbers: implement currency formatting with long display names - Luke Plant (:gh:`585`)
* Numbers: parse_decimal(): assume spaces are equivalent to non-breaking spaces when not in strict mode - Aarni Koskela (:gh:`649`)
* Performance: Cache locale_identifiers() - Aarni Koskela (:gh:`644`)
Bugfixes
~~~~~~~~
* CLDR: Skip alt=... for week data (minDays, firstDay, weekendStart, weekendEnd) - Aarni Koskela (:gh:`634`)
* Dates: Fix wrong weeknumber for 31.12.2018 - BT-sschmid (:gh:`621`)
* Locale: Avoid KeyError trying to get data on WindowsXP - mondeja (:gh:`604`)
* Locale: get_display_name(): Don't attempt to concatenate variant information to None - Aarni Koskela (:gh:`645`)
* Messages: pofile: Add comparison operators to _NormalizedString - Aarni Koskela (:gh:`646`)
* Messages: pofile: don't crash when message.locations can't be sorted - Aarni Koskela (:gh:`646`)
Tooling & docs
~~~~~~~~~~~~~~
* Docs: Remove all references to deprecated easy_install - Jon Dufresne (:gh:`610`)
* Docs: Switch print statement in docs to print function - NotAFile
* Docs: Update all pypi.python.org URLs to pypi.org - Jon Dufresne (:gh:`587`)
* Docs: Use https URLs throughout project where available - Jon Dufresne (:gh:`588`)
* Support: Add testing and document support for Python 3.7 - Jon Dufresne (:gh:`611`)
* Support: Test on Python 3.8-dev - Aarni Koskela (:gh:`642`)
* Support: Using ABCs from collections instead of collections.abc is deprecated. - Julien Palard (:gh:`609`)
* Tests: Fix conftest.py compatibility with pytest 4.3 - Miro Hrončok (:gh:`635`)
* Tests: Update pytest and pytest-cov - Miro Hrončok (:gh:`635`)
```
Links
- PyPI: https://pypi.org/project/babel
- Changelog: https://data.safetycli.com/changelogs/babel/
- Homepage: https://babel.pocoo.org/
- Docs: https://pythonhosted.org/Babel/
Changelog
### 5.2.0
```
Adds support for running chardet CLI via `python -m chardet` (0e9b7bc20366163efcc221281201baff4100fe19, dan-blanchard)
```
### 5.1.0
```
Features
- Add `should_rename_legacy` argument to most functions, which will rename older encodings to their more modern equivalents (e.g., `GB2312` becomes `GB18030`) (264, dan-blanchard)
- Add capital letter sharp S and ISO-8859-15 support (222, SimonWaldherr)
- Add a prober for MacRoman encoding (5 updated as c292b52a97e57c95429ef559af36845019b88b33, Rob Speer and dan-blanchard )
- Add `--minimal` flag to `chardetect` command (214, dan-blanchard)
- Add type annotations to the project and run mypy on CI (261, jdufresne)
- Add support for Python 3.11 (274, hugovk)
Fixes
- Clarify LGPL version in License trove classifier (255, musicinmybrain)
- Remove support for EOL Python 3.6 (260, jdufresne)
- Remove unnecessary guards for non-falsey values (259, jdufresne)
Misc changes
- Switch to Python 3.10 release in GitHub actions (257, jdufresne)
- Remove setup.py in favor of build package (262, jdufresne)
- Run tests on macos, Windows, and 3.11-dev (267, dan-blanchard)
```
### 5.0.0
```
⚠️ This release is the first release of chardet that no longer supports Python < 3.6 ⚠️
In addition to that change, it features the following user-facing changes:
- Added a prober for Johab Korean (207, grizlupo)
- Added a prober for UTF-16/32 BE/LE (109, 206, jpz)
- Added test data for Croatian, Czech, Hungarian, Polish, Slovak, Slovene, Greek, and Turkish, which should help prevent future errors with those languages
- Improved XML tag filtering, which should improve accuracy for XML files (208)
- Tweaked `SingleByteCharSetProber` confidence to match latest uchardet (209)
- Made `detect_all` return child prober confidences (210)
- Updated examples in docs (223, domdfcoding)
- Documentation fixes (212, 224, 225, 226, 220, 221, 244 from too many to mention)
- Minor performance improvements (252, deedy5)
- Add support for Python 3.10 when testing (232, jdufresne)
- Lots of little development cycle improvements, mostly thanks to jdufresne
```
### 4.0.0
```
Benchmarking chardet 4.0.0 on CPython 3.7.5 (default, Sep 8 2020, 12:19:42)
[Clang 11.0.3 (clang-1103.0.32.62)]
--------------------------------------------------------------------------------
.......................................................................................................................................................................................................................................................................................................................................................................
Calls per second for each encoding:
```
Links
- PyPI: https://pypi.org/project/chardet
- Changelog: https://data.safetycli.com/changelogs/chardet/
- Repo: https://github.com/chardet/chardet
Changelog
### 2.1.0
```
* Add value to int parsing when deconstructing url string.
```
### 2.0.0
```
* Update project setup such that we now install as a package.
_Notes_: while this does not alter the underlying application code, we are bumping to
2.0 incase there are unforeseen knock on use-case issues.
```
### 1.3.0
```
* Cosmetic changes to the generation of schemes.
* Bump isort version - 5.11.5.
* raise warning message if database_url is not set.
* CONN_MAX_AGE fix type - Optional[int].
```
### 1.2.0
```
* Add the ability to add test databases.
* Improve url parsing and encoding.
* Fix missing parameter conn_health_check in check function.
```
### 1.1.0
```
* Option for connection health checks parameter.
* Update supported version python 3.11.
* Code changes, various improvments.
* Add project links to setup.py
```
### 1.0.0
```
Initial release of code now dj-database-urls is part of jazzband.
* Add support for cockroachdb.
* Add support for the offical MSSQL connector.
* Update License to be compatible with Jazzband.
* Remove support for Python < 3.5 including Python 2.7
* Update source code to Black format.
* Update CI using pre-commit
```
Links
- PyPI: https://pypi.org/project/dj-database-url
- Changelog: https://data.safetycli.com/changelogs/dj-database-url/
- Repo: https://github.com/jazzband/dj-database-url
Changelog
### 5.0.3
```
==========================
*March 4, 2024*
Django 5.0.3 fixes a security issue with severity "moderate" and several bugs
in 5.0.2.
CVE-2024-27351: Potential regular expression denial-of-service in ``django.utils.text.Truncator.words()``
=========================================================================================================
``django.utils.text.Truncator.words()`` method (with ``html=True``) and
:tfilter:`truncatewords_html` template filter were subject to a potential
regular expression denial-of-service attack using a suitably crafted string
(follow up to :cve:`2019-14232` and :cve:`2023-43665`).
Bugfixes
========
* Fixed a regression in Django 5.0.2 where ``intcomma`` template filter could
return a leading comma for string representation of floats (:ticket:`35172`).
* Fixed a bug in Django 5.0 that caused a crash of ``Signal.asend()`` and
``asend_robust()`` when all receivers were asynchronous functions
(:ticket:`35174`).
* Fixed a regression in Django 5.0.1 where :meth:`.ModelAdmin.lookup_allowed`
would prevent filtering against foreign keys using lookups like ``__isnull``
when the field was not included in :attr:`.ModelAdmin.list_filter`
(:ticket:`35173`).
* Fixed a regression in Django 5.0 that caused a crash of
``sensitive_variables`` and ``sensitive_post_parameters`` decorators on
functions loaded from ``.pyc`` files (:ticket:`35187`).
* Fixed a regression in Django 5.0 that caused a crash when reloading a test
database and a base queryset for a base manager used ``prefetch_related()``
(:ticket:`35238`).
* Fixed a bug in Django 5.0 where facet filters in the admin would crash on a
``SimpleListFilter`` using a queryset without primary keys (:ticket:`35198`).
==========================
```
### 5.0.2
```
==========================
*February 6, 2024*
Django 5.0.2 fixes a security issue with severity "moderate" and several bugs
in 5.0.1. Also, the latest string translations from Transifex are incorporated.
CVE-2024-24680: Potential denial-of-service in ``intcomma`` template filter
===========================================================================
The ``intcomma`` template filter was subject to a potential denial-of-service
attack when used with very long strings.
Bugfixes
========
* Reallowed, following a regression in Django 5.0.1, filtering against local
foreign keys not included in :attr:`.ModelAdmin.list_filter`
(:ticket:`35087`).
* Fixed a regression in Django 5.0 where links in the admin had an incorrect
color (:ticket:`35121`).
* Fixed a bug in Django 5.0 that caused a crash of ``Model.full_clean()`` on
models with a ``GeneratedField`` (:ticket:`35127`).
* Fixed a regression in Django 5.0 that caused a crash of
``FilteredRelation()`` with querysets as right-hand sides (:ticket:`35135`).
``FilteredRelation()`` now raises a ``ValueError`` on querysets as right-hand
sides.
* Fixed a regression in Django 5.0 that caused a crash of the ``dumpdata``
management command when a base queryset used ``prefetch_related()``
(:ticket:`35159`).
* Fixed a regression in Django 5.0 that caused the ``request_finished`` signal to
sometimes not be fired when running Django through an ASGI server, resulting
in potential resource leaks (:ticket:`35059`).
* Fixed a bug in Django 5.0 that caused a migration crash on MySQL when adding
a ``BinaryField``, ``TextField``, ``JSONField``, or ``GeometryField`` with a
``db_default`` (:ticket:`35162`).
* Fixed a bug in Django 5.0 that caused a migration crash on models with a
literal ``db_default`` of a complex type such as ``dict`` instance of a
``JSONField``. Running ``makemigrations`` might generate no-op ``AlterField``
operations for fields using ``db_default`` (:ticket:`35149`).
==========================
```
### 5.0.1
```
==========================
*January 2, 2024*
Django 5.0.1 fixes several bugs in 5.0.
Bugfixes
========
* Reallowed, following a regression in Django 5.0, using a foreign key to a
model with a primary key that is not ``AutoField`` in
:attr:`.ModelAdmin.list_filter` (:ticket:`35020`).
* Fixed a long standing bug in handling the ``RETURNING INTO`` clause that
caused a crash when creating a model instance with a ``GeneratedField`` which
``output_field`` had backend-specific converters (:ticket:`35024`).
* Fixed a regression in Django 5.0 that caused a crash of ``Model.save()`` for
models with both ``GeneratedField`` and ``ForeignKey`` fields
(:ticket:`35019`).
* Fixed a bug in Django 5.0 that caused a migration crash on Oracle < 23c when
adding a ``GeneratedField`` with ``output_field=BooleanField``
(:ticket:`35018`).
* Fixed a regression in Django 5.0 where admin fields on the same line could
overflow the page and become non-interactive (:ticket:`35012`).
* Added compatibility for ``oracledb`` 2.0.0 (:ticket:`35054`).
* Fixed a regression in Django 5.0 where querysets referenced incorrect field
names from ``FilteredRelation()`` (:ticket:`35050`).
* Fixed a regression in Django 5.0 that caused a system check crash when
``ModelAdmin.filter_horizontal`` or ``filter_vertical`` contained a reverse
many-to-many relation with ``related_name`` (:ticket:`35056`).
========================
```
### 5.0
```
========================
*December 4, 2023*
Welcome to Django 5.0!
These release notes cover the :ref:`new features <whats-new-5.0>`, as well as
some :ref:`backwards incompatible changes <backwards-incompatible-5.0>` you'll
want to be aware of when upgrading from Django 4.2 or earlier. We've
:ref:`begun the deprecation process for some features
<deprecated-features-5.0>`.
See the :doc:`/howto/upgrade-version` guide if you're updating an existing
project.
Python compatibility
====================
Django 5.0 supports Python 3.10, 3.11, and 3.12. We **highly recommend** and
only officially support the latest release of each series.
The Django 4.2.x series is the last to support Python 3.8 and 3.9.
Third-party library support for older version of Django
=======================================================
Following the release of Django 5.0, we suggest that third-party app authors
drop support for all versions of Django prior to 4.2. At that time, you should
be able to run your package's tests using ``python -Wd`` so that deprecation
warnings appear. After making the deprecation warning fixes, your app should be
compatible with Django 5.0.
.. _whats-new-5.0:
What's new in Django 5.0
========================
Facet filters in the admin
--------------------------
Facet counts are now shown for applied filters in the admin changelist when
toggled on via the UI. This behavior can be changed via the new
:attr:`.ModelAdmin.show_facets` attribute. For more information see
:ref:`facet-filters`.
Simplified templates for form field rendering
---------------------------------------------
Django 5.0 introduces the concept of a field group, and field group templates.
This simplifies rendering of the related elements of a Django form field such
as its label, widget, help text, and errors.
For example, the template below:
.. code-block:: html+django
<form>
...
<div>
{{ form.name.label_tag }}
{% if form.name.help_text %}
<div class="helptext" id="{{ form.name.auto_id }}_helptext">
{{ form.name.help_text|safe }}
</div>
{% endif %}
{{ form.name.errors }}
{{ form.name }}
<div class="row">
<div class="col">
{{ form.email.label_tag }}
{% if form.email.help_text %}
<div class="helptext" id="{{ form.email.auto_id }}_helptext">
{{ form.email.help_text|safe }}
</div>
{% endif %}
{{ form.email.errors }}
{{ form.email }}
</div>
<div class="col">
{{ form.password.label_tag }}
{% if form.password.help_text %}
<div class="helptext" id="{{ form.password.auto_id }}_helptext">
{{ form.password.help_text|safe }}
</div>
{% endif %}
{{ form.password.errors }}
{{ form.password }}
</div>
</div>
</div>
...
</form>
Can now be simplified to:
.. code-block:: html+django
<form>
...
<div>
{{ form.name.as_field_group }}
<div class="row">
<div class="col">{{ form.email.as_field_group }}</div>
<div class="col">{{ form.password.as_field_group }}</div>
</div>
</div>
...
</form>
:meth:`~django.forms.BoundField.as_field_group` renders fields with the
``"django/forms/field.html"`` template by default and can be customized on a
per-project, per-field, or per-request basis. See
:ref:`reusable-field-group-templates`.
Database-computed default values
--------------------------------
The new :attr:`Field.db_default <django.db.models.Field.db_default>` parameter
sets a database-computed default value. For example::
from django.db import models
from django.db.models.functions import Now, Pi
class MyModel(models.Model):
age = models.IntegerField(db_default=18)
created = models.DateTimeField(db_default=Now())
circumference = models.FloatField(db_default=2 * Pi())
Database generated model field
------------------------------
The new :class:`~django.db.models.GeneratedField` allows creation of database
generated columns. This field can be used on all supported database backends
to create a field that is always computed from other fields. For example::
from django.db import models
from django.db.models import F
class Square(models.Model):
side = models.IntegerField()
area = models.GeneratedField(
expression=F("side") * F("side"),
output_field=models.BigIntegerField(),
db_persist=True,
)
More options for declaring field choices
----------------------------------------
:attr:`.Field.choices` *(for model fields)* and :attr:`.ChoiceField.choices`
*(for form fields)* allow for more flexibility when declaring their values. In
previous versions of Django, ``choices`` should either be a list of 2-tuples,
or an :ref:`field-choices-enum-types` subclass, but the latter required
accessing the ``.choices`` attribute to provide the values in the expected
form::
from django.db import models
Medal = models.TextChoices("Medal", "GOLD SILVER BRONZE")
SPORT_CHOICES = [
("Martial Arts", [("judo", "Judo"), ("karate", "Karate")]),
("Racket", [("badminton", "Badminton"), ("tennis", "Tennis")]),
("unknown", "Unknown"),
]
class Winner(models.Model):
name = models.CharField(...)
medal = models.CharField(..., choices=Medal.choices)
sport = models.CharField(..., choices=SPORT_CHOICES)
Django 5.0 adds support for accepting a mapping or a callable instead of an
iterable, and also no longer requires ``.choices`` to be used directly to
expand :ref:`enumeration types <field-choices-enum-types>`::
from django.db import models
Medal = models.TextChoices("Medal", "GOLD SILVER BRONZE")
SPORT_CHOICES = { Using a mapping instead of a list of 2-tuples.
"Martial Arts": {"judo": "Judo", "karate": "Karate"},
"Racket": {"badminton": "Badminton", "tennis": "Tennis"},
"unknown": "Unknown",
}
def get_scores():
return [(i, str(i)) for i in range(10)]
class Winner(models.Model):
name = models.CharField(...)
medal = models.CharField(..., choices=Medal) Using `.choices` not required.
sport = models.CharField(..., choices=SPORT_CHOICES)
score = models.IntegerField(choices=get_scores) A callable is allowed.
Under the hood the provided ``choices`` are normalized into a list of 2-tuples
as the canonical form whenever the ``choices`` value is updated. For more
information, please check the :ref:`model field reference on choices
<field-choices>`.
Minor features
--------------
:mod:`django.contrib.admin`
~~~~~~~~~~~~~~~~~~~~~~~~~~~
* The new :meth:`.AdminSite.get_log_entries` method allows customizing the
queryset for the site's listed log entries.
* The ``django.contrib.admin.AllValuesFieldListFilter``,
``ChoicesFieldListFilter``, ``RelatedFieldListFilter``, and
``RelatedOnlyFieldListFilter`` admin filters now handle multi-valued query
parameters.
* ``XRegExp`` is upgraded from version 3.2.0 to 5.1.1.
* The new :meth:`.AdminSite.get_model_admin` method returns an admin class for
the given model class.
* Properties in :attr:`.ModelAdmin.list_display` now support ``boolean``
attribute.
* jQuery is upgraded from version 3.6.4 to 3.7.1.
:mod:`django.contrib.auth`
~~~~~~~~~~~~~~~~~~~~~~~~~~
* The default iteration count for the PBKDF2 password hasher is increased from
600,000 to 720,000.
* The new asynchronous functions are now provided, using an
``a`` prefix: :func:`django.contrib.auth.aauthenticate`,
:func:`~.django.contrib.auth.aget_user`,
:func:`~.django.contrib.auth.alogin`, :func:`~.django.contrib.auth.alogout`,
and :func:`~.django.contrib.auth.aupdate_session_auth_hash`.
* ``AuthenticationMiddleware`` now adds an :meth:`.HttpRequest.auser`
asynchronous method that returns the currently logged-in user.
* The new :func:`django.contrib.auth.hashers.acheck_password` asynchronous
function and :meth:`.AbstractBaseUser.acheck_password` method allow
asynchronous checking of user passwords.
:mod:`django.contrib.contenttypes`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* :meth:`.QuerySet.prefetch_related` now supports prefetching
:class:`~django.contrib.contenttypes.fields.GenericForeignKey` with
non-homogeneous set of results.
:mod:`django.contrib.gis`
~~~~~~~~~~~~~~~~~~~~~~~~~
* The new
:class:`ClosestPoint() <django.contrib.gis.db.models.functions.ClosestPoint>`
function returns a 2-dimensional point on the geometry that is closest to
another geometry.
* :ref:`GIS aggregates <gis-aggregation-functions>` now support the ``filter``
argument.
* Support for GDAL 3.7 and GEOS 3.12 is added.
* The new :meth:`.GEOSGeometry.equals_identical` method allows point-wise
equivalence checking of geometries.
:mod:`django.contrib.messages`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* The new :meth:`.MessagesTestMixin.assertMessages` assertion method allows
testing :mod:`~django.contrib.messages` added to a
:class:`response <django.http.HttpResponse>`.
:mod:`django.contrib.postgres`
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* The new :attr:`~.ExclusionConstraint.violation_error_code` attribute of
:class:`~django.contrib.postgres.constraints.ExclusionConstraint` allows
customizing the ``code`` of ``ValidationError`` raised during
:ref:`model validation <validating-objects>`.
Asynchronous views
~~~~~~~~~~~~~~~~~~
* Under ASGI, ``http.disconnect`` events are now handled. This allows views to
perform any necessary cleanup if a client disconnects before the response is
generated. See :ref:`async-handling-disconnect` for more details.
Decorators
~~~~~~~~~~
* The following decorators now support wrapping asynchronous view functions:
* :func:`~django.views.decorators.cache.cache_control`
* :func:`~django.views.decorators.cache.never_cache`
* :func:`~django.views.decorators.common.no_append_slash`
* :func:`~django.views.decorators.csrf.csrf_exempt`
* :func:`~django.views.decorators.csrf.csrf_protect`
* :func:`~django.views.decorators.csrf.ensure_csrf_cookie`
* :func:`~django.views.decorators.csrf.requires_csrf_token`
* :func:`~django.views.decorators.debug.sensitive_variables`
* :func:`~django.views.decorators.debug.sensitive_post_parameters`
* :func:`~django.views.decorators.gzip.gzip_page`
* :func:`~django.views.decorators.http.condition`
* ``conditional_page()``
* :func:`~django.views.decorators.http.etag`
* :func:`~django.views.decorators.http.last_modified`
* :func:`~django.views.decorators.http.require_http_methods`
* :func:`~django.views.decorators.http.require_GET`
* :func:`~django.views.decorators.http.require_POST`
* :func:`~django.views.decorators.http.require_safe`
* :func:`~django.views.decorators.vary.vary_on_cookie`
* :func:`~django.views.decorators.vary.vary_on_headers`
* ``xframe_options_deny()``
* ``xframe_options_sameorigin()``
* ``xframe_options_exempt()``
Error Reporting
~~~~~~~~~~~~~~~
* :func:`~django.views.decorators.debug.sensitive_variables` and
:func:`~django.views.decorators.debug.sensitive_post_parameters` can now be
used with asynchronous functions.
File Storage
~~~~~~~~~~~~
* :meth:`.File.open` now passes all positional (``*args``) and keyword
arguments (``**kwargs``) to Python's built-in :func:`python:open`.
Forms
~~~~~
* The new :attr:`~django.forms.URLField.assume_scheme` argument for
:class:`~django.forms.URLField` allows specifying a default URL scheme.
* In order to improve accessibility, the following changes are made:
* Form fields now include the ``aria-describedby`` HTML attribute to enable
screen readers to associate form fields with their help text.
* Invalid form fields now include the ``aria-invalid="true"`` HTML attribute.
Internationalization
~~~~~~~~~~~~~~~~~~~~
* Support and translations for the Uyghur language are now available.
Migrations
~~~~~~~~~~
* Serialization of functions decorated with :func:`functools.cache` or
:func:`functools.lru_cache` is now supported without the need to write a
custom serializer.
Models
~~~~~~
* The new ``create_defaults`` argument of :meth:`.QuerySet.update_or_create`
and :meth:`.QuerySet.aupdate_or_create` methods allows specifying a different
field values for the create operation.
* The new ``violation_error_code`` attribute of
:class:`~django.db.models.BaseConstraint`,
:class:`~django.db.models.CheckConstraint`, and
:class:`~django.db.models.UniqueConstraint` allows customizing the ``code``
of ``ValidationError`` raised during
:ref:`model validation <validating-objects>`.
* The :ref:`force_insert <ref-models-force-insert>` argument of
:meth:`.Model.save` now allows specifying a tuple of parent classes that must
be forced to be inserted.
* :meth:`.QuerySet.bulk_create` and :meth:`.QuerySet.abulk_create` methods now
set the primary key on each model instance when the ``update_conflicts``
parameter is enabled (if the database supports it).
* The new :attr:`.UniqueConstraint.nulls_distinct` attribute allows customizing
the treatment of ``NULL`` values on PostgreSQL 15+.
* The new :func:`~django.shortcuts.aget_object_or_404` and
:func:`~django.shortcuts.aget_list_or_404` asynchronous shortcuts allow
asynchronous getting objects.
* The new :func:`~django.db.models.aprefetch_related_objects` function allows
asynchronous prefetching of model instances.
* :meth:`.QuerySet.aiterator` now supports previous calls to
``prefetch_related()``.
* On MariaDB 10.7+, ``UUIDField`` is now created as ``UUID`` column rather than
``CHAR(32)`` column. See the migration guide above for more details on
:ref:`migrating-uuidfield`.
* Django now supports `oracledb`_ version 1.3.2 or higher. Support for
``cx_Oracle`` is deprecated as of this release and will be removed in Django
6.0.
Pagination
~~~~~~~~~~
* The new :attr:`django.core.paginator.Paginator.error_messages` argument
allows customizing the error messages raised by :meth:`.Paginator.page`.
Signals
~~~~~~~
* The new :meth:`.Signal.asend` and :meth:`.Signal.asend_robust` methods allow
asynchronous signal dispatch. Signal receivers may be synchronous or
asynchronous, and will be automatically adapted to the correct calling style.
Templates
~~~~~~~~~
* The new :tfilter:`escapeseq` template filter applies :tfilter:`escape` to
each element of a sequence.
Tests
~~~~~
* :class:`~django.test.Client` and :class:`~django.test.AsyncClient` now
provide asynchronous methods, using an ``a`` prefix:
:meth:`~django.test.Client.asession`, :meth:`~django.test.Client.alogin`,
:meth:`~django.test.Client.aforce_login`, and
:meth:`~django.test.Client.alogout`.
* :class:`~django.test.AsyncClient` now supports the ``follow`` parameter.
* :class:`~django.test.runner.DiscoverRunner` now allows showing the duration
of the slowest tests using the :option:`test --durations` option (available
on Python 3.12+).
Validators
~~~~~~~~~~
* The new ``offset`` argument of
:class:`~django.core.validators.StepValueValidator` allows specifying an
offset for valid values.
.. _backwards-incompatible-5.0:
Backwards incompatible changes in 5.0
=====================================
Database backend API
--------------------
This section describes changes that may be needed in third-party database
backends.
* ``DatabaseFeatures.supports_expression_defaults`` should be set to ``False``
if the database doesn't support using database functions as defaults.
* ``DatabaseFeatures.supports_default_keyword_in_insert`` should be set to
``False`` if the database doesn't support the ``DEFAULT`` keyword in
``INSERT`` queries.
* ``DatabaseFeatures.supports_default_keyword_in_bulk_insert`` should be set to
``False`` if the database doesn't support the ``DEFAULT`` keyword in bulk
``INSERT`` queries.
:mod:`django.contrib.gis`
-------------------------
* Support for GDAL 2.2 and 2.3 is removed.
* Support for GEOS 3.6 and 3.7 is removed.
:mod:`django.contrib.sitemaps`
------------------------------
* The ``django.contrib.sitemaps.ping_google()`` function and the
``ping_google`` management command are removed as the Google
Sitemaps ping endpoint is deprecated and will be removed in January 2024.
* The ``django.contrib.sitemaps.SitemapNotFound`` exception class is removed.
Dropped support for MySQL < 8.0.11
----------------------------------
Support for pre-releases of MySQL 8.0.x series is removed. Django 5.0 supports
MySQL 8.0.11 and higher.
Using ``create_defaults__exact`` may now be required with ``QuerySet.update_or_create()``
-----------------------------------------------------------------------------------------
:meth:`.QuerySet.update_or_create` now supports the parameter
``create_defaults``. As a consequence, any models that have a field named
``create_defaults`` that are used with an ``update_or_create()`` should specify
the field in the lookup with ``create_defaults__exact``.
.. _migrating-uuidfield:
Migrating existing ``UUIDField`` on MariaDB 10.7+
-------------------------------------------------
On MariaDB 10.7+, ``UUIDField`` is now created as ``UUID`` column rather than
``CHAR(32)`` column. As a consequence, any ``UUIDField`` created in
Django < 5.0 should be replaced with a ``UUIDField`` subclass backed by
``CHAR(32)``::
class Char32UUIDField(models.UUIDField):
def db_type(self, connection):
return "char(32)"
def get_db_prep_value(self, value, connection, prepared=False):
value = super().get_db_prep_value(value, connection, prepared)
if value is not None:
value = value.hex
return value
For example::
class MyModel(models.Model):
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4)
Should become::
class Char32UUIDField(models.UUIDField): ...
class MyModel(models.Model):
uuid = Char32UUIDField(primary_key=True, default=uuid.uuid4)
Running the :djadmin:`makemigrations` command will generate a migration
containing a no-op ``AlterField`` operation.
Miscellaneous
-------------
* The ``instance`` argument of the undocumented
``BaseModelFormSet.save_existing()`` method is renamed to ``obj``.
* The undocumented ``django.contrib.admin.helpers.checkbox`` is removed.
* Integer fields are now validated as 64-bit integers on SQLite to match the
behavior of ``sqlite3``.
* The undocumented ``Query.annotation_select_mask`` attribute is changed from a
set of strings to an ordered list of strings.
* ``ImageField.update_dimension_fields()`` is no longer called on the
``post_init`` signal if ``width_field`` and ``height_field`` are not set.
* :class:`~django.db.models.functions.Now` database function now uses
``LOCALTIMESTAMP`` instead of ``CURRENT_TIMESTAMP`` on Oracle.
* :attr:`.AdminSite.site_header` is now rendered in a ``<div>`` tag instead of
``<h1>``. Screen reader users rely on heading elements for navigation within
a page. Having two ``<h1>`` elements was confusing and the site header wasn't
helpful as it is repeated on all pages.
* In order to improve accessibility, the admin's main content area and header
content area are now rendered in a ``<main>`` and ``<header>`` tag instead of
``<div>``.
* On databases without native support for the SQL ``XOR`` operator, ``^`` as
the exclusive or (``XOR``) operator now returns rows that are matched by an
odd number of operands rather than exactly one operand. This is consistent
with the behavior of MySQL, MariaDB, and Python.
* The minimum supported version of ``asgiref`` is increased from 3.6.0 to
3.7.0.
* The minimum supported version of ``selenium`` is increased from 3.8.0 to
4.8.0.
* The ``AlreadyRegistered`` and ``NotRegistered`` exceptions are moved from
``django.contrib.admin.sites`` to ``django.contrib.admin.exceptions``.
* The minimum supported version of SQLite is increased from 3.21.0 to 3.27.0.
* Support for ``cx_Oracle`` < 8.3 is removed.
* Executing SQL queries before the app registry has been fully populated now
raises :exc:`RuntimeWarning`.
* :exc:`~django.core.exceptions.BadRequest` is raised for non-UTF-8 encoded
requests with the :mimetype:`application/x-www-form-urlencoded` content type.
See :rfc:`1866` for more details.
* The minimum supported version of ``colorama`` is increased to 0.4.6.
* The minimum supported version of ``docutils`` is increased to 0.19.
* Filtering querysets against overflowing integer values now always returns an
empty queryset. As a consequence, you may need to use ``ExpressionWrapper()``
to :ref:`explicitly wrap <using-f-with-annotations>` arithmetic against
integer fields in such cases.
.. _deprecated-features-5.0:
Features deprecated in 5.0
==========================
Miscellaneous
-------------
* The ``DjangoDivFormRenderer`` and ``Jinja2DivFormRenderer`` transitional form
renderers are deprecated.
* Passing positional arguments ``name`` and ``violation_error_message`` to
:class:`~django.db.models.BaseConstraint` is deprecated in favor of
keyword-only arguments.
* ``request`` is added to the signature of :meth:`.ModelAdmin.lookup_allowed`.
Support for ``ModelAdmin`` subclasses that do not accept this argument is
deprecated.
* The ``get_joining_columns()`` method of ``ForeignObject`` and
``ForeignObjectRel`` is deprecated. Starting with Django 6.0,
``django.db.models.sql.datastructures.Join`` will no longer fallback to
``get_joining_columns()``. Subclasses should implement
``get_joining_fields()`` instead.
* The ``ForeignObject.get_reverse_joining_columns()`` method is deprecated.
* The default scheme for ``forms.URLField`` will change from ``"http"`` to
``"https"`` in Django 6.0. Set :setting:`FORMS_URLFIELD_ASSUME_HTTPS`
transitional setting to ``True`` to opt into assuming ``"https"`` during the
Django 5.x release cycle.
* ``FORMS_URLFIELD_ASSUME_HTTPS`` transitional setting is deprecated.
* Support for calling ``format_html()`` without passing args or kwargs will be
removed.
* Support for ``cx_Oracle`` is deprecated in favor of `oracledb`_ 1.3.2+ Python
driver.
* ``DatabaseOperations.field_cast_sql()`` is deprecated in favor of
``DatabaseOperations.lookup_cast()``. Starting with Django 6.0,
``BuiltinLookup.process_lhs()`` will no longer call ``field_cast_sql()``.
Third-party database backends should implement ``lookup_cast()`` instead.
* The ``django.db.models.enums.ChoicesMeta`` metaclass is renamed to
``ChoicesType``.
* The ``Prefetch.get_current_queryset()`` method is deprecated.
* The ``get_prefetch_queryset()`` method of related managers and descriptors
is deprecated. Starting with Django 6.0, ``get_prefetcher()`` and
``prefetch_related_objects()`` will no longer fallback to
``get_prefetch_queryset()``. Subclasses should implement
``get_prefetch_querysets()`` instead.
.. _`oracledb`: https://oracle.github.io/python-oracledb/
Features removed in 5.0
=======================
These features have reached the end of their deprecation cycle and are removed
in Django 5.0.
See :ref:`deprecated-features-4.0` for details on these changes, includin
Update alabaster from 0.7.12 to 0.7.16.
The bot wasn't able to find a changelog for this release. Got an idea?
Links
- PyPI: https://pypi.org/project/alabasterUpdate argh from 0.26.2 to 0.31.2.
Changelog
### 0.31.2 ``` What's Changed Bugs fixed: - broken support for `Optional[List]` (but not `Optional[list]`), a narrower case of the problem fixed earlier (issue 216) by neithere, thanks to thorwhalen Full changelog: https://argh.readthedocs.io/en/latest/changes.html Full diff: https://github.com/neithere/argh/compare/v0.31.1...v0.31.2 ``` ### 0.31.1 ``` *This text is a brief summary of the full changelog entry: https://argh.readthedocs.io/en/latest/changes.html#version-0-31-1-2024-01-19* What's Changed Bugs fixed: - broken support for type alias `List` (issue 216), thanks to thorwhalen. Enhancements: - cleaned up the README, rearranged other documentation. **Full diff**: https://github.com/neithere/argh/compare/v0.31.0...v0.31.1 ``` ### 0.31.0 ``` What's Changed This release is a major step forward for Argh. It paves the way to a fully annotations-driven approach where decorators will remain a mere legacy. *This text is a brief summary of the full changelog entry: https://argh.readthedocs.io/en/latest/changes.html#version-0-31-0-2023-12-30* Breaking changes: * The typing hints introspection feature is automatically enabled for any command (function) which does **not** have any arguments specified via `arg` decorator. * A small change in the legacy argument mapping policy `BY_NAME_IF_HAS_DEFAULT` concerning the order of variadic positional vs. keyword-only arguments. * Removed the previously deprecated decorator `expects_obj`. Enhancements: * Type hints: basic usage to infer argument types (fixes 203) by neithere in https://github.com/neithere/argh/pull/211 * Support realtime output through a pipe (fixes 145) by neithere in https://github.com/neithere/argh/pull/202 * High-level functions `argh.dispatch_command()` and `argh.dispatch_commands()` now accept a new parameter `old_name_mapping_policy`. Deprecated: - the `namespace` argument in `argh.dispatch()` and `argh.parse_and_resolve()`. Rationale: continued API cleanup. It's already possible to mutate the namespace object between parsing and calling the endpoint; it's unlikely that anyone would need to specify a custom namespace class or pre-populate it before parsing. Please file an issue if you have a valid use case. Other changes: - Refactoring. **Full Diff**: https://github.com/neithere/argh/compare/v0.30.5...v0.31.0 ``` ### 0.30.5 ``` What's Changed * fix: nargs + list as default value (212) by neithere in https://github.com/neithere/argh/pull/213 (thanks to pioio for bug report) * feat: argspec guessing: if `nargs` is not specified but the default value is a list, `nargs="*"` is assumed and passed to argparse. **Full Changelog**: https://github.com/neithere/argh/compare/v0.30.4...v0.30.5 Please refer to the official changelog for more details: https://argh.readthedocs.io/en/latest/changes.html ``` ### 0.30.4 ``` What's Changed There were complaints about the lack of a deprecation cycle for the legacy name mapping policy. This version addresses the issue: - The handling introduced in v.0.30.2 (raising an exception for clarity) is retained for cases when no name mapping policy is specified but function signature contains defaults in non-kwonly args **and kwonly args are also defined**:: def main(alpha, beta=1, *, gamma=2): error — explicit policy required In a similar case but when **kwonly args are not defined** Argh now assumes the legacy name mapping policy (`BY_NAME_IF_HAS_DEFAULT`) and merely issues a deprecation warning with the same message as the exception mentioned above:: def main(alpha, beta=2): `[-b BETA] alpha` + DeprecationWarning This ensures that most of the old scripts still work the same way despite the new policy being used by default and enforced in cases when it's impossible to resolve the mapping conflict. Please note that this "soft" handling is to be removed in version v0.33 (or v1.0 if the former is not deemed necessary). The new name mapping policy will be used by default without warnings, like in v0.30. — by neithere **Full Changelog**: https://github.com/neithere/argh/compare/v0.30.3...v0.30.4 ``` ### 0.30.3 ``` What's Changed * fix: regression — `arg` deco failing with underscore in positional arg name (fixes 208) by neithere in https://github.com/neithere/argh/pull/209 (thanks to kaetir for a report with a reproducible example) **Full Changelog**: https://github.com/neithere/argh/compare/v0.30.2...v0.30.3 ``` ### 0.30.2 ``` What's Changed * fix: raise exception for non-migrated commands (fixes 206) by neithere (reported and valuable feedback given by valentin-feron) in https://github.com/neithere/argh/pull/207 **Full Changelog**: https://github.com/neithere/argh/compare/v0.30.1...v0.30.2 ``` ### 0.30.1 ``` What's Changed Bugs fixed: - Regression: certain special values in argument default value would cause an exception (204 reported by mfussenegger, fixed by neithere) Enhancements: - Improved the tutorial by neithere - Added a more informative error message when the reason is likely to be related to the migration from Argh v0.29 to a version with a new argument name mapping policy by neithere Other changes: - Added `py.typed` marker file for PEP-561 by neithere Details Commits: https://github.com/neithere/argh/compare/v0.30.0...v0.30.1 Full changelog: https://argh.readthedocs.io/en/latest/changes.html#version-0-30-1 ``` ### 0.30.0 ``` What's Changed * Remove previously deprecated code (closes 184) by neithere in https://github.com/neithere/argh/pull/188 * Type annotations for existing code (closes 185) by neithere in https://github.com/neithere/argh/pull/189 * Deprecate `help` command alias and `expects_obj` decorator by neithere in https://github.com/neithere/argh/pull/192 * Document usage with class methods (closes 138) by neithere in https://github.com/neithere/argh/pull/194 * Remove pre_call, expose finer control over dispatching (re 63) by neithere in https://github.com/neithere/argh/pull/193 * Add support for Python 3.12 (closes 196) by neithere in https://github.com/neithere/argh/pull/195 * Refactor assembling module (closes 197) by neithere in https://github.com/neithere/argh/pull/198 * Keyword-only arguments as options (closes 191) by neithere in https://github.com/neithere/argh/pull/199 **Full Changelog**: https://github.com/neithere/argh/compare/v0.29.4...v0.30.0 ``` ### 0.30.0alpha ``` What's Changed * Remove previously deprecated code (closes 184) by neithere in https://github.com/neithere/argh/pull/188 * Type annotations for existing code (closes 185) by neithere in https://github.com/neithere/argh/pull/189 * Deprecate `help` command alias and `expects_obj` decorator by neithere in https://github.com/neithere/argh/pull/192 * Document usage with class methods (closes 138) by neithere in https://github.com/neithere/argh/pull/194 * Remove pre_call, expose finer control over dispatching (re 63) by neithere in https://github.com/neithere/argh/pull/193 * Add support for Python 3.12 (closes 196) by neithere in https://github.com/neithere/argh/pull/195 * Refactor assembling module (closes 197) by neithere in https://github.com/neithere/argh/pull/198 * Keyword-only arguments as options (closes 191) by neithere in https://github.com/neithere/argh/pull/199 **Full Changelog**: https://github.com/neithere/argh/compare/v0.29.4...v0.30.0-alpha ``` ### 0.29.4 ``` Bugs fixed: - Test coverage reported as <100% when argcomplete is installed (187) ``` ### 0.29.3 ``` This is a technical release for packaging purposes. ``` ### 0.29.2 ``` This is a technical release for packaging purposes. ``` ### 0.29.1 ``` This is a technical release for packaging purposes. ``` ### 0.29.0 ``` What's Changed Backwards incompatible changes: * Wrapped exceptions now cause ``dispatching.dispatch()`` to raise ``SystemExit(1)`` instead of returning without error. For most users, this means failed commands will now exit with a failure status instead of a success (by ekimekim in 161). Deprecated: * Renamed arguments in `add_commands()` (165 / 178): - `namespace` → `group_name` - `namespace_kwargs` → `group_kwargs` The old names are deprecated and will be removed in v.0.30. Enhancements: * Can control exit status (see Backwards Incompatible Changes above) when raising ``CommandError`` using the ``code`` keyword arg. Bugs fixed: * Positional arguments should not lead to removal of short form of keyword argument by neithere in 181 Other changes: * Avoid depending on iocapture by using pytest's built-in feature by mr-c in 177 * chore: publishing to prod PyPI by neithere in 173 * test: add coverage for action="count" (127) by neithere in 183 New Contributors * ekimekim made their first contribution in https://github.com/neithere/argh/pull/161 * mr-c made their first contribution in https://github.com/neithere/argh/pull/177 **Full Changelog**: https://github.com/neithere/argh/compare/v0.28.1...v0.29.0 ``` ### 0.28.1 ``` What's Changed * Add Github workflow to publish the release to PyPI by neithere in https://github.com/neithere/argh/pull/167 * fix: argcomplete-related test by neithere in 172 (reported in 169 by kloczek) * fix: assumed prog name in tests by neithere in 171 (reported in 170 by mgorny) **Full Changelog**: https://github.com/neithere/argh/compare/v0.28.0...v0.28.1 Thanks to everyone who reported ``` ### 0.28.0 ``` A major modernisation and cleanup. Backward incompatible changes: - Dropped support for Python 2.7 and 3.7. Deprecated features, to be removed in v.0.30: - `argh.assembling.SUPPORTS_ALIASES`. - Always `True` for recent versions of Python. - `argh.io.safe_input()` AKA `argh.interaction.safe_input()`. - Not relevant anymore. Please use the built-in `input()` instead. - argument `pre_call` in `dispatch()`. Even though this hack seems to have been used in some projects, it was never part of the official API and never recommended. Describing your use case in the discussion about shared arguments (63) can help improve the library to accomodate it in a proper way. - Argument help as annotations. - Annotations will only be used for types after v.0.30. - Please replace any instance of: def func(foo: "Foobar"): with the following:: arg('-f', '--foo', help="Foobar") def func(foo): It will be decided later how to keep this functionality "DRY" (don't repeat yourself) without conflicts with modern conventions and tools. - Added deprecation warnings for some arguments deprecated back in v.0.26. **Full Changelog**: https://github.com/neithere/argh/compare/v0.27.2...v0.28.0 ``` ### 0.27.2 ``` Minor packaging fix: * chore: include file required by tox.ini in the sdist (155) ``` ### 0.27.1 ``` Minor building and packaging fixes: * docs: add Read the Docs config (160) * chore: include tox.ini in the sdist (155) Contributors: mtelka (155) ``` ### 0.27.0 ``` This is the last version to support Python 2.7. Backward incompatible changes: - Dropped support for Python 2.6. Enhancements: - Added support for Python 3.7 through 3.11. - Support introspection of function signature behind the `wraps` decorator (issue 111). Fixed bugs: - When command function signature contained ``**kwargs`` *and* positionals without defaults and with underscores in their names, a weird behaviour could be observed (issue 104). - Fixed introspection through decorators (issue 111). - Switched to Python's built-in `unittest.mock` (PR 154). - Fixed bug with `skip_unknown_args=True` (PR 134). - Fixed tests for Python 3.9.7+ (issue 148). Other changes: - Included the license files in manifest (PR 112). - Extended the list of similar projects (PR 87). - Fixed typos and links in documentation (PR 110, 116, 156). - Switched CI to Github Actions (PR 153). Contributors: dwf (105), jwilk (110), jakirkham (112), brilee, sanga (116), Gidgidonihah (134), mrdavidlaing (153), jelly (154), mtelka (154), hugovk (reviewing PRs). ```Links
- PyPI: https://pypi.org/project/argh - Changelog: https://data.safetycli.com/changelogs/argh/ - Docs: https://pythonhosted.org/argh/Update babel from 2.6.0 to 2.14.0.
Changelog
### 2.14.0 ``` -------------- Upcoming deprecation ~~~~~~~~~~~~~~~~~~~~ * This version, Babel 2.14, is the last version of Babel to support Python 3.7. Babel 2.15 will require Python 3.8 or newer. * We had previously announced Babel 2.13 to have been the last version to support Python 3.7, but being able to use CLDR 43 with Python 3.7 was deemed important enough to keep supporting the EOL Python version for one more release. Possibly backwards incompatible changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * ``Locale.number_symbols`` will now have first-level keys for each numbering system. Since the implicit default numbering system still is ``"latn"``, what had previously been e.g. ``Locale.number_symbols['decimal']`` is now ``Locale.number_symbols['latn']['decimal']``. * Babel no longer directly depends on either ``distutils`` or ``setuptools``; if you had been using the Babel setuptools command extensions, you would need to explicitly depend on ``setuptools`` – though given you're running ``setup.py`` you probably already do. Features ~~~~~~~~ * CLDR/Numbers: Add support of local numbering systems for number symbols by kajte in :gh:`1036` * CLDR: Upgrade to CLDR 43 by rix0rrr in :gh:`1043` * Frontend: Allow last_translator to be passed as an option to extract_message by AivGitHub in :gh:`1044` * Frontend: Decouple `pybabel` CLI frontend from distutils/setuptools by akx in :gh:`1041` * Numbers: Improve parsing of malformed decimals by Olunusib and akx in :gh:`1042` Infrastructure ~~~~~~~~~~~~~~ * Enforce trailing commas (enable Ruff COM rule and autofix) by akx in :gh:`1045` * CI: use GitHub output formats by akx in :gh:`1046` ``` ### 2.13.1 ``` -------------- This is a patch release to fix a few bugs. Fixes ~~~~~ * Fix a typo in ``_locales_to_names`` by Dl84 in :gh:`1038` (issue :gh:`1037`) * Fix ``setuptools`` dependency for Python 3.12 by opryprin in :gh:`1033` ``` ### 2.13.0 ``` -------------- Upcoming deprecation (reverted) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * It was previously announced that this version, Babel 2.13, would be the last version of Babel to support Python 3.7. Babel 2.14 will still support Python 3.7. Features ~~~~~~~~ * Add flag to ignore POT-Creation-Date for updates by joeportela in :gh:`999` * Support 't' specifier in keywords by jeanas in :gh:`1015` * Add f-string parsing for Python 3.12 (PEP 701) by encukou in :gh:`1027` Fixes ~~~~~ * Various typing-related fixes by akx in :gh:`979`, in :gh:`978`, :gh:`981`, :gh:`983` * babel.messages.catalog: deduplicate _to_fuzzy_match_key logic by akx in :gh:`980` * Freeze format_time() tests to a specific date to fix test failures by mgorny in :gh:`998` * Spelling and grammar fixes by scop in :gh:`1008` * Renovate lint tools by akx in :gh:`1017`, :gh:`1028` * Use SPDX license identifier by vargenau in :gh:`994` * Use aware UTC datetimes internally by scop in :gh:`1009` New Contributors ~~~~~~~~~~~~~~~~ * mgorny made their first contribution in :gh:`998` * vargenau made their first contribution in :gh:`994` * joeportela made their first contribution in :gh:`999` * encukou made their first contribution in :gh:`1027` ``` ### 2.12.1 ``` -------------- Fixes ~~~~~ * Version 2.12.0 was missing the ``py.typed`` marker file. Thanks to Alex Waygood for the fix! :gh:`975` * The copyright year in all files was bumped to 2023. ``` ### 2.12.0 ``` -------------- Deprecations & breaking changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Python 3.6 is no longer supported (:gh:`919`) - Aarni Koskela * The `get_next_timezone_transition` function is no more (:gh:`958`) - Aarni Koskela * `Locale.parse()` will no longer return `None`; it will always return a Locale or raise an exception. Passing in `None`, though technically allowed by the typing, will raise. (:gh:`966`) New features ~~~~~~~~~~~~ * CLDR: Babel now uses CLDR 42 (:gh:`951`) - Aarni Koskela * Dates: `pytz` is now optional; Babel will prefer it but will use `zoneinfo` when available. (:gh:`940`) - ds-cbo * General: Babel now ships type annotations, thanks to Jonah Lawrence's work in multiple PRs. * Locales: modifiers are now retained when parsing locales (:gh:`947`) - martin f. krafft * Messages: JavaScript template string expression extraction is now smarter. (:gh:`939`) - Johannes Wilm * Numbers: NaN and Infinity are now better supported (:gh:`955`) - Jonah Lawrence * Numbers: Short compact currency formats are now supported (:gh:`926`) - Jonah Lawrence * Numbers: There's now a `Format.compact_decimal` utility function. (:gh:`921`) - Jonah Lawrence Bugfixes ~~~~~~~~ * Dates: The cache for parsed datetime patterns is now bounded (:gh:`967`) - Aarni Koskela * Messages: Fuzzy candidate matching accuracy is improved (:gh:`970`) - Jean Abou Samra * Numbers: Compact singular formats and patterns with no numbers work correctly (:gh:`930`, :gh:`932`) - Jonah Lawrence, Jun Omae Improvements & cleanup ~~~~~~~~~~~~~~~~~~~~~~ * Dates: `babel.dates.UTC` is now an alias for `datetime.timezone.utc` (:gh:`957`) - Aarni Koskela * Dates: `babel.localtime` was slightly cleaned up. (:gh:`952`) - Aarni Koskela * Documentation: Documentation was improved by Maciej Olko, Jonah Lawrence, lilinjie, and Aarni Koskela. * Infrastructure: Babel is now being linted with pre-commit and ruff. - Aarni Koskela ``` ### 2.11.0 ``` -------------- Upcoming deprecation ~~~~~~~~~~~~~~~~~~~~ * This version, Babel 2.11, is the last version of Babel to support Python 3.6. Babel 2.12 will require Python 3.7 or newer. Improvements ~~~~~~~~~~~~ * Support for hex escapes in JavaScript string literals :gh:`877` - Przemyslaw Wegrzyn * Add support for formatting decimals in compact form :gh:`909` - Jonah Lawrence * Adapt parse_date to handle ISO dates in ASCII format :gh:`842` - Eric L. * Use `ast` instead of `eval` for Python string extraction :gh:`915` - Aarni Koskela * This also enables extraction from static f-strings. F-strings with expressions are silently ignored (but won't raise an error as they used to). Infrastructure ~~~~~~~~~~~~~~ * Tests: Use regular asserts and ``pytest.raises()`` :gh:`875` – Aarni Koskela * Wheels are now built in GitHub Actions :gh:`888` – Aarni Koskela * Small improvements to the CLDR downloader script :gh:`894` – Aarni Koskela * Remove antiquated `__nonzero__` methods :gh:`896` - Nikita Sobolev * Remove superfluous `__unicode__` declarations :gh:`905` - Lukas Juhrich * Mark package compatible with Python 3.11 :gh:`913` - Aarni Koskela * Quiesce pytest warnings :gh:`916` - Aarni Koskela Bugfixes ~~~~~~~~ * Use email.Message for pofile header parsing instead of the deprecated ``cgi.parse_header`` function. :gh:`876` – Aarni Koskela * Remove determining time zone via systemsetup on macOS :gh:`914` - Aarni Koskela Documentation ~~~~~~~~~~~~~ * Update Python versions in documentation :gh:`898` - Raphael Nestler * Align BSD-3 license with OSI template :gh:`912` - Lukas Kahwe Smith ``` ### 2.10.3 ``` -------------- This is a bugfix release for Babel 2.10.2, which was mistakenly packaged with outdated locale data. Thanks to Michał Górny for pointing this out and Jun Omae for verifying. This and future Babel PyPI packages will be built by a more automated process, which should make problems like this less likely to occur. ``` ### 2.10.2 ``` -------------- This is a bugfix release for Babel 2.10.1. * Fallback count="other" format in format_currency() (:gh:`872`) - Jun Omae * Fix get_period_id() with ``dayPeriodRule`` across 0:00 (:gh:`871`) - Jun Omae * Add support for ``b`` and ``B`` period symbols in time format (:gh:`869`) - Jun Omae * chore(docs/typo): Fixes a minor typo in a function comment (:gh:`864`) - Frank Harrison ``` ### 2.10.1 ``` -------------- This is a bugfix release for Babel 2.10.0. * Messages: Fix ``distutils`` import. Regressed in :gh:`843`. (:gh:`852`) - Nehal J Wani * The wheel file is no longer marked as universal, since Babel only supports Python 3. ``` ### 2.10.0 ``` -------------- Upcoming deprecation ~~~~~~~~~~~~~~~~~~~~ * The ``get_next_timezone_transition()`` function is marked deprecated in this version and will be removed likely as soon as Babel 2.11. No replacement for this function is planned; based on discussion in :gh:`716`, it's likely the function is not used in any real code. (:gh:`852`) - Aarni Koskela, Paul Ganssle Improvements ~~~~~~~~~~~~ * CLDR: Upgrade to CLDR 41.0. (:gh:`853`) - Aarni Koskela * The ``c`` and ``e`` plural form operands introduced in CLDR 40 are parsed, but otherwise unsupported. (:gh:`826`) * Non-nominative forms of units are currently ignored. * Messages: Implement ``--init-missing`` option for ``pybabel update`` (:gh:`785`) - ruro * Messages: For ``extract``, you can now replace the built-in ``.*`` / ``_*`` ignored directory patterns with ones of your own. (:gh:`832`) - Aarni Koskela, Kinshuk Dua * Messages: Add ``--check`` to verify if catalogs are up-to-date (:gh:`831`) - Krzysztof Jagiełło * Messages: Add ``--header-comment`` to override default header comment (:gh:`720`) - Mohamed Hafez Morsy, Aarni Koskela * Dates: ``parse_time`` now supports 12-hour clock, and is better at parsing partial times. (:gh:`834`) - Aarni Koskela, David Bauer, Arthur Jovart * Dates: ``parse_date`` and ``parse_time`` now raise ``ParseError``, a subclass of ``ValueError``, in certain cases. (:gh:`834`) - Aarni Koskela * Dates: ``parse_date`` and ``parse_time`` now accept the ``format`` parameter. (:gh:`834`) - Juliette Monsel, Aarni Koskela Infrastructure ~~~~~~~~~~~~~~ * The internal ``babel/_compat.py`` module is no more (:gh:`808`) - Hugo van Kemenade * Python 3.10 is officially supported (:gh:`809`) - Hugo van Kemenade * There's now a friendly GitHub issue template. (:gh:`800`) – Álvaro Mondéjar Rubio * Don't use the deprecated format_number function internally or in tests - Aarni Koskela * Add GitHub URL for PyPi (:gh:`846`) - Andrii Oriekhov * Python 3.12 compatibility: Prefer setuptools imports to distutils imports (:gh:`843`) - Aarni Koskela * Python 3.11 compatibility: Add deprecations to l*gettext variants (:gh:`835`) - Aarni Koskela * CI: Babel is now tested with PyPy 3.7. (:gh:`851`) - Aarni Koskela Bugfixes ~~~~~~~~ * Date formatting: Allow using ``other`` as fallback form (:gh:`827`) - Aarni Koskela * Locales: ``Locale.parse()`` normalizes variant tags to upper case (:gh:`829`) - Aarni Koskela * A typo in the plural format for Maltese is fixed. (:gh:`796`) - Lukas Winkler * Messages: Catalog date parsing is now timezone independent. (:gh:`701`) - rachele-collin * Messages: Fix duplicate locations when writing without lineno (:gh:`837`) - Sigurd Ljødal * Messages: Fix missing trailing semicolon in plural form headers (:gh:`848`) - farhan5900 * CLI: Fix output of ``--list-locales`` to not be a bytes repr (:gh:`845`) - Morgan Wahl Documentation ~~~~~~~~~~~~~ * Documentation is now correctly built again, and up to date (:gh:`830`) - Aarni Koskela ``` ### 2.9.1 ``` ------------- Bugfixes ~~~~~~~~ * The internal locale-data loading functions now validate the name of the locale file to be loaded and only allow files within Babel's data directory. Thank you to Chris Lyne of Tenable, Inc. for discovering the issue! ``` ### 2.9.0 ``` ------------- Upcoming version support changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * This version, Babel 2.9, is the last version of Babel to support Python 2.7, Python 3.4, and Python 3.5. Improvements ~~~~~~~~~~~~ * CLDR: Use CLDR 37 – Aarni Koskela (:gh:`734`) * Dates: Handle ZoneInfo objects in get_timezone_location, get_timezone_name - Alessio Bogon (:gh:`741`) * Numbers: Add group_separator feature in number formatting - Abdullah Javed Nesar (:gh:`726`) Bugfixes ~~~~~~~~ * Dates: Correct default Format().timedelta format to 'long' to mute deprecation warnings – Aarni Koskela * Import: Simplify iteration code in "import_cldr.py" – Felix Schwarz * Import: Stop using deprecated ElementTree methods "getchildren()" and "getiterator()" – Felix Schwarz * Messages: Fix unicode printing error on Python 2 without TTY. – Niklas Hambüchen * Messages: Introduce invariant that _invalid_pofile() takes unicode line. – Niklas Hambüchen * Tests: fix tests when using Python 3.9 – Felix Schwarz * Tests: Remove deprecated 'sudo: false' from Travis configuration – Jon Dufresne * Tests: Support Py.test 6.x – Aarni Koskela * Utilities: LazyProxy: Handle AttributeError in specified func – Nikiforov Konstantin (:gh:`724`) * Utilities: Replace usage of parser.suite with ast.parse – Miro Hrončok Documentation ~~~~~~~~~~~~~ * Update parse_number comments – Brad Martin (:gh:`708`) * Add __iter__ to Catalog documentation – CyanNani123 ``` ### 2.8.1 ``` ------------- This is solely a patch release to make running tests on Py.test 6+ possible. Bugfixes ~~~~~~~~ * Support Py.test 6 - Aarni Koskela (:gh:`747`, :gh:`750`, :gh:`752`) ``` ### 2.8.0 ``` ------------- Improvements ~~~~~~~~~~~~ * CLDR: Upgrade to CLDR 36.0 - Aarni Koskela (:gh:`679`) * Messages: Don't even open files with the "ignore" extraction method - sebleblanc (:gh:`678`) Bugfixes ~~~~~~~~ * Numbers: Fix formatting very small decimals when quantization is disabled - Lev Lybin, miluChen (:gh:`662`) * Messages: Attempt to sort all messages – Mario Frasca (:gh:`651`, :gh:`606`) Docs ~~~~ * Add years to changelog - Romuald Brunet * Note that installation requires pytz - Steve (Gadget) Barnes ``` ### 2.7.0 ``` ------------- Possibly incompatible changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ These may be backward incompatible in some cases, as some more-or-less internal APIs have changed. Please feel free to file issues if you bump into anything strange and we'll try to help! * General: Internal uses of ``babel.util.odict`` have been replaced with ``collections.OrderedDict`` from The Python standard library. Improvements ~~~~~~~~~~~~ * CLDR: Upgrade to CLDR 35.1 - Alberto Mardegan, Aarni Koskela (:gh:`626`, :gh:`643`) * General: allow anchoring path patterns to the start of a string - Brian Cappello (:gh:`600`) * General: Bumped version requirement on pytz - chrisbrake (:gh:`592`) * Messages: `pybabel compile`: exit with code 1 if errors were encountered - Aarni Koskela (:gh:`647`) * Messages: Add omit-header to update_catalog - Cédric Krier (:gh:`633`) * Messages: Catalog update: keep user comments from destination by default - Aarni Koskela (:gh:`648`) * Messages: Skip empty message when writing mo file - Cédric Krier (:gh:`564`) * Messages: Small fixes to avoid crashes on badly formatted .po files - Bryn Truscott (:gh:`597`) * Numbers: `parse_decimal()` `strict` argument and `suggestions` - Charly C (:gh:`590`) * Numbers: don't repeat suggestions in parse_decimal strict - Serban Constantin (:gh:`599`) * Numbers: implement currency formatting with long display names - Luke Plant (:gh:`585`) * Numbers: parse_decimal(): assume spaces are equivalent to non-breaking spaces when not in strict mode - Aarni Koskela (:gh:`649`) * Performance: Cache locale_identifiers() - Aarni Koskela (:gh:`644`) Bugfixes ~~~~~~~~ * CLDR: Skip alt=... for week data (minDays, firstDay, weekendStart, weekendEnd) - Aarni Koskela (:gh:`634`) * Dates: Fix wrong weeknumber for 31.12.2018 - BT-sschmid (:gh:`621`) * Locale: Avoid KeyError trying to get data on WindowsXP - mondeja (:gh:`604`) * Locale: get_display_name(): Don't attempt to concatenate variant information to None - Aarni Koskela (:gh:`645`) * Messages: pofile: Add comparison operators to _NormalizedString - Aarni Koskela (:gh:`646`) * Messages: pofile: don't crash when message.locations can't be sorted - Aarni Koskela (:gh:`646`) Tooling & docs ~~~~~~~~~~~~~~ * Docs: Remove all references to deprecated easy_install - Jon Dufresne (:gh:`610`) * Docs: Switch print statement in docs to print function - NotAFile * Docs: Update all pypi.python.org URLs to pypi.org - Jon Dufresne (:gh:`587`) * Docs: Use https URLs throughout project where available - Jon Dufresne (:gh:`588`) * Support: Add testing and document support for Python 3.7 - Jon Dufresne (:gh:`611`) * Support: Test on Python 3.8-dev - Aarni Koskela (:gh:`642`) * Support: Using ABCs from collections instead of collections.abc is deprecated. - Julien Palard (:gh:`609`) * Tests: Fix conftest.py compatibility with pytest 4.3 - Miro Hrončok (:gh:`635`) * Tests: Update pytest and pytest-cov - Miro Hrončok (:gh:`635`) ```Links
- PyPI: https://pypi.org/project/babel - Changelog: https://data.safetycli.com/changelogs/babel/ - Homepage: https://babel.pocoo.org/ - Docs: https://pythonhosted.org/Babel/Update certifi from 2018.11.29 to 2024.2.2.
The bot wasn't able to find a changelog for this release. Got an idea?
Links
- PyPI: https://pypi.org/project/certifi - Repo: https://github.com/certifi/python-certifiUpdate chardet from 3.0.4 to 5.2.0.
Changelog
### 5.2.0 ``` Adds support for running chardet CLI via `python -m chardet` (0e9b7bc20366163efcc221281201baff4100fe19, dan-blanchard) ``` ### 5.1.0 ``` Features - Add `should_rename_legacy` argument to most functions, which will rename older encodings to their more modern equivalents (e.g., `GB2312` becomes `GB18030`) (264, dan-blanchard) - Add capital letter sharp S and ISO-8859-15 support (222, SimonWaldherr) - Add a prober for MacRoman encoding (5 updated as c292b52a97e57c95429ef559af36845019b88b33, Rob Speer and dan-blanchard ) - Add `--minimal` flag to `chardetect` command (214, dan-blanchard) - Add type annotations to the project and run mypy on CI (261, jdufresne) - Add support for Python 3.11 (274, hugovk) Fixes - Clarify LGPL version in License trove classifier (255, musicinmybrain) - Remove support for EOL Python 3.6 (260, jdufresne) - Remove unnecessary guards for non-falsey values (259, jdufresne) Misc changes - Switch to Python 3.10 release in GitHub actions (257, jdufresne) - Remove setup.py in favor of build package (262, jdufresne) - Run tests on macos, Windows, and 3.11-dev (267, dan-blanchard) ``` ### 5.0.0 ``` ⚠️ This release is the first release of chardet that no longer supports Python < 3.6 ⚠️ In addition to that change, it features the following user-facing changes: - Added a prober for Johab Korean (207, grizlupo) - Added a prober for UTF-16/32 BE/LE (109, 206, jpz) - Added test data for Croatian, Czech, Hungarian, Polish, Slovak, Slovene, Greek, and Turkish, which should help prevent future errors with those languages - Improved XML tag filtering, which should improve accuracy for XML files (208) - Tweaked `SingleByteCharSetProber` confidence to match latest uchardet (209) - Made `detect_all` return child prober confidences (210) - Updated examples in docs (223, domdfcoding) - Documentation fixes (212, 224, 225, 226, 220, 221, 244 from too many to mention) - Minor performance improvements (252, deedy5) - Add support for Python 3.10 when testing (232, jdufresne) - Lots of little development cycle improvements, mostly thanks to jdufresne ``` ### 4.0.0 ``` Benchmarking chardet 4.0.0 on CPython 3.7.5 (default, Sep 8 2020, 12:19:42) [Clang 11.0.3 (clang-1103.0.32.62)] -------------------------------------------------------------------------------- ....................................................................................................................................................................................................................................................................................................................................................................... Calls per second for each encoding: ```Links
- PyPI: https://pypi.org/project/chardet - Changelog: https://data.safetycli.com/changelogs/chardet/ - Repo: https://github.com/chardet/chardetUpdate dj-database-url from 0.5.0 to 2.1.0.
Changelog
### 2.1.0 ``` * Add value to int parsing when deconstructing url string. ``` ### 2.0.0 ``` * Update project setup such that we now install as a package. _Notes_: while this does not alter the underlying application code, we are bumping to 2.0 incase there are unforeseen knock on use-case issues. ``` ### 1.3.0 ``` * Cosmetic changes to the generation of schemes. * Bump isort version - 5.11.5. * raise warning message if database_url is not set. * CONN_MAX_AGE fix type - Optional[int]. ``` ### 1.2.0 ``` * Add the ability to add test databases. * Improve url parsing and encoding. * Fix missing parameter conn_health_check in check function. ``` ### 1.1.0 ``` * Option for connection health checks parameter. * Update supported version python 3.11. * Code changes, various improvments. * Add project links to setup.py ``` ### 1.0.0 ``` Initial release of code now dj-database-urls is part of jazzband. * Add support for cockroachdb. * Add support for the offical MSSQL connector. * Update License to be compatible with Jazzband. * Remove support for Python < 3.5 including Python 2.7 * Update source code to Black format. * Update CI using pre-commit ```Links
- PyPI: https://pypi.org/project/dj-database-url - Changelog: https://data.safetycli.com/changelogs/dj-database-url/ - Repo: https://github.com/jazzband/dj-database-urlUpdate django from 2.1.4 to 5.0.3.
Changelog
### 5.0.3 ``` ========================== *March 4, 2024* Django 5.0.3 fixes a security issue with severity "moderate" and several bugs in 5.0.2. CVE-2024-27351: Potential regular expression denial-of-service in ``django.utils.text.Truncator.words()`` ========================================================================================================= ``django.utils.text.Truncator.words()`` method (with ``html=True``) and :tfilter:`truncatewords_html` template filter were subject to a potential regular expression denial-of-service attack using a suitably crafted string (follow up to :cve:`2019-14232` and :cve:`2023-43665`). Bugfixes ======== * Fixed a regression in Django 5.0.2 where ``intcomma`` template filter could return a leading comma for string representation of floats (:ticket:`35172`). * Fixed a bug in Django 5.0 that caused a crash of ``Signal.asend()`` and ``asend_robust()`` when all receivers were asynchronous functions (:ticket:`35174`). * Fixed a regression in Django 5.0.1 where :meth:`.ModelAdmin.lookup_allowed` would prevent filtering against foreign keys using lookups like ``__isnull`` when the field was not included in :attr:`.ModelAdmin.list_filter` (:ticket:`35173`). * Fixed a regression in Django 5.0 that caused a crash of ``sensitive_variables`` and ``sensitive_post_parameters`` decorators on functions loaded from ``.pyc`` files (:ticket:`35187`). * Fixed a regression in Django 5.0 that caused a crash when reloading a test database and a base queryset for a base manager used ``prefetch_related()`` (:ticket:`35238`). * Fixed a bug in Django 5.0 where facet filters in the admin would crash on a ``SimpleListFilter`` using a queryset without primary keys (:ticket:`35198`). ========================== ``` ### 5.0.2 ``` ========================== *February 6, 2024* Django 5.0.2 fixes a security issue with severity "moderate" and several bugs in 5.0.1. Also, the latest string translations from Transifex are incorporated. CVE-2024-24680: Potential denial-of-service in ``intcomma`` template filter =========================================================================== The ``intcomma`` template filter was subject to a potential denial-of-service attack when used with very long strings. Bugfixes ======== * Reallowed, following a regression in Django 5.0.1, filtering against local foreign keys not included in :attr:`.ModelAdmin.list_filter` (:ticket:`35087`). * Fixed a regression in Django 5.0 where links in the admin had an incorrect color (:ticket:`35121`). * Fixed a bug in Django 5.0 that caused a crash of ``Model.full_clean()`` on models with a ``GeneratedField`` (:ticket:`35127`). * Fixed a regression in Django 5.0 that caused a crash of ``FilteredRelation()`` with querysets as right-hand sides (:ticket:`35135`). ``FilteredRelation()`` now raises a ``ValueError`` on querysets as right-hand sides. * Fixed a regression in Django 5.0 that caused a crash of the ``dumpdata`` management command when a base queryset used ``prefetch_related()`` (:ticket:`35159`). * Fixed a regression in Django 5.0 that caused the ``request_finished`` signal to sometimes not be fired when running Django through an ASGI server, resulting in potential resource leaks (:ticket:`35059`). * Fixed a bug in Django 5.0 that caused a migration crash on MySQL when adding a ``BinaryField``, ``TextField``, ``JSONField``, or ``GeometryField`` with a ``db_default`` (:ticket:`35162`). * Fixed a bug in Django 5.0 that caused a migration crash on models with a literal ``db_default`` of a complex type such as ``dict`` instance of a ``JSONField``. Running ``makemigrations`` might generate no-op ``AlterField`` operations for fields using ``db_default`` (:ticket:`35149`). ========================== ``` ### 5.0.1 ``` ========================== *January 2, 2024* Django 5.0.1 fixes several bugs in 5.0. Bugfixes ======== * Reallowed, following a regression in Django 5.0, using a foreign key to a model with a primary key that is not ``AutoField`` in :attr:`.ModelAdmin.list_filter` (:ticket:`35020`). * Fixed a long standing bug in handling the ``RETURNING INTO`` clause that caused a crash when creating a model instance with a ``GeneratedField`` which ``output_field`` had backend-specific converters (:ticket:`35024`). * Fixed a regression in Django 5.0 that caused a crash of ``Model.save()`` for models with both ``GeneratedField`` and ``ForeignKey`` fields (:ticket:`35019`). * Fixed a bug in Django 5.0 that caused a migration crash on Oracle < 23c when adding a ``GeneratedField`` with ``output_field=BooleanField`` (:ticket:`35018`). * Fixed a regression in Django 5.0 where admin fields on the same line could overflow the page and become non-interactive (:ticket:`35012`). * Added compatibility for ``oracledb`` 2.0.0 (:ticket:`35054`). * Fixed a regression in Django 5.0 where querysets referenced incorrect field names from ``FilteredRelation()`` (:ticket:`35050`). * Fixed a regression in Django 5.0 that caused a system check crash when ``ModelAdmin.filter_horizontal`` or ``filter_vertical`` contained a reverse many-to-many relation with ``related_name`` (:ticket:`35056`). ======================== ``` ### 5.0 ``` ======================== *December 4, 2023* Welcome to Django 5.0! These release notes cover the :ref:`new features <whats-new-5.0>`, as well as some :ref:`backwards incompatible changes <backwards-incompatible-5.0>` you'll want to be aware of when upgrading from Django 4.2 or earlier. We've :ref:`begun the deprecation process for some features <deprecated-features-5.0>`. See the :doc:`/howto/upgrade-version` guide if you're updating an existing project. Python compatibility ==================== Django 5.0 supports Python 3.10, 3.11, and 3.12. We **highly recommend** and only officially support the latest release of each series. The Django 4.2.x series is the last to support Python 3.8 and 3.9. Third-party library support for older version of Django ======================================================= Following the release of Django 5.0, we suggest that third-party app authors drop support for all versions of Django prior to 4.2. At that time, you should be able to run your package's tests using ``python -Wd`` so that deprecation warnings appear. After making the deprecation warning fixes, your app should be compatible with Django 5.0. .. _whats-new-5.0: What's new in Django 5.0 ======================== Facet filters in the admin -------------------------- Facet counts are now shown for applied filters in the admin changelist when toggled on via the UI. This behavior can be changed via the new :attr:`.ModelAdmin.show_facets` attribute. For more information see :ref:`facet-filters`. Simplified templates for form field rendering --------------------------------------------- Django 5.0 introduces the concept of a field group, and field group templates. This simplifies rendering of the related elements of a Django form field such as its label, widget, help text, and errors. For example, the template below: .. code-block:: html+django <form> ... <div> {{ form.name.label_tag }} {% if form.name.help_text %} <div class="helptext" id="{{ form.name.auto_id }}_helptext"> {{ form.name.help_text|safe }} </div> {% endif %} {{ form.name.errors }} {{ form.name }} <div class="row"> <div class="col"> {{ form.email.label_tag }} {% if form.email.help_text %} <div class="helptext" id="{{ form.email.auto_id }}_helptext"> {{ form.email.help_text|safe }} </div> {% endif %} {{ form.email.errors }} {{ form.email }} </div> <div class="col"> {{ form.password.label_tag }} {% if form.password.help_text %} <div class="helptext" id="{{ form.password.auto_id }}_helptext"> {{ form.password.help_text|safe }} </div> {% endif %} {{ form.password.errors }} {{ form.password }} </div> </div> </div> ... </form> Can now be simplified to: .. code-block:: html+django <form> ... <div> {{ form.name.as_field_group }} <div class="row"> <div class="col">{{ form.email.as_field_group }}</div> <div class="col">{{ form.password.as_field_group }}</div> </div> </div> ... </form> :meth:`~django.forms.BoundField.as_field_group` renders fields with the ``"django/forms/field.html"`` template by default and can be customized on a per-project, per-field, or per-request basis. See :ref:`reusable-field-group-templates`. Database-computed default values -------------------------------- The new :attr:`Field.db_default <django.db.models.Field.db_default>` parameter sets a database-computed default value. For example:: from django.db import models from django.db.models.functions import Now, Pi class MyModel(models.Model): age = models.IntegerField(db_default=18) created = models.DateTimeField(db_default=Now()) circumference = models.FloatField(db_default=2 * Pi()) Database generated model field ------------------------------ The new :class:`~django.db.models.GeneratedField` allows creation of database generated columns. This field can be used on all supported database backends to create a field that is always computed from other fields. For example:: from django.db import models from django.db.models import F class Square(models.Model): side = models.IntegerField() area = models.GeneratedField( expression=F("side") * F("side"), output_field=models.BigIntegerField(), db_persist=True, ) More options for declaring field choices ---------------------------------------- :attr:`.Field.choices` *(for model fields)* and :attr:`.ChoiceField.choices` *(for form fields)* allow for more flexibility when declaring their values. In previous versions of Django, ``choices`` should either be a list of 2-tuples, or an :ref:`field-choices-enum-types` subclass, but the latter required accessing the ``.choices`` attribute to provide the values in the expected form:: from django.db import models Medal = models.TextChoices("Medal", "GOLD SILVER BRONZE") SPORT_CHOICES = [ ("Martial Arts", [("judo", "Judo"), ("karate", "Karate")]), ("Racket", [("badminton", "Badminton"), ("tennis", "Tennis")]), ("unknown", "Unknown"), ] class Winner(models.Model): name = models.CharField(...) medal = models.CharField(..., choices=Medal.choices) sport = models.CharField(..., choices=SPORT_CHOICES) Django 5.0 adds support for accepting a mapping or a callable instead of an iterable, and also no longer requires ``.choices`` to be used directly to expand :ref:`enumeration types <field-choices-enum-types>`:: from django.db import models Medal = models.TextChoices("Medal", "GOLD SILVER BRONZE") SPORT_CHOICES = { Using a mapping instead of a list of 2-tuples. "Martial Arts": {"judo": "Judo", "karate": "Karate"}, "Racket": {"badminton": "Badminton", "tennis": "Tennis"}, "unknown": "Unknown", } def get_scores(): return [(i, str(i)) for i in range(10)] class Winner(models.Model): name = models.CharField(...) medal = models.CharField(..., choices=Medal) Using `.choices` not required. sport = models.CharField(..., choices=SPORT_CHOICES) score = models.IntegerField(choices=get_scores) A callable is allowed. Under the hood the provided ``choices`` are normalized into a list of 2-tuples as the canonical form whenever the ``choices`` value is updated. For more information, please check the :ref:`model field reference on choices <field-choices>`. Minor features -------------- :mod:`django.contrib.admin` ~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The new :meth:`.AdminSite.get_log_entries` method allows customizing the queryset for the site's listed log entries. * The ``django.contrib.admin.AllValuesFieldListFilter``, ``ChoicesFieldListFilter``, ``RelatedFieldListFilter``, and ``RelatedOnlyFieldListFilter`` admin filters now handle multi-valued query parameters. * ``XRegExp`` is upgraded from version 3.2.0 to 5.1.1. * The new :meth:`.AdminSite.get_model_admin` method returns an admin class for the given model class. * Properties in :attr:`.ModelAdmin.list_display` now support ``boolean`` attribute. * jQuery is upgraded from version 3.6.4 to 3.7.1. :mod:`django.contrib.auth` ~~~~~~~~~~~~~~~~~~~~~~~~~~ * The default iteration count for the PBKDF2 password hasher is increased from 600,000 to 720,000. * The new asynchronous functions are now provided, using an ``a`` prefix: :func:`django.contrib.auth.aauthenticate`, :func:`~.django.contrib.auth.aget_user`, :func:`~.django.contrib.auth.alogin`, :func:`~.django.contrib.auth.alogout`, and :func:`~.django.contrib.auth.aupdate_session_auth_hash`. * ``AuthenticationMiddleware`` now adds an :meth:`.HttpRequest.auser` asynchronous method that returns the currently logged-in user. * The new :func:`django.contrib.auth.hashers.acheck_password` asynchronous function and :meth:`.AbstractBaseUser.acheck_password` method allow asynchronous checking of user passwords. :mod:`django.contrib.contenttypes` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * :meth:`.QuerySet.prefetch_related` now supports prefetching :class:`~django.contrib.contenttypes.fields.GenericForeignKey` with non-homogeneous set of results. :mod:`django.contrib.gis` ~~~~~~~~~~~~~~~~~~~~~~~~~ * The new :class:`ClosestPoint() <django.contrib.gis.db.models.functions.ClosestPoint>` function returns a 2-dimensional point on the geometry that is closest to another geometry. * :ref:`GIS aggregates <gis-aggregation-functions>` now support the ``filter`` argument. * Support for GDAL 3.7 and GEOS 3.12 is added. * The new :meth:`.GEOSGeometry.equals_identical` method allows point-wise equivalence checking of geometries. :mod:`django.contrib.messages` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The new :meth:`.MessagesTestMixin.assertMessages` assertion method allows testing :mod:`~django.contrib.messages` added to a :class:`response <django.http.HttpResponse>`. :mod:`django.contrib.postgres` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * The new :attr:`~.ExclusionConstraint.violation_error_code` attribute of :class:`~django.contrib.postgres.constraints.ExclusionConstraint` allows customizing the ``code`` of ``ValidationError`` raised during :ref:`model validation <validating-objects>`. Asynchronous views ~~~~~~~~~~~~~~~~~~ * Under ASGI, ``http.disconnect`` events are now handled. This allows views to perform any necessary cleanup if a client disconnects before the response is generated. See :ref:`async-handling-disconnect` for more details. Decorators ~~~~~~~~~~ * The following decorators now support wrapping asynchronous view functions: * :func:`~django.views.decorators.cache.cache_control` * :func:`~django.views.decorators.cache.never_cache` * :func:`~django.views.decorators.common.no_append_slash` * :func:`~django.views.decorators.csrf.csrf_exempt` * :func:`~django.views.decorators.csrf.csrf_protect` * :func:`~django.views.decorators.csrf.ensure_csrf_cookie` * :func:`~django.views.decorators.csrf.requires_csrf_token` * :func:`~django.views.decorators.debug.sensitive_variables` * :func:`~django.views.decorators.debug.sensitive_post_parameters` * :func:`~django.views.decorators.gzip.gzip_page` * :func:`~django.views.decorators.http.condition` * ``conditional_page()`` * :func:`~django.views.decorators.http.etag` * :func:`~django.views.decorators.http.last_modified` * :func:`~django.views.decorators.http.require_http_methods` * :func:`~django.views.decorators.http.require_GET` * :func:`~django.views.decorators.http.require_POST` * :func:`~django.views.decorators.http.require_safe` * :func:`~django.views.decorators.vary.vary_on_cookie` * :func:`~django.views.decorators.vary.vary_on_headers` * ``xframe_options_deny()`` * ``xframe_options_sameorigin()`` * ``xframe_options_exempt()`` Error Reporting ~~~~~~~~~~~~~~~ * :func:`~django.views.decorators.debug.sensitive_variables` and :func:`~django.views.decorators.debug.sensitive_post_parameters` can now be used with asynchronous functions. File Storage ~~~~~~~~~~~~ * :meth:`.File.open` now passes all positional (``*args``) and keyword arguments (``**kwargs``) to Python's built-in :func:`python:open`. Forms ~~~~~ * The new :attr:`~django.forms.URLField.assume_scheme` argument for :class:`~django.forms.URLField` allows specifying a default URL scheme. * In order to improve accessibility, the following changes are made: * Form fields now include the ``aria-describedby`` HTML attribute to enable screen readers to associate form fields with their help text. * Invalid form fields now include the ``aria-invalid="true"`` HTML attribute. Internationalization ~~~~~~~~~~~~~~~~~~~~ * Support and translations for the Uyghur language are now available. Migrations ~~~~~~~~~~ * Serialization of functions decorated with :func:`functools.cache` or :func:`functools.lru_cache` is now supported without the need to write a custom serializer. Models ~~~~~~ * The new ``create_defaults`` argument of :meth:`.QuerySet.update_or_create` and :meth:`.QuerySet.aupdate_or_create` methods allows specifying a different field values for the create operation. * The new ``violation_error_code`` attribute of :class:`~django.db.models.BaseConstraint`, :class:`~django.db.models.CheckConstraint`, and :class:`~django.db.models.UniqueConstraint` allows customizing the ``code`` of ``ValidationError`` raised during :ref:`model validation <validating-objects>`. * The :ref:`force_insert <ref-models-force-insert>` argument of :meth:`.Model.save` now allows specifying a tuple of parent classes that must be forced to be inserted. * :meth:`.QuerySet.bulk_create` and :meth:`.QuerySet.abulk_create` methods now set the primary key on each model instance when the ``update_conflicts`` parameter is enabled (if the database supports it). * The new :attr:`.UniqueConstraint.nulls_distinct` attribute allows customizing the treatment of ``NULL`` values on PostgreSQL 15+. * The new :func:`~django.shortcuts.aget_object_or_404` and :func:`~django.shortcuts.aget_list_or_404` asynchronous shortcuts allow asynchronous getting objects. * The new :func:`~django.db.models.aprefetch_related_objects` function allows asynchronous prefetching of model instances. * :meth:`.QuerySet.aiterator` now supports previous calls to ``prefetch_related()``. * On MariaDB 10.7+, ``UUIDField`` is now created as ``UUID`` column rather than ``CHAR(32)`` column. See the migration guide above for more details on :ref:`migrating-uuidfield`. * Django now supports `oracledb`_ version 1.3.2 or higher. Support for ``cx_Oracle`` is deprecated as of this release and will be removed in Django 6.0. Pagination ~~~~~~~~~~ * The new :attr:`django.core.paginator.Paginator.error_messages` argument allows customizing the error messages raised by :meth:`.Paginator.page`. Signals ~~~~~~~ * The new :meth:`.Signal.asend` and :meth:`.Signal.asend_robust` methods allow asynchronous signal dispatch. Signal receivers may be synchronous or asynchronous, and will be automatically adapted to the correct calling style. Templates ~~~~~~~~~ * The new :tfilter:`escapeseq` template filter applies :tfilter:`escape` to each element of a sequence. Tests ~~~~~ * :class:`~django.test.Client` and :class:`~django.test.AsyncClient` now provide asynchronous methods, using an ``a`` prefix: :meth:`~django.test.Client.asession`, :meth:`~django.test.Client.alogin`, :meth:`~django.test.Client.aforce_login`, and :meth:`~django.test.Client.alogout`. * :class:`~django.test.AsyncClient` now supports the ``follow`` parameter. * :class:`~django.test.runner.DiscoverRunner` now allows showing the duration of the slowest tests using the :option:`test --durations` option (available on Python 3.12+). Validators ~~~~~~~~~~ * The new ``offset`` argument of :class:`~django.core.validators.StepValueValidator` allows specifying an offset for valid values. .. _backwards-incompatible-5.0: Backwards incompatible changes in 5.0 ===================================== Database backend API -------------------- This section describes changes that may be needed in third-party database backends. * ``DatabaseFeatures.supports_expression_defaults`` should be set to ``False`` if the database doesn't support using database functions as defaults. * ``DatabaseFeatures.supports_default_keyword_in_insert`` should be set to ``False`` if the database doesn't support the ``DEFAULT`` keyword in ``INSERT`` queries. * ``DatabaseFeatures.supports_default_keyword_in_bulk_insert`` should be set to ``False`` if the database doesn't support the ``DEFAULT`` keyword in bulk ``INSERT`` queries. :mod:`django.contrib.gis` ------------------------- * Support for GDAL 2.2 and 2.3 is removed. * Support for GEOS 3.6 and 3.7 is removed. :mod:`django.contrib.sitemaps` ------------------------------ * The ``django.contrib.sitemaps.ping_google()`` function and the ``ping_google`` management command are removed as the Google Sitemaps ping endpoint is deprecated and will be removed in January 2024. * The ``django.contrib.sitemaps.SitemapNotFound`` exception class is removed. Dropped support for MySQL < 8.0.11 ---------------------------------- Support for pre-releases of MySQL 8.0.x series is removed. Django 5.0 supports MySQL 8.0.11 and higher. Using ``create_defaults__exact`` may now be required with ``QuerySet.update_or_create()`` ----------------------------------------------------------------------------------------- :meth:`.QuerySet.update_or_create` now supports the parameter ``create_defaults``. As a consequence, any models that have a field named ``create_defaults`` that are used with an ``update_or_create()`` should specify the field in the lookup with ``create_defaults__exact``. .. _migrating-uuidfield: Migrating existing ``UUIDField`` on MariaDB 10.7+ ------------------------------------------------- On MariaDB 10.7+, ``UUIDField`` is now created as ``UUID`` column rather than ``CHAR(32)`` column. As a consequence, any ``UUIDField`` created in Django < 5.0 should be replaced with a ``UUIDField`` subclass backed by ``CHAR(32)``:: class Char32UUIDField(models.UUIDField): def db_type(self, connection): return "char(32)" def get_db_prep_value(self, value, connection, prepared=False): value = super().get_db_prep_value(value, connection, prepared) if value is not None: value = value.hex return value For example:: class MyModel(models.Model): uuid = models.UUIDField(primary_key=True, default=uuid.uuid4) Should become:: class Char32UUIDField(models.UUIDField): ... class MyModel(models.Model): uuid = Char32UUIDField(primary_key=True, default=uuid.uuid4) Running the :djadmin:`makemigrations` command will generate a migration containing a no-op ``AlterField`` operation. Miscellaneous ------------- * The ``instance`` argument of the undocumented ``BaseModelFormSet.save_existing()`` method is renamed to ``obj``. * The undocumented ``django.contrib.admin.helpers.checkbox`` is removed. * Integer fields are now validated as 64-bit integers on SQLite to match the behavior of ``sqlite3``. * The undocumented ``Query.annotation_select_mask`` attribute is changed from a set of strings to an ordered list of strings. * ``ImageField.update_dimension_fields()`` is no longer called on the ``post_init`` signal if ``width_field`` and ``height_field`` are not set. * :class:`~django.db.models.functions.Now` database function now uses ``LOCALTIMESTAMP`` instead of ``CURRENT_TIMESTAMP`` on Oracle. * :attr:`.AdminSite.site_header` is now rendered in a ``<div>`` tag instead of ``<h1>``. Screen reader users rely on heading elements for navigation within a page. Having two ``<h1>`` elements was confusing and the site header wasn't helpful as it is repeated on all pages. * In order to improve accessibility, the admin's main content area and header content area are now rendered in a ``<main>`` and ``<header>`` tag instead of ``<div>``. * On databases without native support for the SQL ``XOR`` operator, ``^`` as the exclusive or (``XOR``) operator now returns rows that are matched by an odd number of operands rather than exactly one operand. This is consistent with the behavior of MySQL, MariaDB, and Python. * The minimum supported version of ``asgiref`` is increased from 3.6.0 to 3.7.0. * The minimum supported version of ``selenium`` is increased from 3.8.0 to 4.8.0. * The ``AlreadyRegistered`` and ``NotRegistered`` exceptions are moved from ``django.contrib.admin.sites`` to ``django.contrib.admin.exceptions``. * The minimum supported version of SQLite is increased from 3.21.0 to 3.27.0. * Support for ``cx_Oracle`` < 8.3 is removed. * Executing SQL queries before the app registry has been fully populated now raises :exc:`RuntimeWarning`. * :exc:`~django.core.exceptions.BadRequest` is raised for non-UTF-8 encoded requests with the :mimetype:`application/x-www-form-urlencoded` content type. See :rfc:`1866` for more details. * The minimum supported version of ``colorama`` is increased to 0.4.6. * The minimum supported version of ``docutils`` is increased to 0.19. * Filtering querysets against overflowing integer values now always returns an empty queryset. As a consequence, you may need to use ``ExpressionWrapper()`` to :ref:`explicitly wrap <using-f-with-annotations>` arithmetic against integer fields in such cases. .. _deprecated-features-5.0: Features deprecated in 5.0 ========================== Miscellaneous ------------- * The ``DjangoDivFormRenderer`` and ``Jinja2DivFormRenderer`` transitional form renderers are deprecated. * Passing positional arguments ``name`` and ``violation_error_message`` to :class:`~django.db.models.BaseConstraint` is deprecated in favor of keyword-only arguments. * ``request`` is added to the signature of :meth:`.ModelAdmin.lookup_allowed`. Support for ``ModelAdmin`` subclasses that do not accept this argument is deprecated. * The ``get_joining_columns()`` method of ``ForeignObject`` and ``ForeignObjectRel`` is deprecated. Starting with Django 6.0, ``django.db.models.sql.datastructures.Join`` will no longer fallback to ``get_joining_columns()``. Subclasses should implement ``get_joining_fields()`` instead. * The ``ForeignObject.get_reverse_joining_columns()`` method is deprecated. * The default scheme for ``forms.URLField`` will change from ``"http"`` to ``"https"`` in Django 6.0. Set :setting:`FORMS_URLFIELD_ASSUME_HTTPS` transitional setting to ``True`` to opt into assuming ``"https"`` during the Django 5.x release cycle. * ``FORMS_URLFIELD_ASSUME_HTTPS`` transitional setting is deprecated. * Support for calling ``format_html()`` without passing args or kwargs will be removed. * Support for ``cx_Oracle`` is deprecated in favor of `oracledb`_ 1.3.2+ Python driver. * ``DatabaseOperations.field_cast_sql()`` is deprecated in favor of ``DatabaseOperations.lookup_cast()``. Starting with Django 6.0, ``BuiltinLookup.process_lhs()`` will no longer call ``field_cast_sql()``. Third-party database backends should implement ``lookup_cast()`` instead. * The ``django.db.models.enums.ChoicesMeta`` metaclass is renamed to ``ChoicesType``. * The ``Prefetch.get_current_queryset()`` method is deprecated. * The ``get_prefetch_queryset()`` method of related managers and descriptors is deprecated. Starting with Django 6.0, ``get_prefetcher()`` and ``prefetch_related_objects()`` will no longer fallback to ``get_prefetch_queryset()``. Subclasses should implement ``get_prefetch_querysets()`` instead. .. _`oracledb`: https://oracle.github.io/python-oracledb/ Features removed in 5.0 ======================= These features have reached the end of their deprecation cycle and are removed in Django 5.0. See :ref:`deprecated-features-4.0` for details on these changes, includin