Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Scheduled weekly dependency update for week 39 #346

Closed
wants to merge 19 commits into from

Conversation

pyup-bot
Copy link
Collaborator

Update attrs from 23.1.0 to 24.2.0.

The bot wasn't able to find a changelog for this release. Got an idea?

Links

Update cattrs from 23.2.3 to 24.1.2.

Changelog

24.1.2

- Fix {meth}`BaseConverter.register_structure_hook` and {meth}`BaseConverter.register_unstructure_hook` type hints.
([581](https://github.com/python-attrs/cattrs/issues/581) [#582](https://github.com/python-attrs/cattrs/pull/582))

24.1.1

- Fix {meth}`BaseConverter.register_structure_hook_factory` and {meth}`BaseConverter.register_unstructure_hook_factory` type hints.
([578](https://github.com/python-attrs/cattrs/issues/578) [#579](https://github.com/python-attrs/cattrs/pull/579))

24.1.0

- **Potentially breaking**: Unstructuring hooks for `typing.Any` are consistent now: values are unstructured using their runtime type.
Previously this behavior was underspecified and inconsistent, but followed this rule in the majority of cases.
Reverting old behavior is very dependent on the actual case; ask on the issue tracker if in doubt.
([473](https://github.com/python-attrs/cattrs/pull/473))
- **Minor change**: Heterogeneous tuples are now unstructured into tuples instead of lists by default; this is significantly faster and widely supported by serialization libraries.
([486](https://github.com/python-attrs/cattrs/pull/486))
- **Minor change**: {py:func}`cattrs.gen.make_dict_structure_fn` will use the value for the `prefer_attrib_converters` parameter from the given converter by default now.
If you're using this function directly, the old behavior can be restored by passing in the desired values explicitly.
([527](https://github.com/python-attrs/cattrs/issues/527) [#528](https://github.com/python-attrs/cattrs/pull/528))
- Introduce {meth}`BaseConverter.get_structure_hook` and {meth}`BaseConverter.get_unstructure_hook` methods.
([432](https://github.com/python-attrs/cattrs/issues/432) [#472](https://github.com/python-attrs/cattrs/pull/472))
- {meth}`BaseConverter.register_structure_hook`, {meth}`BaseConverter.register_unstructure_hook`,
{meth}`BaseConverter.register_unstructure_hook_factory` and {meth}`BaseConverter.register_structure_hook_factory`
can now be used as decorators and have gained new features.
See [here](https://catt.rs/en/latest/customizing.html#use-as-decorators) and [here](https://catt.rs/en/latest/customizing.html#id1) for more details.
([487](https://github.com/python-attrs/cattrs/pull/487))
- Introduce and [document](https://catt.rs/en/latest/customizing.html#customizing-collections) the {mod}`cattrs.cols` module for better collection customizations.
([504](https://github.com/python-attrs/cattrs/issues/504) [#540](https://github.com/python-attrs/cattrs/pull/540))
- Enhance the {func}`cattrs.cols.is_mapping` predicate function to also cover virtual subclasses of `abc.Mapping`.
This enables map classes from libraries such as _immutables_ or _sortedcontainers_ to structure out-of-the-box.
([555](https://github.com/python-attrs/cattrs/issues/555) [#556](https://github.com/python-attrs/cattrs/pull/556))
- Introduce the [_msgspec_](https://jcristharif.com/msgspec/) {mod}`preconf converter <cattrs.preconf.msgspec>`.
Only JSON is supported for now, with other formats supported by _msgspec_ to come later.
([481](https://github.com/python-attrs/cattrs/pull/481))
- The default union handler now properly takes renamed fields into account.
([472](https://github.com/python-attrs/cattrs/pull/472))
- The default union handler now also handles dataclasses.
([426](https://github.com/python-attrs/cattrs/issues/426) [#477](https://github.com/python-attrs/cattrs/pull/477))
- Add support for [PEP 695](https://peps.python.org/pep-0695/) type aliases.
([452](https://github.com/python-attrs/cattrs/pull/452))
- Add support for [PEP 696](https://peps.python.org/pep-0696/) `TypeVar`s with defaults.
([512](https://github.com/python-attrs/cattrs/pull/512))
- Add support for named tuples with type metadata ([`typing.NamedTuple`](https://docs.python.org/3/library/typing.html#typing.NamedTuple)).
([425](https://github.com/python-attrs/cattrs/issues/425) [#491](https://github.com/python-attrs/cattrs/pull/491))
- Add support for optionally un/unstructuring named tuples using dictionaries.
([425](https://github.com/python-attrs/cattrs/issues/425) [#549](https://github.com/python-attrs/cattrs/pull/549))
- The `include_subclasses` strategy now fetches the member hooks from the converter (making use of converter defaults) if overrides are not provided, instead of generating new hooks with no overrides.
([429](https://github.com/python-attrs/cattrs/issues/429) [#472](https://github.com/python-attrs/cattrs/pull/472))
- The preconf `make_converter` factories are now correctly typed.
([481](https://github.com/python-attrs/cattrs/pull/481))
- The {class}`orjson preconf converter <cattrs.preconf.orjson.OrjsonConverter>` now passes through dates and datetimes to orjson while unstructuring, greatly improving speed.
([463](https://github.com/python-attrs/cattrs/pull/463))
- {mod}`cattrs.gen` generators now attach metadata to the generated functions, making them introspectable.
([472](https://github.com/python-attrs/cattrs/pull/472))
- Structure hook factories in {mod}`cattrs.gen` now handle recursive classes better.
([540](https://github.com/python-attrs/cattrs/pull/540))
- The [tagged union strategy](https://catt.rs/en/stable/strategies.html#tagged-unions-strategy) now leaves the tags in the payload unless `forbid_extra_keys` is set.
([533](https://github.com/python-attrs/cattrs/issues/533) [#534](https://github.com/python-attrs/cattrs/pull/534))
- More robust support for `Annotated` and `NotRequired` in TypedDicts.
([450](https://github.com/python-attrs/cattrs/pull/450))
- `typing_extensions.Literal` is now automatically structured, just like `typing.Literal`.
([460](https://github.com/python-attrs/cattrs/issues/460) [#467](https://github.com/python-attrs/cattrs/pull/467))
- `typing_extensions.Any` is now supported and handled like `typing.Any`.
([488](https://github.com/python-attrs/cattrs/issues/488) [#490](https://github.com/python-attrs/cattrs/pull/490))
- `Optional` types can now be consistently customized using `register_structure_hook` and `register_unstructure_hook`.
([529](https://github.com/python-attrs/cattrs/issues/529) [#530](https://github.com/python-attrs/cattrs/pull/530))
- The BaseConverter now properly generates detailed validation errors for mappings.
([496](https://github.com/python-attrs/cattrs/pull/496))
- [PEP 695](https://peps.python.org/pep-0695/) generics are now tested.
([452](https://github.com/python-attrs/cattrs/pull/452))
- Imports are now sorted using Ruff.
- Tests are run with the pytest-xdist plugin by default.
- Rework the introductory parts of the documentation, introducing the Basics section.
([472](https://github.com/python-attrs/cattrs/pull/472))
- The documentation has been significantly reworked.
([473](https://github.com/python-attrs/cattrs/pull/473))
- The docs now use the Inter font.
- Make type annotations for `include_subclasses` and `tagged_union` strategies more lenient.
([431](https://github.com/python-attrs/cattrs/pull/431))
Links

Update fonttools[ufo] from 4.46.0 to 4.54.1.

Changelog

4.54.1

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

- [unicodedata] Update to Unicode 16
- [subset] Escape ``\\`` in doc string

4.54.0

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

- [Docs] Small docs cleanups by n8willis (3611)
- [Docs] cleanup code blocks by n8willis (3627)
- [Docs] fix Sphinx builds by n8willis (3625)
- [merge] Minor fixes to documentation for merge by drj11 (3588)
- [subset] Small tweaks to pyftsubset documentation by RoelN (3633)
- [Tests] Do not require fonttools command to be available by behdad (3612)
- [Tests] subset_test: add failing test to reproduce issue 3616 by anthrotype (3622)
- [ttLib] NameRecordVisitor: include whole sequence of character variants' UI labels, not just the first by anthrotype (3617)
- [varLib.avar] Reconstruct mappings from binary by behdad (3598)
- [varLib.instancer] Fix visual artefacts with partial L2 instancing by Hoolean (3635)
- [varLib.interpolatable] Support discrete axes in .designspace by behdad (3599)
- [varLib.models] By default, assume OpenType-like normalized space by behdad (3601)

4.53.1

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

- [feaLib] Improve the sharing of inline chained lookups (3559)
- [otlLib] Correct the calculation of OS/2.usMaxContext with reversed chaining contextual single substitutions (3569)
- [misc.visitor] Visitors search the inheritance chain of objects they are visiting (3581)

4.53.0

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

- [ttLib.removeOverlaps] Support CFF table to aid in downconverting CFF2 fonts (3528)
- [avar] Fix crash when accessing not-yet-existing attribute (3550)
- [docs] Add buildMathTable to otlLib.builder documentation (3540)
- [feaLib] Allow UTF-8 with BOM when reading features (3495)
- [SVGPathPen] Revert rounding coordinates to two decimal places by default (3543)
- [varLib.instancer] Refix output filename decision-making  (3545, 3544, 3548)

4.52.4

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

- [varLib.cff] Restore and deprecate convertCFFtoCFF2 that was removed in 4.52.0
release as it is used by downstream projects (3535).

4.52.3

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

- Fixed a small syntax error in the reStructuredText-formatted NEWS.rst file
which caused the upload to PyPI to fail for 4.52.2. No other code changes.

4.52.2

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

- [varLib.interpolatable] Ensure that scipy/numpy output is JSON-serializable
(3522, 3526).
- [housekeeping] Regenerate table lists, to fix pyinstaller packaging of the new
``VARC`` table (3531, 3529).
- [cffLib] Make CFFToCFF2 and CFF2ToCFF more robust (3521, 3525).

4.52.1

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

- Fixed a small syntax error in the reStructuredText-formatted NEWS.rst file
which caused the upload to PyPI to fail for 4.52.0. No other code changes.

4.52.0

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

- Added support for the new ``VARC`` (Variable Composite) table that is being
proposed to OpenType spec (3395). For more info:
https://github.com/harfbuzz/boring-expansion-spec/blob/main/VARC.md
- [ttLib.__main__] Fixed decompiling all tables (90fed08).
- [feaLib] Don't reference the same lookup index multiple times within the same
feature record, it is only applied once anyway (3520).
- [cffLib] Moved methods to desubroutinize, remove hints and unused subroutines
from subset module to cffLib (3517).
- [varLib.instancer] Added support for partial-instancing CFF2 tables! Also, added
method to down-convert from CFF2 to CFF 1.0, and CLI entry points to convert
CFF<->CFF2 (3506).
- [subset] Prune unused user name IDs even with --name-IDs='*' (3410).
- [ttx] use GNU-style getopt to intermix options and positional arguments (3509).
- [feaLib.variableScalar] Fixed ``value_at_location()`` method (3491)
- [psCharStrings] Shorten output of ``encodeFloat`` (3492).
- [bezierTools] Fix infinite-recursion in ``calcCubicArcLength`` (3502).
- [avar2] Implement ``avar2`` support in ``TTFont.getGlyphSet()`` (3473).

4.51.0

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

- [ttLib] Optimization on loading aux fields (3464).
- [ttFont] Add reorderGlyphs (3468).

4.50.0

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

- [pens] Added decomposing filter pens that draw components as regular contours (3460).
- [instancer] Drop explicit no-op axes from TupleVariations (3457).
- [cu2qu/ufo] Return set of modified glyph names from fonts_to_quadratic (3456).

4.49.0

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

- [otlLib] Add API for building ``MATH`` table (3446)

4.48.1

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

- Fixed uploading wheels to PyPI, no code changes since v4.48.0.

4.48.0

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

- [varLib] Do not log when there are no OTL tables to be merged.
- [setup.py] Do not restrict lxml<5 any more, tests pass just fine with lxml>=5.
- [feaLib] Remove glyph and class names length restrictions in FEA (3424).
- [roundingPens] Added ``transformRoundFunc`` parameter to the rounding pens to allow
for custom rounding of the components' transforms (3426).
- [feaLib] Keep declaration order of ligature components within a ligature set, instead
of sorting by glyph name (3429).
- [feaLib] Fixed ordering of alternates in ``aalt`` lookups, following the declaration
order of feature references within the ``aalt`` feature block (3430).
- [varLib.instancer] Fixed a bug in the instancer's IUP optimization (3432).
- [sbix] Support sbix glyphs with new graphicType "flip" (3433).
- [svgPathPen] Added ``--glyphs`` option to dump the SVG paths for the named glyphs
in the font (0572f78).
- [designspaceLib] Added "description" attribute to ``<mappings>`` and ``<mapping>``
elements, and allow multiple ``<mappings>`` elements to group ``<mapping>`` elements
that are logically related (3435, 3437).
- [otlLib] Correctly choose the most compact GSUB contextual lookup format (3439).

4.47.2

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

Minor release to fix uploading wheels to PyPI.

4.47.1

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

- [merge] Improve help message and add standard command line options (3408)
- [otlLib] Pass ``ttFont`` to ``name.addName`` in ``buildStatTable`` (3406)
- [featureVars] Re-use ``FeatureVariationRecord``'s when possible (3413)

4.47.0

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

- [varLib.models] New API for VariationModel: ``getMasterScalars`` and
``interpolateFromValuesAndScalars``.
- [varLib.interpolatable] Various bugfixes and rendering improvements. In particular,
add a Summary page in the front, and an Index and Table-of-Contents in the back.
Change the page size to Letter.
- [Docs/designspaceLib] Defined a new ``public.fontInfo`` lib key, not used anywhere yet (3358).
Links

Update lxml from 4.9.3 to 5.3.0.

Changelog

5.3.0

==================

Features added
--------------

* GH421: Nested ``CDATA`` sections are no longer rejected but split on output
to represent ``]]>`` correctly.
Patch by Gertjan Klein.

Bugs fixed
----------

* LP2060160: Attribute values serialised differently in ``xmlfile.element()`` and ``xmlfile.write()``.

* LP2058177: The ISO-Schematron implementation could fail on unknown prefixes.
Patch by David Lakin.

Other changes
-------------

* LP2067707: The ``strip_cdata`` option in ``HTMLParser()`` turned out to be useless and is now deprecated.

* Binary wheels use the library versions libxml2 2.12.9 and libxslt 1.1.42.

* Windows binary wheels use the library versions libxml2 2.11.8 and libxslt 1.1.39.

* Built with Cython 3.0.11.

5.2.2

==================

Bugs fixed
----------

* GH417: The ``test_feed_parser`` test could fail if ``lxml_html_clean`` was not installed.
It is now skipped in that case.

* LP2059910: The minimum CPU architecture for the Linux x86 binary wheels was set back to
"core2", without SSE 4.2.

* If libxml2 uses iconv, the compile time version is available as `etree.ICONV_COMPILED_VERSION`.

5.2.1

==================

Bugs fixed
----------

* LP2059910: The minimum CPU architecture for the Linux x86 binary wheels was set back to
"core2", but with SSE 4.2 enabled.

* LP2059977: ``Element.iterfind("//absolute_path")`` failed with a ``SyntaxError``
where it should have issued a warning.

* GH416: The documentation build was using the non-standard ``which`` command.
Patch by Michał Górny.

5.2.0

==================

Other changes
-------------

* LP1958539: The ``lxml.html.clean`` implementation suffered from several (only if used)
security issues in the past and was now extracted into a separate library:

https://github.com/fedora-python/lxml_html_clean

Projects that use lxml without "lxml.html.clean" will not notice any difference,
except that they won't have potentially vulnerable code installed.
The module is available as an "extra" setuptools dependency "lxml[html_clean]",
so that Projects that need "lxml.html.clean" will need to switch their requirements
from "lxml" to "lxml[html_clean]", or install the new library themselves.

* The minimum CPU architecture for the Linux x86 binary wheels was upgraded to
"sandybridge" (launched 2011), and glibc 2.28 / gcc 12 (manylinux_2_28) wheels were added.

* Built with Cython 3.0.10.

5.1.2

==================

Bugs fixed
----------

* LP2059977: ``Element.iterfind("//absolute_path")`` failed with a ``SyntaxError``
where it should have issued a warning.

5.1.1

==================

Bugs fixed
----------

* LP2048920: ``iterlinks()`` in ``lxml.html`` rejected ``bytes`` input in 5.1.0.

* High source line numbers from the parser are no longer truncated
(up to a C ``long``) when using libxml2 2.11 or later.

Other changes
-------------

* GH407: A compatibility test was adapted to recent expat versions.
Patch by Miro Hrončok.

* Binary wheels use the library versions libxml2 2.12.6 and libxslt 1.1.39.

* Windows binary wheels use the library versions libxml2 2.11.7 and libxslt 1.1.39.

* Built with Cython 3.0.9.

5.1.0

==================

Features added
--------------

* Parsing ASCII strings is slightly faster.

Bugs fixed
----------

* GH349: The HTML ``Cleaner()`` interpreted an accidentally provided string parameter
for the ``host_whitelist`` as list of characters and silently failed to reject any hosts.
Passing a non-collection is now rejected.

Other changes
-------------

* Support for Python 2.7 and Python versions < 3.6 was removed.

* The wheel build was migrated to use ``cibuildwheel``.
Patch by Primož Godec.

5.0.2

==================

Other changes
-------------

* GH407: A compatibility test was adapted to recent expat versions.
Patch by Miro Hrončok.

* Binary wheels use the library versions libxml2 2.12.6 and libxslt 1.1.39.

* Built with Cython 3.0.9.

5.0.1

==================

Bugs fixed
----------

* LP2046208: Parsing non-BMP Python Unicode strings could fail on macOS.

* LP2044225: When incrementally parsing broken HTML, reporting start events on
missing structural tags failed and could lead to subsequent exceptions.

* LP2045435: Some (not all) issues with stricter C compilers were resolved.

* The binary wheels in the 5.0.0 release did not validate cleanly (but installed ok).


.. _latest_release:

5.0.0

==================

Features added
--------------

* Character escaping in ``C14N2`` serialisation now uses a single pass over the text
instead of searching for each unescaped character separately.

* Early support for Python 3.13a2 was added.

Bugs fixed
----------

* LP1976304: The ``Element.addnext()`` method previously inserted the new element
before existing tail text.  The tail text of both sibling elements now stays on
the respective elements.

* LP1980767, GH379: ``TreeBuilder.close()`` could fail with a ``TypeError`` after
parsing incorrect input.  Original patch by Enrico Minack.

* ``Element.itertext(with_tail=False)`` returned the tail text of comments and
processing instructions, despite the explicit option.

* GH370: A crash with recent libxml2 2.11.x versions was resolved.
Patch by Michael Schlenker.

* A compile problem with recent libxml2 2.12.x versions was resolved.

* The internal exception handling in C callbacks was improved for Cython 3.0.

* The exception declarations of ``xmlInputReadCallback``, ``xmlInputCloseCallback``,
``xmlOutputWriteCallback`` and ``xmlOutputCloseCallback`` in ``tree.pxd`` were
corrected to prevent running Python code or calling into the C-API with a live
exception set.

* GH385: The long deprecated ``unittest.m̀akeSuite()`` function is no longer used.
Patch by Miro Hrončok.

* LP1522052: A file-system specific test is now optional and should no longer fail
on systems that don't support it.

* GH392: Some tests were adapted for libxml2 2.13.
Patch by Nick Wellnhofer.

* Contains all fixes from lxml 4.9.4.

Other changes
-------------

* LP1742885: lxml no longer expands external entities (XXE) by default to prevent
the security risk of loading arbitrary files and URLs.  If this feature is needed,
it can be enabled in a backwards compatible way by using a parser with the option
``resolve_entities=True``.  The new default is ``resolve_entities='internal'``.

* With libxml2 2.10.4 and later (as provided by the lxml 5.0 binary wheels),
parsing HTML tags with "prefixes" no longer builds a namespace dictionary
in ``nsmap`` but considers the ``prefix:name`` string the actual tag name.
With older libxml2 versions, since 2.9.11, the prefix was removed.  Before
that, the prefix was parsed as XML prefix.

lxml 5.0 does not try to hide this difference but now changes the ElementPath
implementation to let ``element.find("part1:part2")`` search for the tag
``part1:part2`` in documents parsed as HTML, instead of looking only for ``part2``.

* LP2024343: The validation of the schema file itself is now optional in the
ISO-Schematron implementation.  This was done because some lxml distributions
discard the RNG validation schema file due to licensing issues.  The validation
can now always be disabled with ``Schematron(..., validate_schema=False)``.
It is enabled by default if available and disabled otherwise.  The module
constant ``lxml.isoschematron.schematron_schema_valid_supported`` can be used
to detect whether schema file validation is available.

* Some redundant and long deprecated methods were removed:
``parser.setElementClassLookup()``,
``xslt_transform.apply()``,
``xpath.evaluate()``.

* Some incorrect declarations were removed from ``python.pxd``. In general, this file
should not be used by external Cython code. Use the C-API declarations provided by
Cython itself instead.

* Binary wheels use the library versions libxml2 2.12.3 and libxslt 1.1.39.

* Built with Cython 3.0.7, updated to follow recent changes in Cython 3.1-dev.

4.9.4

==================

Bugs fixed
----------

* LP2046398: Inserting/replacing an ancestor into a node's children could loop indefinitely.

* LP1980767, GH379: ``TreeBuilder.close()`` could fail with a ``TypeError`` after
parsing incorrect input.  Original patch by Enrico Minack.

* LP1522052: A file-system specific test is now optional and should no longer fail
on systems that don't support it.

Other changes
-------------

* Wheels include zlib 1.3, libxml2 2.10.3 and libxslt 1.1.39
(zlib 1.2.12, libxml2 2.10.3 and libxslt 1.1.37 on Windows).

* Built with Cython 0.29.37.
Links

Update msgpack from 1.0.7 to 1.1.0.

Changelog

1.1.0

=====

Release Date: 2024-09-10

* use ``PyLong_*`` instead of ``PyInt_*`` for compatibility with
future Cython. (620)

1.1.0rc2

========

Release Date: 2024-08-19

* Update Cython to 3.0.11 for better Python 3.13 support.
* Update cibuildwheel to 2.20.0 to build Python 3.13 wheels.

1.1.0rc1

========

Release Date: 2024-05-07

* Update Cython to 3.0.10 to reduce C warnings and future support for Python 3.13.
* Stop using C++ mode in Cython to reduce compile error on some compilers.
* ``Packer()`` has ``buf_size`` option to specify initial size of
internal buffer to reduce reallocation.
* The default internal buffer size of ``Packer()`` is reduced from
1MiB to 256KiB to optimize for common use cases. Use ``buf_size``
if you are packing large data.
* ``Timestamp.to_datetime()`` and ``Timestamp.from_datetime()`` become
more accurate by avoiding floating point calculations. (591)
* The Cython code for ``Unpacker`` has been slightly rewritten for maintainability.
* The fallback implementation of ``Packer()`` and ``Unpacker()`` now uses keyword-only
arguments to improve compatibility with the Cython implementation.

1.0.8

=====

Release Date: 2024-03-01

* Update Cython to 3.0.8. This fixes memory leak when iterating
``Unpacker`` object on Python 3.12.
* Do not include C/Cython files in binary wheels.
Links

Update orjson from 3.9.15 to 3.10.7.

Changelog

3.10.7

Changed

- Improve performance of stable Rust amd64 builds.

3.10.6

Changed

- Improve performance.

3.10.5

Changed

- Improve performance.

3.10.4

Changed

- Improve performance.

3.10.3

Changed

- `manylinux` amd64 builds include runtime-detected AVX-512 `str`
implementation.
- Tests now compatible with numpy v2.

3.10.2

Fixed

- Fix crash serializing `str` introduced in 3.10.1.

Changed

- Improve performance.
- Drop support for arm7.

3.10.1

Fixed

- Serializing `numpy.ndarray` with non-native endianness raises
`orjson.JSONEncodeError`.

Changed

- Improve performance of serializing.

3.10.0

Changed

- Support serializing `numpy.float16` (`numpy.half`).
- sdist uses metadata 2.3 instead of 2.1.
- Improve Windows PyPI builds.
Links

Update black from 23.11.0 to 24.8.0.

Changelog

24.8.0

Stable style

- Fix crash when ` fmt: off` is used before a closing parenthesis or bracket. (4363)

Packaging

- Packaging metadata updated: docs are explictly linked, the issue tracker is now also
linked. This improves the PyPI listing for Black. (4345)

Parser

- Fix regression where Black failed to parse a multiline f-string containing another
multiline string (4339)
- Fix regression where Black failed to parse an escaped single quote inside an f-string
(4401)
- Fix bug with Black incorrectly parsing empty lines with a backslash (4343)
- Fix bugs with Black's tokenizer not handling `\{` inside f-strings very well (4422)
- Fix incorrect line numbers in the tokenizer for certain tokens within f-strings
(4423)

Performance

- Improve performance when a large directory is listed in `.gitignore` (4415)

_Blackd_

- Fix blackd (and all extras installs) for docker container (4357)

24.4.2

This is a bugfix release to fix two regressions in the new f-string parser introduced in
24.4.1.

Parser

- Fix regression where certain complex f-strings failed to parse (4332)

Performance

- Fix bad performance on certain complex string literals (4331)

24.4.1

Highlights

- Add support for the new Python 3.12 f-string syntax introduced by PEP 701 (3822)

Stable style

- Fix crash involving indented dummy functions containing newlines (4318)

Parser

- Add support for type parameter defaults, a new syntactic feature added to Python 3.13
by PEP 696 (4327)

Integrations

- Github Action now works even when `git archive` is skipped (4313)

24.4.0

Stable style

- Fix unwanted crashes caused by AST equivalency check (4290)

Preview style

- `if` guards in `case` blocks are now wrapped in parentheses when the line is too long.
(4269)
- Stop moving multiline strings to a new line unless inside brackets (4289)

Integrations

- Add a new option `use_pyproject` to the GitHub Action `psf/black`. This will read the
Black version from `pyproject.toml`. (4294)

24.3.0

Highlights

This release is a milestone: it fixes Black's first CVE security vulnerability. If you
run Black on untrusted input, or if you habitually put thousands of leading tab
characters in your docstrings, you are strongly encouraged to upgrade immediately to fix
[CVE-2024-21503](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-21503).

This release also fixes a bug in Black's AST safety check that allowed Black to make
incorrect changes to certain f-strings that are valid in Python 3.12 and higher.

Stable style

- Don't move comments along with delimiters, which could cause crashes (4248)
- Strengthen AST safety check to catch more unsafe changes to strings. Previous versions
of Black would incorrectly format the contents of certain unusual f-strings containing
nested strings with the same quote type. Now, Black will crash on such strings until
support for the new f-string syntax is implemented. (4270)
- Fix a bug where line-ranges exceeding the last code line would not work as expected
(4273)

Performance

- Fix catastrophic performance on docstrings that contain large numbers of leading tab
characters. This fixes
[CVE-2024-21503](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2024-21503).
(4278)

Documentation

- Note what happens when `--check` is used with `--quiet` (4236)

24.2.0

Stable style

- Fixed a bug where comments where mistakenly removed along with redundant parentheses
(4218)

Preview style

- Move the `hug_parens_with_braces_and_square_brackets` feature to the unstable style
due to an outstanding crash and proposed formatting tweaks (4198)
- Fixed a bug where base expressions caused inconsistent formatting of \*\* in tenary
expression (4154)
- Checking for newline before adding one on docstring that is almost at the line limit
(4185)
- Remove redundant parentheses in `case` statement `if` guards (4214).

Configuration

- Fix issue where _Black_ would ignore input files in the presence of symlinks (4222)
- _Black_ now ignores `pyproject.toml` that is missing a `tool.black` section when
discovering project root and configuration. Since _Black_ continues to use version
control as an indicator of project root, this is expected to primarily change behavior
for users in a monorepo setup (desirably). If you wish to preserve previous behavior,
simply add an empty `[tool.black]` to the previously discovered `pyproject.toml`
(4204)

Output

- Black will swallow any `SyntaxWarning`s or `DeprecationWarning`s produced by the `ast`
module when performing equivalence checks (4189)

Integrations

- Add a JSONSchema and provide a validate-pyproject entry-point (4181)

24.1.1

Bugfix release to fix a bug that made Black unusable on certain file systems with strict
limits on path length.

Preview style

- Consistently add trailing comma on typed parameters (4164)

Configuration

- Shorten the length of the name of the cache file to fix crashes on file systems that
do not support long paths (4176)

24.1.0

Highlights

This release introduces the new 2024 stable style (4106), stabilizing the following
changes:

- Add parentheses around `if`-`else` expressions (2278)
- Dummy class and function implementations consisting only of `...` are formatted more
compactly (3796)
- If an assignment statement is too long, we now prefer splitting on the right-hand side
(3368)
- Hex codes in Unicode escape sequences are now standardized to lowercase (2916)
- Allow empty first lines at the beginning of most blocks (3967, 4061)
- Add parentheses around long type annotations (3899)
- Enforce newline after module docstrings (3932, 4028)
- Fix incorrect magic trailing comma handling in return types (3916)
- Remove blank lines before class docstrings (3692)
- Wrap multiple context managers in parentheses if combined in a single `with` statement
(3489)
- Fix bug in line length calculations for power operations (3942)
- Add trailing commas to collection literals even if there's a comment after the last
entry (3393)
- When using `--skip-magic-trailing-comma` or `-C`, trailing commas are stripped from
subscript expressions with more than 1 element (3209)
- Add extra blank lines in stubs in a few cases (3564, 3862)
- Accept raw strings as docstrings (3947)
- Split long lines in case blocks (4024)
- Stop removing spaces from walrus operators within subscripts (3823)
- Fix incorrect formatting of certain async statements (3609)
- Allow combining ` fmt: skip` with other comments (3959)

There are already a few improvements in the `--preview` style, which are slated for the
2025 stable style. Try them out and
[share your feedback](https://github.com/psf/black/issues). In the past, the preview
style has included some features that we were not able to stabilize. This year, we're
adding a separate `--unstable` style for features with known problems. Now, the
`--preview` style only includes features that we actually expect to make it into next
year's stable style.

Stable style

Several bug fixes were made in features that are moved to the stable style in this
release:

- Fix comment handling when parenthesising conditional expressions (4134)
- Fix bug where spaces were not added around parenthesized walruses in subscripts,
unlike other binary operators (4109)
- Remove empty lines before docstrings in async functions (4132)
- Address a missing case in the change to allow empty lines at the beginning of all
blocks, except immediately before a docstring (4130)
- For stubs, fix logic to enforce empty line after nested classes with bodies (4141)

Preview style

- Add `--unstable` style, covering preview features that have known problems that would
block them from going into the stable style. Also add the `--enable-unstable-feature`
flag; for example, use
`--enable-unstable-feature hug_parens_with_braces_and_square_brackets` to apply this
preview feature throughout 2024, even if a later Black release downgrades the feature
to unstable (4096)
- Format module docstrings the same as class and function docstrings (4095)
- Fix crash when using a walrus in a dictionary (4155)
- Fix unnecessary parentheses when wrapping long dicts (4135)
- Stop normalizing spaces before ` fmt: skip` comments (4146)

Configuration

- Print warning when configuration in `pyproject.toml` contains an invalid key (4165)
- Fix symlink handling, properly ignoring symlinks that point outside of root (4161)
- Fix cache mtime logic that resulted in false positive cache hits (4128)
- Remove the long-deprecated `--experimental-string-processing` flag. This feature can
currently be enabled with `--preview --enable-unstable-feature string_processing`.
(4096)

Integrations

- Revert the change to run Black's pre-commit integration only on specific git hooks
(3940) for better compatibility with older versions of pre-commit (4137)

23.12.1

Packaging

- Fixed a bug that included dependencies from the `d` extra by default (4108)

23.12.0

Highlights

It's almost 2024, which means it's time for a new edition of _Black_'s stable style!
Together with this release, we'll put out an alpha release 24.1a1 showcasing the draft
2024 stable style, which we'll finalize in the January release. Please try it out and
[share your feedback](https://github.com/psf/black/issues/4042).

This release (23.12.0) will still produce the 2023 style. Most but not all of the
changes in `--preview` mode will be in the 2024 stable style.

Stable style

- Fix bug where ` fmt: off` automatically dedents when used with the `--line-ranges`
option, even when it is not within the specified line range. (4084)
- Fix feature detection for parenthesized context managers (4104)

Preview style

- Prefer more equal signs before a break when splitting chained assignments (4010)
- Standalone form feed characters at the module level are no longer removed (4021)
- Additional cases of immediately nested tuples, lists, and dictionaries are now
indented less (4012)
- Allow empty lines at the beginning of all blocks, except immediately before a
docstring (4060)
- Fix crash in preview mode when using a short `--line-length` (4086)
- Keep suites consisting of only an ellipsis on their own lines if they are not
functions or class definitions (4066) (4103)

Configuration

- `--line-ranges` now skips _Black_'s internal stability check in `--safe` mode. This
avoids a crash on rare inputs that have many unformatted same-content lines. (4034)

Packaging

- Upgrade to mypy 1.7.1 (4049) (4069)
- Faster compiled wheels are now available for CPython 3.12 (4070)

Integrations

- Enable 3.12 CI (4035)
- Build docker images in parallel (4054)
- Build docker images with 3.12 (4055)
Links

Update coverage from 7.3.2 to 7.6.1.

Changelog

7.6.1

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

- Fix: coverage used to fail when measuring code using :func:`runpy.run_path
<python:runpy.run_path>` with a :class:`Path <python:pathlib.Path>` argument.
This is now fixed, thanks to `Ask Hjorth Larsen <pull 1819_>`_.

- Fix: backslashes preceding a multi-line backslashed string could confuse the
HTML report.  This is now fixed, thanks to `LiuYinCarl <pull 1828_>`_.

- Now we publish wheels for Python 3.13, both regular and free-threaded.

.. _pull 1819: https://github.com/nedbat/coveragepy/pull/1819
.. _pull 1828: https://github.com/nedbat/coveragepy/pull/1828


.. _changes_7-6-0:

7.6.0

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

- Exclusion patterns can now be multi-line, thanks to `Daniel Diniz <pull
1807_>`_.  This enables many interesting exclusion use-cases, including those
requested in issues `118 <issue 118_>`_ (entire files), `996
<issue 996_>`_ (multiple lines only when appearing together), `1741
<issue 1741_>`_ (remainder of a function), and `1803 <issue 1803_>`_
(arbitrary sequence of marked lines).  See the :ref:`multi_line_exclude`
section of the docs for more details and examples.

- The JSON report now includes per-function and per-class coverage information.
Thanks to `Daniel Diniz <pull 1809_>`_ for getting the work started. This
closes `issue 1793`_ and `issue 1532`_.

- Fixed an incorrect calculation of "(no class)" lines in the HTML classes
report.

- Python 3.13.0b3 is supported.

.. _issue 118: https://github.com/nedbat/coveragepy/issues/118
.. _issue 996: https://github.com/nedbat/coveragepy/issues/996
.. _issue 1532: https://github.com/nedbat/coveragepy/issues/1532
.. _issue 1741: https://github.com/nedbat/coveragepy/issues/1741
.. _issue 1793: https://github.com/nedbat/coveragepy/issues/1793
.. _issue 1803: https://github.com/nedbat/coveragepy/issues/1803
.. _pull 1807: https://github.com/nedbat/coveragepy/pull/1807
.. _pull 1809: https://github.com/nedbat/coveragepy/pull/1809

.. _changes_7-5-4:

7.5.4

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

- If you attempt to combine statement coverage data with branch coverage data,
coverage.py used to fail with the message "Can't combine arc data with line
data" or its reverse, "Can't combine line data with arc data."  These
messages used internal terminology, making it hard for people to understand
the problem.  They are now changed to mention "branch coverage data" and
"statement coverage data."

- Fixed a minor branch coverage problem with wildcard match/case cases using
names or guard clauses.

- Started testing on 3.13 free-threading (nogil) builds of Python.  I'm not
claiming full support yet.  Closes `issue 1799`_.

.. _issue 1799: https://github.com/nedbat/coveragepy/issues/1799


.. _changes_7-5-3:

7.5.3

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

- Performance improvements for combining data files, especially when measuring
line coverage. A few different quadratic behaviors were eliminated. In one
extreme case of combining 700+ data files, the time dropped from more than
three hours to seven minutes.  Thanks for Kraken Tech for funding the fix.

- Performance improvements for generating HTML reports, with a side benefit of
reducing memory use, closing `issue 1791`_.  Thanks to Daniel Diniz for
helping to diagnose the problem.

.. _issue 1791: https://github.com/nedbat/coveragepy/issues/1791


.. _changes_7-5-2:

7.5.2

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

- Fix: nested matches of exclude patterns could exclude too much code, as
reported in `issue 1779`_.  This is now fixed.

- Changed: previously, coverage.py would consider a module docstring to be an
executable statement if it appeared after line 1 in the file, but not
executable if it was the first line.  Now module docstrings are never counted
as executable statements.  This can change coverage.py's count of the number
of statements in a file, which can slightly change the coverage percentage
reported.

- In the HTML report, the filter term and "hide covered" checkbox settings are
remembered between viewings, thanks to `Daniel Diniz <pull 1776_>`_.

- Python 3.13.0b1 is supported.

- Fix: parsing error handling is improved to ensure bizarre source files are
handled gracefully, and to unblock oss-fuzz fuzzing, thanks to `Liam DeVoe
<pull 1788_>`_. Closes `issue 1787`_.

.. _pull 1776: https://github.com/nedbat/coveragepy/pull/1776
.. _issue 1779: https://github.com/nedbat/coveragepy/issues/1779
.. _issue 1787: https://github.com/nedbat/coveragepy/issues/1787
.. _pull 1788: https://github.com/nedbat/coveragepy/pull/1788


.. _changes_7-5-1:

7.5.1

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

- Fix: a pragma comment on the continuation lines of a multi-line statement
now excludes the statement and its body, the same as if the pragma is
on the first line. This closes `issue 754`_. The fix was contributed by
`Daniel Diniz <pull 1773_>`_.

- Fix: very complex source files like `this one <resolvent_lookup_>`_ could
cause a maximum recursion error when creating an HTML report.  This is now
fixed, closing `issue 1774`_.

- HTML report improvements:

- Support files (JavaScript and CSS) referenced by the HTML report now have
 hashes added to their names to ensure updated files are used instead of
 stale cached copies.

- Missing branch coverage explanations that said "the condition was never
 false" now read "the condition was always true" because it's easier to
 understand.

- Column sort order is remembered better as you move between the index pages,
 fixing `issue 1766`_.  Thanks, `Daniel Diniz <pull 1768_>`_.


.. _resolvent_lookup: https://github.com/sympy/sympy/blob/130950f3e6b3f97fcc17f4599ac08f70fdd2e9d4/sympy/polys/numberfields/resolvent_lookup.py
.. _issue 754: https://github.com/nedbat/coveragepy/issues/754
.. _issue 1766: https://github.com/nedbat/coveragepy/issues/1766
.. _pull 1768: https://github.com/nedbat/coveragepy/pull/1768
.. _pull 1773: https://github.com/nedbat/coveragepy/pull/1773
.. _issue 1774: https://github.com/nedbat/coveragepy/issues/1774


.. _changes_7-5-0:

7.5.0

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

- Added initial support for function and class reporting in the HTML report.
There are now three index pages which link to each other: files, functions,
and classes.  Other reports don't yet have this information, but it will be
added in the future where it makes sense.  Feedback gladly accepted!
Finishes `issue 780`_.

- Other HTML report improvements:

- There is now a "hide covered" checkbox to filter out 100% files, finishing
 `issue 1384`_.

- The index page is always sorted by one of its columns, with clearer
 indications of the sorting.

- The "previous file" shortcut key didn't work on the index page, but now it
 does, fixing `issue 1765`_.

- The debug output showing which configuration files were tried now shows
absolute paths to help diagnose problems where settings aren't taking effect,
and is renamed from "attempted_config_files" to the more logical
"config_files_attempted."

- Python 3.13.0a6 is supported.

.. _issue 780: https://github.com/nedbat/coveragepy/issues/780
.. _issue 1384: https://github.com/nedbat/coveragepy/issues/1384
.. _issue 1765: https://github.com/nedbat/coveragepy/issues/1765


.. _changes_7-4-4:

7.4.4

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

- Fix: in some cases, even with ``[run] relative_files=True``, a data file
could be created with absolute path names.  When combined with other relative
data files, it was random whether the absolute file names would be made
relative or not. If they weren't, then a file would be listed twice in
reports, as detailed in `issue 1752`_.  This is now fixed: absolute file
names are always made relative when combining.  Thanks to Bruno Rodrigues dos
Santos for support.

- Fix: the last case of a match/case statement had an incorrect message if the
branch was missed.  It said the pattern never matched, when actually the
branch is missed if the last case always matched.

- Fix: clicking a line number in the HTML report now positions more accurately.

- Fix: the ``report:format`` setting was defined as a boolean, but should be a
string.  Thanks, `Tanaydin Sirin <pull 1754_>`_.  It is also now documented
on the :ref:`configuration page <config_report_format>`.

.. _issue 1752: https://github.com/nedbat/coveragepy/issues/1752
.. _pull 1754: https://github.com/nedbat/coveragepy/pull/1754


.. _changes_7-4-3:

7.4.3

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

- Fix: in some cases, coverage could fail with a RuntimeError: "Set changed
size during iteration." This is now fixed, closing `issue 1733`_.

.. _issue 1733: https://github.com/nedbat/coveragepy/issues/1733


.. _changes_7-4-2:

7.4.2

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

- Fix: setting ``COVERAGE_CORE=sysmon`` no longer errors on 3.11 and lower,
thanks `Hugo van Kemenade <pull 1747_>`_.  It now issues a warning that
sys.monitoring is not available and falls back to the default core instead.

.. _pull 1747: https://github.com/nedbat/coveragepy/pull/1747


.. _changes_7-4-1:

7.4.1

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

- Python 3.13.0a3 is supported.

- Fix: the JSON report now includes an explicit format version number, closing
`issue 1732`_.

.. _issue 1732: https://github.com/nedbat/coveragepy/issues/1732


.. _changes_7-4-0:

7.4.0

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

- In Python 3.12 and above, you can try an experimental core based on the new
:mod:`sys.monitoring <python:sys.monitoring>` module by defining a
``COVERAGE_CORE=sysmon`` environment variable.  This should be faster for
line coverage, but not for branch coverage, and plugins and dynamic contexts
are not yet supported with it.  I am very interested to hear how it works (or
doesn't!) for you.


.. _changes_7-3-4:

7.3.4

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

- Fix: the change for multi-line signature exclusions in 7.3.3 broke other
forms of nested clauses being excluded properly.  This is now fixed, closing
`issue 1713`_.

- Fix: in the HTML report, selecting code for copying won't select the line
numbers also. Thanks, `Robert Harris <pull 1717_>`_.

.. _issue 1713: https://github.com/nedbat/coveragepy/issues/1713
.. _pull 1717: https://github.com/nedbat/coveragepy/pull/1717


.. _changes_7-3-3:

7.3.3

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

- Fix: function definitions with multi-line signatures can now be excluded by
matching any of the lines, closing `issue 684`_.  Thanks, `Jan Rusak,
Maciej Kowalczyk and Joanna Ejzel <pull 1705_>`_.

- Fix: XML reports could fail with a TypeError if files had numeric components
that were duplicates except for leading zeroes, like ``file1.py`` and
``file001.py``.  Fixes `issue 1709`_.

- The ``coverage annotate`` command used to announce that it would be removed
in a future version. Enough people got in touch to say that they use it, so
it will stay.  Don't expect it to keep up with other new features though.

- Added new :ref:`debug options <cmd_run_debug>`:

- ``pytest`` writes the pytest test name into the debug output.

- ``dataop2`` writes the full data being added to CoverageData objects.

.. _issue 684: https://github.com/nedbat/coveragepy/issues/684
.. _pull 1705: https://github.com/nedbat/coveragepy/pull/1705
.. _issue 1709: https://github.com/nedbat/coveragepy/issues/1709


.. _changes_7-3-2:
Links

Update flake8 from 6.1.0 to 7.1.1.

The bot wasn't able to find a changelog for this release. Got an idea?

Links

Update isort from 5.12.0 to 5.13.2.

Changelog

5.13.2

- Apply the bracket fix from issue 471 only for use_parentheses=True (2184) bp72
- Confine pre-commit to stages (2213) davidculley
- Fixed colors extras (2212) staticdev

5.13.1

- Fixed integration tests (2208) bp72
- Fixed normalizing imports from more than one level of parent modules (issue/2152) (2191) bp72
- Remove optional dependencies without extras (2207) staticdev

5.13.0

- Cleanup deprecated extras (2089) staticdev
- Fixed 1989: settings lookup when working in stream based mode
- Fixed 80 line length for wemake linter (2183) skatromb
- Add support for Python 3.12 (2175) hugovk
- Fixed: add newest version to pre-commit docs (2190) AzulGarza
- Fixed assertions in test_git_hook (2196) mgorny
- Removed check for include_trailing_comma for the Hanging Indent wrap mode (2192) bp72
- Use the standard library tomllib on sufficiently new python (2202) eli-schwartz
- Update pre-commit.md version number (2197) nicobako
- doc: Update black_compatibility.md (2177) JSS95
- Fixed safety sept 2023 (2178) staticdev
- docs: fix black profile documentation (2163) nijel
- Fixed typo: indended -> indented (2161) vadimkerr
- Docs(configuration/options.md): fix missing trailing spaces for hard linebreak (2157) JoeyTeng
- Update pre-commit.md (2148) godiard
- chore: move configurations to pyproject.toml (2115) SauravMaheshkar
- Fixed typo in README (2112) stefmolin
- Update version in pre-commit setup to avoid installation issue with poetry (2103) stefmolin
- Skip .pytype directory by default. (2098) manueljacob
- Fixed a tip block styling in the Config Files section (2097) Klavionik
- Do not cache configuration files (1995) kaste
- Derive settings_path from --filename (1992) kaste
- Fixed year of version 5.12.0 in CHANGELOG.md (2082) DjLegolas
Links

Update mypy from 1.7.1 to 1.11.2.

Changelog

1.11

We’ve just uploaded mypy 1.11 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)). Mypy is a static type checker for Python. This release includes new features, performance improvements and bug fixes. You can install it as follows:

 python3 -m pip install -U mypy

You can read the full documentation for this release on [Read the Docs](http://mypy.readthedocs.io).

Support Python 3.12 Syntax for Generics (PEP 695)

Mypy now supports the new type parameter syntax introduced in Python 3.12 ([PEP 695](https://peps.python.org/pep-0695/)).
This feature is still experimental and must be enabled with the `--enable-incomplete-feature=NewGenericSyntax` flag, or with `enable_incomplete_feature = NewGenericSyntax` in the mypy configuration file.
We plan to enable this by default in the next mypy feature release.

This example demonstrates the new syntax:

python
Generic function
def f[T](x: T) -> T: ...

reveal_type(f(1))   Revealed type is 'int'

Generic class
class C[T]:
 def __init__(self, x: T) -> None:
    self.x = x

c = C('a')
reveal_type(c.x)   Revealed type is 'str'

Type alias
type A[T] = C[list[T]]


This feature was contributed by Jukka Lehtosalo.


Support for `functools.partial`

Mypy now type checks uses of `functools.partial`. Previously mypy would accept arbitrary arguments.

This example will now produce an error:

python
from functools import partial

def f(a: int, b: str) -> None: ...

g = partial(f, 1)

Argument has incompatible type "int"; expected "str"
g(11)


This feature was contributed by Shantanu (PR [16939](https://github.com/python/mypy/pull/16939)).


Stricter Checks for Untyped Overrides

Past mypy versions didn't check if untyped methods were compatible with overridden methods. This would result in false negatives. Now mypy performs these checks when using `--check-untyped-defs`.

For example, this now generates an error if using `--check-untyped-defs`:

python
class Base:
 def f(self, x: int = 0) -> None: ...

class Derived(Base):
  Signature incompatible with "Base"
 def f(self): ...


This feature was contributed by Steven Troxler (PR [17276](https://github.com/python/mypy/pull/17276)).


Type Inference Improvements

The new polymorphic inference algorithm introduced in mypy 1.5 is now used in more situations. This improves type inference involving generic higher-order functions, in particular.

This feature was contributed by Ivan Levkivskyi (PR [17348](https://github.com/python/mypy/pull/17348)).

Mypy now uses unions of tuple item types in certain contexts to enable more precise inferred types. Example:

python
for x in (1, 'x'):
  Previously inferred as 'object'
 reveal_type(x)   Revealed type is 'int | str'


This was also contributed by Ivan Levkivskyi (PR [17408](https://github.com/python/mypy/pull/17408)).


Improvements to Detection of Overlapping Overloads

The details of how mypy checks if two `overload` signatures are unsafely overlapping were overhauled. This both fixes some false positives, and allows mypy to detect additional unsafe signatures.

This feature was contributed by Ivan Levkivskyi (PR [17392](https://github.com/python/mypy/pull/17392)).


Better Support for Type Hints in Expressions

Mypy now allows more expressions that evaluate to valid type annotations in all expression contexts. The inferred types of these expressions are also sometimes more precise. Previously they were often `object`.

This example uses a union type that includes a callable type as an expression, and it no longer generates an error:

python
from typing import Callable

print(Callable[[], int] | None)   No error


This feature was contributed by Jukka Lehtosalo (PR [17404](https://github.com/python/mypy/pull/17404)).


Mypyc Improvements

Mypyc now supports the new syntax for generics introduced in Python 3.12 (see above). Another notable improvement is signficantly faster basic operations on `int` values.

* Support Python 3.12 syntax for generic functions and classes (Jukka Lehtosalo, PR [17357](https://github.com/python/mypy/pull/17357))
* Support Python 3.12 type alias syntax (Jukka Lehtosalo, PR [17384](https://github.com/python/mypy/pull/17384))
* Fix ParamSpec (Shantanu, PR [17309](https://github.com/python/mypy/pull/17309))
* Inline fast paths of integer unboxing operations (Jukka Lehtosalo, PR [17266](https://github.com/python/mypy/pull/17266))
* Inline tagged integer arithmetic and bitwise operations (Jukka Lehtosalo, PR [17265](https://github.com/python/mypy/pull/17265))
* Allow specifying primitives as pure (Jukka Lehtosalo, PR [17263](https://github.com/python/mypy/pull/17263))


Changes to Stubtest
* Ignore `_ios_support` (Alex Waygood, PR [17270](https://github.com/python/mypy/pull/17270))
* Improve support for Python 3.13 (Shantanu, PR [17261](https://github.com/python/mypy/pull/17261))


Changes to Stubgen
* Gracefully handle invalid `Optional` and recognize aliases to PEP 604 unions (Ali Hamdan, PR [17386](https://github.com/python/mypy/pull/17386))
* Fix for Python 3.13 (Jelle Zijlstra, PR [17290](https://github.com/python/mypy/pull/17290))
* Preserve enum value initialisers (Shantanu, PR [17125](https://github.com/python/mypy/pull/17125))


Miscellaneous New Features
* Add error format support and JSON output option via `--output json` (Tushar Sadhwani, PR [11396](https://github.com/python/mypy/pull/11396))
* Support `enum.member` in Python 3.11+ (Nikita Sobolev, PR [17382](https://github.com/python/mypy/pull/17382))
* Support `enum.nonmember` in Python 3.11+ (Nikita Sobolev, PR [17376](https://github.com/python/mypy/pull/17376))
* Support `namedtuple.__replace__` in Python 3.13 (Shantanu, PR [17259](https://github.com/python/mypy/pull/17259))
* Support `rename=True` in collections.namedtuple (Jelle Zijlstra, PR [17247](https://github.com/python/mypy/pull/17247))
* Add support for `__spec__` (Shantanu, PR [14739](https://github.com/python/mypy/pull/14739))


Changes to Error Reporting
* Mention `--enable-incomplete-feature=NewGenericSyntax` in messages (Shantanu, PR [17462](https://github.com/python/mypy/pull/17462))
* Do not report plugin-generated methods with `explicit-override` (sobolevn, PR [17433](https://github.com/python/mypy/pull/17433))
* Use and display namespaces for function type variables (Ivan Levkivskyi, PR [17311](https://github.com/python/mypy/pull/17311))
* Fix false positive for Final local scope variable in Protocol (GiorgosPapoutsakis, PR [17308](https://github.com/python/mypy/pull/17308))
* Use Never in more messages, use ambiguous in join (Shantanu, PR [17304](https://github.com/python/mypy/pull/17304))
* Log full path to config file in verbose output (dexterkennedy, PR [17180](https://github.com/python/mypy/pull/17180))
* Added `[prop-decorator]` code for unsupported property decorators (14461) (Christopher Barber, PR [16571](https://github.com/python/mypy/pull/16571))
* Suppress second error message with `:=` and `[truthy-bool]` (Nikita Sobolev, PR [15941](https://github.com/python/mypy/pull/15941))
* Generate error for assignment of functional Enum to variable of different name (Shantanu, PR [16805](https://github.com/python/mypy/pull/16805))
* Fix error reporting on cached run after uninstallation of third party library (Shantanu, PR [17420](https://github.com/python/mypy/pull/17420))


Fixes for Crashes
* Fix daemon crash on invalid type in TypedDict (Ivan Levkivskyi, PR [17495](https://github.com/python/mypy/pull/17495))
* Fix crash and bugs related to `partial()` (Ivan Levkivskyi, PR [17423](https://github.com/python/mypy/pull/17423))
* Fix crash when overriding with unpacked TypedDict (Ivan Levkivskyi, PR [17359](https://github.com/python/mypy/pull/17359))
* Fix crash on TypedDict unpacking for ParamSpec (Ivan Levkivskyi, PR [17358](https://github.com/python/mypy/pull/17358))
* Fix crash involving recursive union of tuples (Ivan Levkivskyi, PR [17353](https://github.com/python/mypy/pull/17353))
* Fix crash on invalid callable property override (Ivan Levkivskyi, PR [17352](https://github.com/python/mypy/pull/17352))
* Fix crash on unpacking self in NamedTuple (Ivan Levkivskyi, PR [17351](https://github.com/python/mypy/pull/17351))
* Fix crash on recursive alias with an optional type (Ivan Levkivskyi, PR [17350](https://github.com/python/mypy/pull/17350))
* Fix crash on type comment inside generic definitions (Bénédikt Tran, PR [16849](https://github.com/python/mypy/pull/16849))


Changes to Documentation
* Use inline config in documentation for optional error codes (Shantanu, PR [17374](https://github.com/python/mypy/pull/17374))
* Use lower-case generics in documentation (Seo Sanghyeon, PR [17176](https://github.com/python/mypy/pull/17176))
* Add documentation for show-error-code-links (GiorgosPapoutsakis, PR [17144](https://github.com/python/mypy/pull/17144))
* Update CONTRIBUTING.md to include commands for Windows (GiorgosPapoutsakis, PR [17142](https://github.com/python/mypy/pull/17142))


Other Notable Improvements and Fixes
* Fix ParamSpec inference against TypeVarTuple (Ivan Levkivskyi, PR [17431](https://github.com/python/mypy/pull/17431))
* Fix explicit type for `partial` (Ivan Levkivskyi, PR [17424](https://github.com/python/mypy/pull/17424))
* Always allow lambda calls (Ivan Levkivskyi, PR [17430](https://github.com/python/mypy/pull/17430))
* Fix isinstance checks with PEP 604 unions containing None (Shantanu, PR [17415](https://github.com/python/mypy/pull/17415))
* Fix self-referential upper bound in new-style type variables (Ivan Levkivskyi, PR [17407](https://github.com/python/mypy/pull/17407))
* Consider overlap between instances and callables (Ivan Levkivskyi, PR [17389](https://github.com/python/mypy/pull/17389))
* Allow new-style self-types in classmethods (Ivan Levkivskyi, PR [17381](https://github.com/python/mypy/pull/17381))
* Fix isinstance with type aliases to PEP 604 unions (Shantanu, PR [17371](https://github.com/python/mypy/pull/17371))
* Properly handle unpacks in overlap checks (Ivan Levkivskyi, PR [17356](https://github.com/python/mypy/pull/17356))
* Fix type application for classes with generic constructors (Ivan Levkivskyi, PR [17354](https://github.com/python/mypy/pull/17354))
* Update `typing_extensions` to >=4.6.0 to fix Python 3.12 error (Ben Brown, PR [17312](https://github.com/python/mypy/pull/17312))
* Avoid "does not return" error in lambda (Shantanu, PR [17294](https://github.com/python/mypy/pull/17294))
* Fix bug with descriptors in non-strict-optional mode (Max Murin, PR [17293](https://github.com/python/mypy/pull/17293))
* Don’t leak unreachability from lambda body to surrounding scope (Anders Kaseorg, PR [17287](https://github.com/python/mypy/pull/17287))
* Fix issues with non-ASCII characters on Windows (Alexander Leopo

@pyup-bot
Copy link
Collaborator Author

pyup-bot commented Oct 7, 2024

Closing this in favor of #348

@pyup-bot pyup-bot closed this Oct 7, 2024
@madig madig deleted the pyup-scheduled-update-2024-09-30 branch October 7, 2024 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant