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

PYUP Scheduled weekly dependency update for week 03 #177

Closed
wants to merge 11 commits into from

Conversation

pyup-bot
Copy link
Collaborator

@pyup-bot pyup-bot commented Jan 20, 2025

Update pytest from 7.1.2 to 8.3.4.

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

Links

Update opencensus from 0.9.0 to 0.11.4.

Changelog

0.11.4

Released 2024-01-03
- Changed bit-mapping for `httpx` and `fastapi` integrations
([1239](https://github.com/census-instrumentation/opencensus-python/pull/1239))

0.11.3

Released 2023-09-18

- Updated `azure` modules

0.11.2

Released 2023-03-10

- Updated `azure`, `fastapi`,`flask` modules

0.11.1

Released 2023-01-18

- Updated `azure`, `httpx` modules

0.11.0

Released 2022-08-03

- Updated `azure`, `context`, `flask`, `requests` modules

0.10.0

Released 2022-07-05

- Add kwargs to derived gauge
([1135](https://github.com/census-instrumentation/opencensus-python/pull/1135))
Links

Update black from 22.3.0 to 24.10.0.

Changelog

24.10.0

Highlights

- Black is now officially tested with Python 3.13 and provides Python 3.13
mypyc-compiled wheels. (4436) (4449)
- Black will issue an error when used with Python 3.12.5, due to an upstream memory
safety issue in Python 3.12.5 that can cause Black's AST safety checks to fail. Please
use Python 3.12.6 or Python 3.12.4 instead. (4447)
- Black no longer supports running with Python 3.8 (4452)

Stable style

- Fix crashes involving comments in parenthesised return types or `X | Y` style unions.
(4453)
- Fix skipping Jupyter cells with unknown `%%` magic (4462)

Preview style

- Fix type annotation spacing between * and more complex type variable tuple (i.e. `def
fn(*args: *tuple[*Ts, T]) -> None: pass`) (4440)

Caching

- Fix bug where the cache was shared between runs with and without `--unstable` (4466)

Packaging

- Upgrade version of mypyc used to 1.12 beta (4450) (4449)
- `blackd` now requires a newer version of aiohttp. (4451)

Output

- Added Python target version information on parse error (4378)
- Add information about Black version to internal error messages (4457)

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)

23.11.0

Highlights

- Support formatting ranges of lines with the new `--line-ranges` command-line option
(4020)

Stable style

- Fix crash on formatting bytes strings that look like docstrings (4003)
- Fix crash when whitespace followed a backslash before newline in a docstring (4008)
- Fix standalone comments inside complex blocks crashing Black (4016)
- Fix crash on formatting code like `await (a ** b)` (3994)
- No longer treat leading f-strings as docstrings. This matches Python's behaviour and
fixes a crash (4019)

Preview style

- Multiline dicts and lists that are the sole argument to a function are now indented
less (3964)
- Multiline unpacked dicts and lists as the sole argument to a function are now also
indented less (3992)
- In f-string debug expressions, quote types that are visible in the final string are
now preserved (4005)
- Fix a bug where long `case` blocks were not split into multiple lines. Also enable
general trailing comma rules on `case` blocks (4024)
- Keep requiring two empty lines between module-level docstring and first function or
class definition (4028)
- Add support for single-line format skip with other comments on the same line (3959)

Configuration

- Consistently apply force exclusion logic before resolving symlinks (4015)
- Fix a bug in the matching of absolute path names in `--include` (3976)

Performance

- Fix mypyc builds on arm64 on macOS (4017)

Integrations

- Black's pre-commit integration will now run only on git hooks appropriate for a code
formatter (3940)

23.10.1

Highlights

- Maintenance release to get a fix out for GitHub Action edge case (3957)

Preview style

- Fix merging implicit multiline strings that have inline comments (3956)
- Allow empty first line after block open before a comment or compound statement (3967)

Packaging

- Change Dockerfile to hatch + compile black (3965)

Integrations

- The summary output for GitHub workflows is now suppressible using the `summary`
parameter. (3958)
- Fix the action failing when Black check doesn't pass (3957)

Documentation

- It is known Windows documentation CI is broken
https://github.com/psf/black/issues/3968

23.10.0

Stable style

- Fix comments getting removed from inside parenthesized strings (3909)

Preview style

- Fix long lines with power operators getting split before the line length (3942)
- Long type hints are now wrapped in parentheses and properly indented when split across
multiple lines (3899)
- Magic trailing commas are now respected in return types. (3916)
- Require one empty line after module-level docstrings. (3932)
- Treat raw triple-quoted strings as docstrings (3947)

Configuration

- Fix cache versioning logic when `BLACK_CACHE_DIR` is set (3937)

Parser

- Fix bug where attributes named `type` were not accepted inside `match` statements
(3950)
- Add support for PEP 695 type aliases containing lambdas and other unusual expressions
(3949)

Output

- Black no longer attempts to provide special errors for attempting to format Python 2
code (3933)
- Black will more consistently print stacktraces on internal errors in verbose mode
(3938)

Integrations

- The action output displayed in the job summary is now wrapped in Markdown (3914)

23.9.1

Due to various issues, the previous release (23.9.0) did not include compiled mypyc
wheels, which make Black significantly faster. These issues have now been fixed, and
this release should come with compiled wheels once again.

There will be no wheels for Python 3.12 due to a bug in mypyc. We will provide 3.12
wheels in a future release as soon as the mypyc bug is fixed.

Packaging

- Upgrade to mypy 1.5.1 (3864)

Performance

- Store raw tuples instead of NamedTuples in Black's cache, improving performance and
decreasing the size of the cache (3877)

23.9.0

Preview style

- More concise formatting for dummy implementations (3796)
- In stub files, add a blank line between a statement with a body (e.g an
`if sys.version_info > (3, x):`) and a function definition on the same level (3862)
- Fix a bug whereby spaces were removed from walrus operators within subscript(3823)

Configuration

- Black now applies exclusion and ignore logic before resolving symlinks (3846)

Performance

- Avoid importing `IPython` if notebook cells do not contain magics (3782)
- Improve caching by comparing file hashes as fallback for mtime and size (3821)

_Blackd_

- Fix an issue in `blackd` with single character input (3558)

Integrations

- Black now has an
[official pre-commit mirror](https://github.com/psf/black-pre-commit-mirror). Swapping
`https://github.com/psf/black` to `https://github.com/psf/black-pre-commit-mirror` in
your `.pre-commit-config.yaml` will make Black about 2x faster (3828)
- The `.black.env` folder specified by `ENV_PATH` will now be removed on the completion
of the GitHub Action (3759)

23.7.0

Highlights

- Runtime support for Python 3.7 has been removed. Formatting 3.7 code will still be
supported until further notice (3765)

Stable style

- Fix a bug where an illegal trailing comma was added to return type annotations using
PEP 604 unions (3735)
- Fix several bugs and crashes where comments in stub files were removed or mishandled
under some circumstances (3745)
- Fix a crash with multi-line magic comments like `type: ignore` within parentheses
(3740)
- Fix error in AST validation when _Black_ removes trailing whitespace in a type comment
(3773)

Preview style

- Implicitly concatenated strings used as function args are no longer wrapped inside
parentheses (3640)
- Remove blank lines between a class definition and its docstring (3692)

Configuration

- The `--workers` argument to _Black_ can now be specified via the `BLACK_NUM_WORKERS`
environment variable (3743)
- `.pytest_cache`, `.ruff_cache` and `.vscode` are now excluded by default (3691)
- Fix _Black_ not honouring `pyproject.toml` settings when running `--stdin-filename`
and the `pyproject.toml` found isn't in the current working directory (3719)
- _Black_ will now error if `exclude` and `extend-exclude` have invalid data types in
`pyproject.toml`, instead of silently doing the wrong thing (3764)

Packaging

- Upgrade mypyc from 0.991 to 1.3 (3697)
- Remove patching of Click that mitigated errors on Python 3.6 with `LANG=C` (3768)

Parser

- Add support for the new PEP 695 syntax in Python 3.12 (3703)

Performance

- Speed up _Black_ significantly when the cache is full (3751)
- Avoid importing `IPython` in a case where we wouldn't need it (3748)

Output

- Use aware UTC datetimes internally, avoids deprecation warning on Python 3.12 (3728)
- Change verbose logging to exactly mirror _Black_'s logic for source discovery (3749)

_Blackd_

- The `blackd` argument parser now shows the default values for options in their help
text (3712)

Integrations

- Black is now tested with
[`PYTHONWARNDEFAULTENCODING = 1`](https://docs.python.org/3/library/io.html#io-encoding-warning)
(3763)
- Update GitHub Action to display black output in the job summary (3688)

Documentation

- Add a CITATION.cff file to the root of the repository, containing metadata on how to
cite this software (3723)
- Update the _classes_ and _exceptions_ documentation in Developer reference to match
the latest code base (3755)

23.3.0

Highlights

This release fixes a longstanding confusing behavior in Black's GitHub action, where the
version of the action did not determine the version of Black being run (issue 3382). In
addition, there is a small bug fix around imports and a number of improvements to the
preview style.

Please try out the
[preview style](https://black.readthedocs.io/en/stable/the_black_code_style/future_style.html#preview-style)
with `black --preview` and tell us your feedback. All changes in the preview style are
expected to become part of Black's stable style in January 2024.

Stable style

- Import lines with ` fmt: skip` and ` fmt: off` no longer have an extra blank line
added when they are right after another import line (3610)

Preview style

- Add trailing commas to collection literals even if there's a comment after the last
entry (3393)
- `async def`, `async for`, and `async with` statements are now formatted consistently
compared to their non-async version. (3609)
- `with` statements that contain two context managers will be consistently wrapped in
parentheses (3589)
- Let string splitters respect [East Asian Width](https://www.unicode.org/reports/tr11/)
(3445)
- Now long string literals can be split after East Asian commas and periods (`、` U+3001
IDEOGRAPHIC COMMA, `。` U+3002 IDEOGRAPHIC FULL STOP, & `,` U+FF0C FULLWIDTH COMMA)
besides before spaces (3445)
- For stubs, enforce one blank line after a nested class with a body other than just
`...` (3564)
- Improve handling of multiline strings by changing line split behavior (1879)

Parser

- Added support for formatting files with invalid type comments (3594)

Integrations

- Update GitHub Action to use the version of Black equivalent to action's version if
version input is not specified (3543)
- Fix missing Python binary path in autoload script for vim (3508)

Documentation

- Document that only the most recent release is supported for security issues;
vulnerabilities should be reported through Tidelift (3612)

23.1.0

Highlights

This is the first release of 2023, and following our
[stability policy](https://black.readthedocs.io/en/stable/the_black_code_style/index.html#stability-policy),
it comes with a number of improvements to our stable style, including improvements to
empty line handling, removal of redundant parentheses in several contexts, and output
that highlights implicitly concatenated strings better.

There are also many changes to the preview style; try out `black --preview` and give us
feedback to help us set the stable style for next year.

In addition to style changes, Black now automatically infers the supported Python
versions from your `pyproject.toml` file, removing the need to set Black's target
versions separately.

Stable style

- Introduce the 2023 stable style, which incorporates most aspects of last year's
preview style (3418). Specific changes:
- Enforce empty lines before classes and functions with sticky leading comments
 (3302) (22.12.0)
- Reformat empty and whitespace-only files as either an empty file (if no newline is
 present) or as a single newline character (if a newline is present) (3348)
 (22.12.0)
- Implicitly concatenated strings used as function args are now wrapped inside
 parentheses (3307) (22.12.0)
- Correctly handle trailing commas that are inside a line's leading non-nested parens
 (3370) (22.12.0)
- `--skip-string-normalization` / `-S` now prevents docstring prefixes from being
 normalized as expected (3168) (since 22.8.0)
- When using `--skip-magic-trailing-comma` or `-C`, trailing commas are stripped from
 subscript expressions with more than 1 element (3209) (22.8.0)
- Implicitly concatenated strings inside a list, set, or tuple are now wrapped inside
 parentheses (3162) (22.8.0)
- Fix a string merging/split issue when a comment is present in the middle of
 implicitly concatenated strings on its own line (3227) (22.8.0)
- Docstring quotes are no longer moved if it would violate the line length limit
 (3044, 3430) (22.6.0)
- Parentheses around return annotations are now managed (2990) (22.6.0)
- Remove unnecessary parentheses around awaited objects (2991) (22.6.0)
- Remove unnecessary parentheses in `with` statements (2926) (22.6.0)
- Remove trailing newlines after code block open (3035) (22.6.0)
- Code cell separators `%%` are now standardised to ` %%` (2919) (22.3.0)
- Remove unnecessary parentheses from `except` statements (2939) (22.3.0)
- Remove unnecessary parentheses from tuple unpacking in `for` loops (2945) (22.3.0)
- Avoid magic-trailing-comma in single-element subscripts (2942) (22.3.0)
- Fix a crash when a colon line is marked between ` fmt: off` and ` fmt: on` (3439)

Preview style

- Format hex codes in unicode escape sequences in string literals (2916)
- Add parentheses around `if`-`else` expressions (2278)
- Improve performance on large expressions that contain many strings (3467)
- Fix a crash in preview style with assert + parenthesized string (3415)
- Fix crashes in preview style with walrus operators used in function return annotations
and except clauses (3423)
- Fix a crash in preview advanced string processing where mixed implicitly concatenated
regular and f-strings start with an empty span (3463)
- Fix a crash in preview advanced string processing where a standalone comment is placed
before a dict's value (3469)
- Fix an issue where extra empty lines are added when a decorator has ` fmt: skip`
applied or there is a standalone comment between decorators (3470)
- Do not put the closing quotes in a docstring on a separate line, even if the line is
too long (3430)
- Long values in dict literals are now wrapped in parentheses; correspondingly
unnecessary parentheses around short values in dict literals are now removed; long
string lambda values are now wrapped in parentheses (3440)
- Fix two crashes in preview style involving edge cases with docstrings (3451)
- Exclude string type annotations from improved string processing; fix crash when the
return type annotation is stringified and spans across multiple lines (3462)
- Wrap multiple context managers in parentheses when targeting Python 3.9+ (3489)
- Fix several crashes in preview style with walrus operators used in `with` statements
or tuples (3473)
- Fix an invalid quote escaping bug in f-string expressions where it produced invalid
code. Implicitly concatenated f-strings with different quotes can now be merged or
quote-normalized by changing the quotes used in expressions. (3509)
- Fix crash on `await (yield)` when Black is compiled with mypyc (3533)

Configuration

- Black now tries to infer its `--target-version` from the project metadata specified in
`pyproject.toml` (3219)

Packaging

- Upgrade mypyc from `0.971` to `0.991` so mypycified _Black_ can be built on armv7
(3380)
- This also fixes some crashes while using compiled Black with a debug build of
 CPython
- Drop specific support for the `tomli` requirement on 3.11 alpha releases, working
around a bug that would cause the requirement not to be installed on any non-final
Python releases (3448)
- Black now depends on `packaging` version `22.0` or later. This is required for new
functionality that needs to parse part of the project metadata (3219)

Output

- Calling `black --help` multiple times will return the same help contents each time
(3516)
- Verbose logging now shows the values of `pyproject.toml` configuration variables
(3392)
- Fix false symlink detection messages in verbose output due to using an incorrect
relative path to the project root (3385)

Integrations

- Move 3.11 CI to normal flow now that all dependencies support 3.11 (3446)
- Docker: Add new `latest_prerelease` tag automation to follow latest black alpha
release on docker images (3465)

Documentation

- Expand `vim-plug` installation instructions to offer more explicit options (3468)

22.12.0

Preview style

- Enforce empty lines before classes and functions with sticky leading comments (3302)
- Reformat empty and whitespace-only files as either an empty file (if no newline is
present) or as a single newline character (if a newline is present) (3348)
- Implicitly concatenated strings used as function args are now wrapped inside
parentheses (3307)
- For assignment statements, prefer splitting the right hand side if the left hand side
fits on a single line (3368)
- Correctly handle trailing commas that are inside a line's leading non-nested parens
(3370)

Configuration

- Fix incorrectly applied `.gitignore` rules by considering the `.gitignore` location
and the relative path to the target file (3338)
- Fix incorrectly ignoring `.gitignore` presence when more than one source directory is
specified (3336)

Parser

- Parsing support has been added for walruses inside generator expression that are
passed as function args (for example,
`any(match := my_re.match(text) for text in texts)`) (3327).

Integrations

- Vim plugin: Optionally allow using the system installation of Black via
`let g:black_use_virtualenv = 0`(3309)

22.10.0

Highlights

- Runtime support for Python 3.6 has been removed. Formatting 3.6 code will still be
supported until further notice.

Stable style

- Fix a crash when ` fmt: on` is used on a different block level than ` fmt: off`
(3281)

Preview style

- Fix a crash when formatting some dicts with parenthesis-wrapped long string keys
(3262)

Configuration

- `.ipynb_checkpoints` directories are now excluded by default (3293)
- Add `--skip-source-first-line` / `-x` option to ignore the first line of source code
while formatting (3299)

Packaging

- Executables made with PyInstaller will no longer crash when formatting several files
at once on macOS. Native x86-64 executables for macOS are available once again.
(3275)
- Hatchling is now used as the build backend. This will not have any effect for users
who install Black with its wheels from PyPI. (3233)
- Faster compiled wheels are now available for CPython 3.11 (3276)

_Blackd_

- Windows style (CRLF) newlines will be preserved (3257).

Integrations

- Vim plugin: add flag (`g:black_preview`) to enable/disable the preview style (3246)
- Update GitHub Action to support formatting of Jupyter Notebook files via a `jupyter`
option (3282)
- Update GitHub Action to support use of version specifiers (e.g. `<23`) for Black
version (3265)

22.8.0

Highlights

- Python 3.11 is now supported, except for _blackd_ as aiohttp does not support 3.11 as
of publishing (3234)
- This is the last release that supports running _Black_ on Python 3.6 (formatting 3.6
code will continue to be supported until further notice)
- Reword the stability policy to say that we may, in rare cases, make changes that
affect code that was not previously formatted by _Black_ (3155)

Stable style

- Fix an infinite loop when using ` fmt: on/off` in the middle of an expression or code
block (3158)
- Fix incorrect handling of ` fmt: skip` on colon (`:`) lines (3148)
- Comments are no longer deleted when a line had spaces removed around power operators
(2874)

Preview style

- Single-character closing docstring quotes are no longer moved to their own line as
this is invalid. This was a bug introduced in version 22.6.0. (3166)
- `--skip-string-normalization` / `-S` now prevents docstring prefixes from being
normalized as expected (3168)
- When using `--skip-magic-trailing-comma` or `-C`, trailing commas are stripped from
subscript expressions with more than 1 element (3209)
- Implicitly concatenated strings inside a list, set, or tuple are now wrapped inside
parentheses (3162)
- Fix a string merging/split issue when a comment is present in the middle of implicitly
concatenated strings on its own line (3227)

_Blackd_

- `blackd` now supports enabling the preview style via the `X-Preview` header (3217)

Configuration

- Black now uses the presence of debug f-strings to detect target version (3215)
- Fix misdetection of project root and verbose logging of sources in cases involving
`--stdin-filename` (3216)
- Immediate `.gitignore` files in source directories given on the command line are now
also respected, previously only `.gitignore` files in the project root and
automatically discovered directories were respected (3237)

Documentation

- Recommend using BlackConnect in IntelliJ IDEs (3150)

Integrations

- Vim plugin: prefix messages with `Black: ` so it's clear they come from Black (3194)
- Docker: changed to a /opt/venv installation + added to PATH to be available to
non-root users (3202)

Output

- Change from deprecated `asyncio.get_event_loop()` to create our event loop which
removes DeprecationWarning (3164)
- Remove logging from internal `blib2to3` library since it regularly emits error logs
about failed caching that can and should be ignored (3193)

Parser

- Type comments are now included in the AST equivalence check consistently so accidental
deletion raises an error. Though type comments can't be tracked when running on PyPy
3.7 due to standard library limitations. (2874)

Performance

- Reduce Black's startup time when formatting a single file by 15-30% (3211)

22.6.0

Style

- Fix unstable formatting involving `fmt: skip` and ` fmt:skip` comments (notice the
lack of spaces) (2970)

Preview style

- Docstring quotes are no longer moved if it would violate the line length limit (3044)
- Parentheses around return annotations are now managed (2990)
- Remove unnecessary parentheses around awaited objects (2991)
- Remove unnecessary parentheses in `with` statements (2926)
- Remove trailing newlines after code block open (3035)

Integrations

- Add `scripts/migrate-black.py` script to ease introduction of Black to a Git project
(3038)

Output

- Output Python version and implementation as part of `--version` flag (2997)

Packaging

- Use `tomli` instead of `tomllib` on Python 3.11 builds where `tomllib` is not
available (2987)

Parser

- [PEP 654](https://peps.python.org/pep-0654/#except) syntax (for example,
`except *ExceptionGroup:`) is now supported (3016)
- [PEP 646](https://peps.python.org/pep-0646) syntax (for example,
`Array[Batch, *Shape]` or `def fn(*args: *T) -> None`) is now supported (3071)

Vim Plugin

- Fix `strtobool` function. It didn't parse true/on/false/off. (3025)
Links

Update grpcio from 1.46.3 to 1.69.0.

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

Links

Update mypy from 0.960 to 1.14.1.

Changelog

1.14

We’ve just uploaded mypy 1.14 to the Python Package Index ([PyPI](https://pypi.org/project/mypy/)).
Mypy is a static type checker for Python. This release includes new features 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).

Change to Enum Membership Semantics

As per the updated [typing specification for enums](https://typing.readthedocs.io/en/latest/spec/enums.html#defining-members),
enum members must be left unannotated.

python
class Pet(Enum):
 CAT = 1   Member attribute
 DOG = 2   Member attribute

  New error: Enum members must be left unannotated
 WOLF: int = 3

 species: str   Considered a non-member attribute


In particular, the specification change can result in issues in type stubs (`.pyi` files), since
historically it was common to leave the value absent:

python
In a type stub (.pyi file)

class Pet(Enum):
  Change in semantics: previously considered members,
  now non-member attributes
 CAT: int
 DOG: int

  Mypy will now issue a warning if it detects this
  situation in type stubs:
  > Detected enum "Pet" in a type stub with zero
  > members. There is a chance this is due to a recent
  > change in the semantics of enum membership. If so,
  > use `member = value` to mark an enum member,
  > instead of `member: type`

class Pet(Enum):
  As per the specification, you should now do one of
  the following:
 DOG = 1   Member attribute with value 1 and known type
 WOLF = cast(int, ...)   Member attribute with unknown
                         value but known type
 LION = ...   Member attribute with unknown value and
               unknown type


Contributed by Terence Honles (PR [17207](https://github.com/python/mypy/pull/17207)) and
Shantanu Jain (PR [18068](https://github.com/python/mypy/pull/18068)).

Support for deprecated Decorator (PEP 702)

Mypy can now issue errors or notes when code imports a deprecated feature
explicitly with a `from mod import depr` statement, or uses a deprecated feature
imported otherwise or defined locally. Features are considered deprecated when
decorated with `warnings.deprecated`, as specified in [PEP 702](https://peps.python.org/pep-0702).

You can enable the error code via `--enable-error-code=deprecated` on the mypy
command line or `enable_error_code = deprecated` in the mypy config file.
Use the command line flag `--report-deprecated-as-note` or config file option
`report_deprecated_as_note=True` to turn all such errors into notes.

Deprecation errors will be enabled by default in a future mypy version.

This feature was contributed by Christoph Tyralla.

List of changes:

* Add basic support for PEP 702 (`deprecated`) (Christoph Tyralla, PR [17476](https://github.com/python/mypy/pull/17476))
* Support descriptors with `deprecated` (Christoph Tyralla, PR [18090](https://github.com/python/mypy/pull/18090))
* Make "deprecated" note an error, disabled by default (Valentin Stanciu, PR [18192](https://github.com/python/mypy/pull/18192))
* Consider all possible type positions with `deprecated` (Christoph Tyralla, PR [17926](https://github.com/python/mypy/pull/17926))
* Improve the handling of explicit type annotations in assignment statements with `deprecated` (Christoph Tyralla, PR [17899](https://github.com/python/mypy/pull/17899))

Optionally Analyzing Untyped Modules

Mypy normally doesn't analyze imports from third-party modules (installed using pip, for example)
if there are no stubs or a py.typed marker file. To force mypy to analyze these imports, you
can now use the `--follow-untyped-imports` flag or set the `follow_untyped_imports`
config file option to True. This can be set either in the global section of your mypy config
file, or individually on a per-module basis.

This feature was contributed by Jannick Kremer.

List of changes:

* Implement flag to allow type checking of untyped modules (Jannick Kremer, PR [17712](https://github.com/python/mypy/pull/17712))
* Warn about `--follow-untyped-imports` (Shantanu, PR [18249](https://github.com/python/mypy/pull/18249))

Support New Style Type Variable Defaults (PEP 696)

Mypy now supports type variable defaults using the new syntax described in PEP 696, which
was introduced in Python 3.13. Example:

python
dataclass
class Box[T = int]:   Set default for "T"
 value: T | None = None

reveal_type(Box())                       type is Box[int], since it's the default
reveal_type(Box(value="Hello World!"))   type is Box[str]


This feature was contributed by Marc Mueller (PR [17985](https://github.com/python/mypy/pull/17985)).

Improved For Loop Index Variable Type Narrowing

Mypy now preserves the literal type of for loop index variables, to support `TypedDict`
lookups. Example:

python
from typing import TypedDict

class X(TypedDict):
 hourly: int
 daily: int

def func(x: X) -> int:
 s = 0
 for var in ("hourly", "daily"):
      "Union[Literal['hourly']?, Literal['daily']?]"
     reveal_type(var)

      x[var] no longer triggers a literal-required error
     s += x[var]
 return s


This was contributed by Marc Mueller (PR [18014](https://github.com/python/mypy/pull/18014)).

Mypyc Improvements

* Document optimized bytes operations and additional str operations (Jukka Lehtosalo, PR [18242](https://github.com/python/mypy/pull/18242))
* Add primitives and specialization for `ord()` (Jukka Lehtosalo, PR [18240](https://github.com/python/mypy/pull/18240))
* Optimize `str.encode` with specializations for common used encodings (Valentin Stanciu, PR [18232](https://github.com/python/mypy/pull/18232))
* Fix fall back to generic operation for staticmethod and classmethod (Advait Dixit, PR [18228](https://github.com/python/mypy/pull/18228))
* Support unicode surrogates in string literals (Jukka Lehtosalo, PR [18209](https://github.com/python/mypy/pull/18209))
* Fix index variable in for loop with `builtins.enumerate` (Advait Dixit, PR [18202](https://github.com/python/mypy/pull/18202))
* Fix check for enum classes (Advait Dixit, PR [18178](https://github.com/python/mypy/pull/18178))
* Fix loading type from imported modules (Advait Dixit, PR [18158](https://github.com/python/mypy/pull/18158))
* Fix initializers of final attributes in class body (Jared Hance, PR [18031](https://github.com/python/mypy/pull/18031))
* Fix name generation for modules with similar full names (aatle, PR [18001](https://github.com/python/mypy/pull/18001))
* Fix relative imports in `__init__.py` (Shantanu, PR [17979](https://github.com/python/mypy/pull/17979))
* Optimize dunder methods (jairov4, PR [17934](https://github.com/python/mypy/pull/17934))
* Replace deprecated `_PyDict_GetItemStringWithError` (Marc Mueller, PR [17930](https://github.com/python/mypy/pull/17930))
* Fix wheel build for cp313-win (Marc Mueller, PR [17941](https://github.com/python/mypy/pull/17941))
* Use public PyGen_GetCode instead of vendored implementation (Marc Mueller, PR [17931](https://github.com/python/mypy/pull/17931))
* Optimize calls to final classes (jairov4, PR [17886](https://github.com/python/mypy/pull/17886))
* Support ellipsis (`...`) expressions in class bodies (Newbyte, PR [17923](https://github.com/python/mypy/pull/17923))
* Sync `pythoncapi_compat.h` (Marc Mueller, PR [17929](https://github.com/python/mypy/pull/17929))
* Add `runtests.py mypyc-fast` for running fast mypyc tests (Jukka Lehtosalo, PR [17906](https://github.com/python/mypy/pull/17906))

Stubgen Improvements

* Do not include mypy generated symbols (Ali Hamdan, PR [18137](https://github.com/python/mypy/pull/18137))
* Fix `FunctionContext.fullname` for nested classes (Chad Dombrova, PR [17963](https://github.com/python/mypy/pull/17963))
* Add flagfile support (Ruslan Sayfutdinov, PR [18061](https://github.com/python/mypy/pull/18061))
* Add support for PEP 695 and PEP 696 syntax (Ali Hamdan, PR [18054](https://github.com/python/mypy/pull/18054))

Stubtest Improvements

* Allow the use of `--show-traceback` and `--pdb` with stubtest (Stephen Morton, PR [18037](https://github.com/python/mypy/pull/18037))
* Verify `__all__` exists in stub (Sebastian Rittau, PR [18005](https://github.com/python/mypy/pull/18005))
* Stop telling people to use double underscores (Jelle Zijlstra, PR [17897](https://github.com/python/mypy/pull/17897))

Documentation Updates

* Update config file documentation (sobolevn, PR [18103](https://github.com/python/mypy/pull/18103))
* Improve contributor documentation for Windows (ag-tafe, PR [18097](https://github.com/python/mypy/pull/18097))
* Correct note about `--disallow-any-generics` flag in documentation (Abel Sen, PR [18055](https://github.com/python/mypy/pull/18055))
* Further caution against `--follow-imports=skip` (Shantanu, PR [18048](https://github.com/python/mypy/pull/18048))
* Fix the edit page button link in documentation (Kanishk Pachauri, PR [17933](https://github.com/python/mypy/pull/17933))

Other Notables Fixes and Improvements

* Show `Protocol` `__call__` for arguments with incompatible types (MechanicalConstruct, PR [18214](https://github.com/python/mypy/pull/18214))
* Make join and meet symmetric with `strict_optional` (MechanicalConstruct, PR [18227](https://github.com/python/mypy/pull/18227))
* Preserve block unreachablility when checking function definitions with constrained TypeVars (Brian Schubert, PR [18217](https://github.com/python/mypy/pull/18217))
* Do not include non-init fields in the synthesized `__replace__` method for dataclasses (Victorien, PR [18221](https://github.com/python/mypy/pull/18221))
* Disallow `TypeVar` constraints parameterized by type variables (Brian Schubert, PR [18186](https://github.com/python/mypy/pull/18186))
* Always complain about invalid varargs and varkwargs (Shantanu, PR [18207](https://github.com/python/mypy/pull/18207))
* Set default strict_optional state to True (Shantanu, PR [18198](https://github.com/python/mypy/pull/18198))
* Preserve type variable default None in type alias (Sukhorosov Aleksey, PR [18197](https://github.com/python/mypy/pull/18197))
* Add checks for invalid usage of continue/break/return in `except*` block (coldwolverine, PR [18132](https://github.com/python/mypy/pull/18132))
* Do not consider bare TypeVar not overlapping with None for reachability analysis (Stanislav Terliakov, PR [18138](https://github.com/python/mypy/pull/18138))
* Special case `types.DynamicClassAttribute` as property-like (Stephen Morton, PR [18150](https://github.com/python/mypy/pull/18150))
* Disallow bare `ParamSpec` in type aliases (Brian Schubert, PR [18174](https://github.com/python/mypy/pull/18174))
* Move long_description metadata to pyproject.toml (Marc Mueller, PR [18172](https://github.com/python/mypy/pull/18172))
* Support `==`-based narrowing of Optional (Christoph Tyralla, PR [18163](https://github.com/python/mypy/pull/18163))
* Allow TypedDict assignment of Required item to NotRequired ReadOnly item (Brian Schubert, PR [18164](https://github.com/python/mypy/pull/18164))
* Allow nesting of Annotated with TypedDict special forms inside TypedDicts (Brian Schubert, PR [18165](https://github.com/python/mypy/pull/18165))
* Infer generic type arguments for slice expressions (Brian Schubert, PR [18160](https://github.com/python/mypy/pull/18160))
* Fix checking of match sequence pattern against bounded type variables (Brian Schubert, PR [18091](https://github.com/python/mypy/pull/18091))
* Fix incorrect truthyness for Enum types and literals (David Salvisberg, PR [17337](https://github.com/python/mypy/pull/17337))
* Move static project metadata to pyproject.toml (Marc Mueller, PR [18146](https://github.com/python/mypy/pull/18146))
* Fallback to stdlib json if integer exceeds 64-bit range (q0w, PR [18148](https://github.com/python/mypy/pull/18148))
* Fix 'or' pattern structural matching exhaustiveness (yihong, PR [18119](https://github.com/python/mypy/pull/18119))
* Fix type inference of positional parameter in class pattern involving builtin subtype (Brian Schubert, PR [18141](https://github.com/python/mypy/pull/18141))
* Fix `[override]` error with no line number when argument node has no line number (Brian Schubert, PR [18122](https://github.com/python/mypy/pull/18122))
* Fix some dmypy crashes (Ivan Levkivskyi, PR [18098](https://github.com/python/mypy/pull/18098))
* Fix subtyping between instance type and overloaded (Shantanu, PR [18102](https://github.com/python/mypy/pull/18102))
* Clean up new_semantic_analyzer config (Shantanu, PR [18071](https://github.com/python/mypy/pull/18071))
* Issue warning for enum with no members in stub (Shantanu, PR [18068](https://github.com/python/mypy/pull/18068))
* Fix enum attributes are not members (Terence Honles, PR [17207](https://github.com/python/mypy/pull/17207))
* Fix crash when checking slice expression with step 0 in tuple index (Brian Schubert, PR [18063](https://github.com/python/mypy/pull/18063))
* Allow union-with-callable attributes to be overridden by methods (Brian Schubert, PR [18018](https://github.com/python/mypy/pull/18018))
* Emit `[mutable-override]` for covariant override of attribute with method (Brian Schubert, PR [18058](https://github.com/python/mypy/pull/18058))
* Support ParamSpec mapping with `functools.partial` (Stanislav Terliakov, PR [17355](https://github.com/python/mypy/pull/17355))
* Fix approved stub ignore, remove normpath (Shantanu, PR [18045](https://github.com/python/mypy/pull/18045))
* Make `disallow-any-unimported` flag invertible (Séamus Ó Ceanainn, PR [18030](https://github.com/python/mypy/pull/18030))
* Filter to possible package paths before trying to resolve a module (falsedrow, PR [18038](https://github.com/python/mypy/pull/18038))
* Fix overlap check for ParamSpec types (Jukka Lehtosalo, PR [18040](https://github.com/python/mypy/pull/18040))
* Do not prioritize ParamSpec signatures during overload resolution (Stanislav Terliakov, PR [18033](https://github.com/python/mypy/pull/18033))
* Fix ternary union for literals (Ivan Levkivskyi, PR [18023](https://github.com/python/mypy/pull/18023))
* Fix compatibility checks for conditional function definitions using decorators (Brian Schubert, PR [18020](https://github.com/python/mypy/pull/18020))
* TypeGuard should be bool not Any when matching TypeVar (Evgeniy Slobodkin, PR [17145](https://github.com/python/mypy/pull/17145))
* Fix convert-cache tool (Shantanu, PR [17974](https://github.com/python/mypy/pull/17974))
* Fix generator comprehension with mypyc (Shantanu, PR [17969](https://github.com/python/mypy/pull/17969))
* Fix crash issue when using shadowfile with pretty (Max Chang, PR [17894](https://github.com/python/mypy/pull/17894))
* Fix multiple nested classes with new generics syntax (Max Chang, PR [17820](https://github.com/python/mypy/pull/17820))
* Better error for `mypy -p package` without py.typed (Joe Gordon, PR [17908](https://github.com/python/mypy/pull/17908))
* Emit error for `raise NotImplemented` (Brian Schubert, PR [17890](https://github.com/python/mypy/pull/17890))
* Add `is_lvalue` attribute to AttributeContext (Brian Schubert, PR [17881](https://github.com/python/mypy/pull/17881))

Acknowledgements

Thanks to all mypy contributors who contributed to this release:

- aatle
- Abel Sen
- Advait Dixit
- ag-tafe
- Alex Waygood
- Ali Hamdan
- Brian Schubert
- Carlton Gibson
- Chad Dombrova
- Chelsea Durazo
- chiri
- Christoph Tyralla
- coldwolverine
- David Salvisberg
- Ekin Dursun
- Evgeniy Slobodkin
- falsedrow
- Gaurav Giri
- Ihor
- Ivan Levkivskyi
- jairov4
- Jannick Kremer
- Jared Hance
- Jelle Zijlstra
- jianghuyiyuan
- Joe Gordon
- John Doknjas
- Jukka Lehtosalo
- Kanishk Pachauri
- Marc Mueller
- Max Chang
- MechanicalConstruct
- Newbyte
- q0w
- Ruslan Sayfutdinov
- Sebastian Rittau
- Shantanu
- sobolevn
- Stanislav Terliakov
- Stephen Morton
- Sukhorosov Aleksey
- Séamus Ó Ceanainn
- Terence Honles
- Valentin Stanciu
- vasiliy
- Victorien
- yihong

I’d also like to thank my employer, Dropbox, for supporting mypy development.

1.13

for improved performance. You can ensure the presence of `orjson` using the `faster-cache` extra:

 python3 -m pip install -U mypy[faster-cache]

Mypy may depend on `orjson` by default in the future.

These improvements were contributed by Shantanu.

List of changes:
* Significantly speed up file handling error paths (Shantanu, PR [17920](https://github.com/python/mypy/pull/17920))
* Use fast path in modulefinder more often (Shantanu, PR [17950](https://github.com/python/mypy/pull/17950))
* Let mypyc optimise os.path.join (Shantanu, PR [17949](https://github.com/python/mypy/pull/17949))
* Make is_sub_path faster (Shantanu, PR [17962](https://github.com/python/mypy/pull/17962))
* Speed up stubs suggestions (Shantanu, PR [17965](https://github.com/python/mypy/pull/17965))
* Use sha1 for hashing (Shantanu, PR [17953](https://github.com/python/mypy/pull/17953))
* Use orjson instead of json, when available (Shantanu, PR [17955](https://github.com/python/mypy/pull/17955))
* Add faster-cache extra, test in CI (Shantanu, PR [17978](https://github.com/python/mypy/pull/17978))

Acknowledgements
Thanks to all mypy contributors who contributed to this release:

- Shantanu Jain
- Jukka Lehtosalo

1.12.1

* Fix crash when showing partially analyzed type in error message (Ivan Levkivskyi, PR [17961](https://github.com/python/mypy/pull/17961))
* Fix iteration over union (when self type is involved) (Shantanu, PR [17976](https://github.com/python/mypy/pull/17976))
* Fix type object with type var default in union context (Jukka Lehtosalo, PR [17991](https://github.com/python/mypy/pull/17991))
* Revert change to `os.path` stubs affecting use of `os.PathLike[Any]` (Shantanu, PR [17995](https://github.com/python/mypy/pull/17995))

Acknowledgements
Thanks to all mypy contributors who contributed to this release:

- Ali Hamdan
- Anders Kaseorg
- Bénédikt Tran
- Brian Schubert
- bzoracler
- Chelsea Durazo
- Danny Yang
- Edgar Ramírez Mondragón
- Eric Mark Martin
- InSync
- Ivan Levkivskyi
- Jordandev678
- Katrina Connors
- Kirill Podoprigora
- Marc Mueller
- Max Muoto
- Max Murin
- Michael Carlstrom
- Michael I Chen
- Pradyun Gedam
- quinn-sasha
- Raphael Krupinski
- Sebastian Rittau
- Shantanu
- sobolevn
- Soubhik Kumar Mitra
- Stanislav Terliakov
- wyattscarpenter

I’d also like to thank my employer, Dropbox, for supporting mypy development.

1.12

We’ve just uploaded mypy 1.12 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)

Support for the new type parameter syntax introduced in Python 3.12 is now enabled by default,
documented, and no longer experimental. It was available through a feature flag in
mypy 1.11 as an experimental feature.

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]]


For more information, refer to the [documentation](https://mypy.readthedocs.io/en/latest/generics.html).

These improvements are included:

* Document Python 3.12 type parameter syntax (Jukka Lehtosalo, PR [17816](https://github.com/python/mypy/pull/17816))
* Further documentation updates (Jukka Lehtosalo, PR [17826](https://github.com/python/mypy/pull/17826))
* Allow Self return types with contravariance (Jukka Lehtosalo, PR [17786](https://github.com/python/mypy/pull/17786))
* Enable new type parameter syntax by default (Jukka Lehtosalo, PR [17798](https://github.com/python/mypy/pull/17798))
* Generate error if new-style type alias used as base class (Jukka Lehtosalo, PR [17789](https://github.com/python/mypy/pull/17789))
* Inherit variance if base class has explicit variance (Jukka Lehtosalo, PR [17787](https://github.com/python/mypy/pull/17787))
* Fix crash on invalid type var reference (Jukka Lehtosalo, PR [17788](https://github.com/python/mypy/pull/17788))
* Fix covariance of frozen dataclasses (Jukka Lehtosalo, PR [17783](https://github.com/python/mypy/pull/17783))
* Allow covariance with attribute that has "`_`" name prefix (Jukka Lehtosalo, PR [17782](https://github.com/python/mypy/pull/17782))
* Support `Annotated[...]` in new-style type aliases (Jukka Lehtosalo, PR [17777](https://github.com/python/mypy/pull/17777))
* Fix nested generic classes (Jukka Lehtosalo, PR [17776](https://github.com/python/mypy/pull/17776))
* Add detection and error reporting for the use of incorrect expressions within the scope of a type parameter and a type alias (Kirill Podoprigora, PR [17560](https://github.com/python/mypy/pull/17560))

Basic Support for Python 3.13

This release adds partial support for Python 3.13 features and compiled binaries for
Python 3.13. Mypyc now also supports Python 3.13.

In particular, these features are supported:
* Various new stdlib features and changes (through typeshed stub improvements)
* `typing.ReadOnly` (see below for more)
* `typing.TypeIs` (added in mypy 1.10, [PEP 742](https://peps.python.org/pep-0742/))
* Type parameter defaults when using the legacy syntax ([PEP 696](https://peps.python.org/pep-0696/))

These features are not supported yet:
* `warnings.deprecated` ([PEP 702](https://peps.python.org/pep-0702/))
* Type parameter defaults when using Python 3.12 type parameter syntax

Mypyc Support for Python 3.13

Mypyc now supports Python 3.13. This was contributed by Marc Mueller, with additional
fixes by Jukka Lehtosalo. Free threaded Python 3.13 builds are not supported yet.

List of changes:

* Add additional includes for Python 3.13 (Marc Mueller, PR [17506](https://github.com/python/mypy/pull/17506))
* Add another include for Python 3.13 (Marc Mueller, PR [17509](https://github.com/python/mypy/pull/17509))
* Fix ManagedDict functions for Python 3.13 (Marc Mueller, PR [17507](https://github.com/python/mypy/pull/17507))
* Update mypyc test output for Python 3.13 (Marc Mueller, PR [17508](https://github.com/python/mypy/pull/17508))
* Fix `PyUnicode` functions for Python 3.13 (Marc Mueller, PR [17504](https://github.com/python/mypy/pull/17504))
* Fix `_PyObject_LookupAttrId` for Python 3.13 (Marc Mueller, PR [17505](https://github.com/python/mypy/pull/17505))
* Fix `_PyList_Extend` for Python 3.13 (Marc Mueller, PR [17503](https://github.com/python/mypy/pull/17503))
* Fix `gen_is_coroutine` for Python 3.13 (Marc Mueller, PR [17501](https://github.com/python/mypy/pull/17501))
* Fix `_PyObject_FastCall` for Python 3.13 (Marc Mueller, PR [17502](https://github.com/python/mypy/pull/17502))
* Avoid uses of `_PyObject_CallMethodOneArg` on 3.13 (Jukka Lehtosalo, PR [17526](https://github.com/python/mypy/pull/17526))
* Don't rely on `_PyType_CalculateMetaclass` on 3.13 (Jukka Lehtosalo, PR [17525](https://github.com/python/mypy/pull/17525))
* Don't use `_PyUnicode_FastCopyCharacters` on 3.13 (Jukka Lehtosalo, PR [17524](https://github.com/python/mypy/pull/17524))
* Don't use `_PyUnicode_EQ` on 3.13, as it's no longer exported (Jukka Lehtosalo, PR [17523](https://github.com/python/mypy/pull/17523))

Inferring Unions for Conditional Expressions

Mypy now always tries to infer a union type for a conditional expression if left and right
operand types are different. This results in more precise inferred types and lets mypy detect
more issues. Example:

python
s = "foo" if cond() else 1
Type of "s" is now "str | int" (it used to be "object")


Notably, if one of the operands has type `Any`, the type of a conditional expression is
now `<type> | Any`. Previously the inferred type was just `Any`. The new type essentially
indicates that the value can be of type `<type>`, and potentially of some (unknown) type.
Most operations performed on the result must also be valid for `<type>`.
Example where this is relevant:

python
from typing import Any

def func(a: Any, b: bool) -> None:
 x = a if b else None
  Type of x is "Any | None"
 print(x.y)   Error: None has no attribute "y"


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

ReadOnly Support for TypedDict (PEP 705)

You can now use `typing.ReadOnly` to specity TypedDict items as
read-only ([PEP 705](https://peps.python.org/pep-0705/)):

python
from typing import TypedDict

Or "from typing ..." on Python 3.13
from typing_extensions import ReadOnly

class TD(TypedDict):
 a: int
 b: ReadOnly[int]

d: TD = {"a": 1, "b": 2}
d["a"] = 3   OK
d["b"] = 5   Error: "b" is ReadOnly


This feature was contributed by Nikita Sobolev (PR [17644](https://github.com/python/mypy/pull/17644)).

Python 3.8 End of Life Approaching

We are planning to drop support for Python 3.8 in the next mypy feature release or the
one after that. Python 3.8 reaches end of life in October 2024.

Planned Changes to Defaults

We are planning to enable `--local-partial-types` by default in mypy 2.0. This will
often require at least minor code changes. This option is implicitly enabled by mypy
daemon, so this makes the behavior of daemon and non-daemon modes consistent.

We recommend that mypy users start using local partial types soon (or to explicitly disable
them) to prepare for the change.

This can also be configured in a mypy configuration file:


local_partial_types = True


For more information, refer to the
[documentation](https://mypy.readthedocs.io/en/stable/command_line.html#cmdoption-mypy-local-partial-types).

Documentation Updates

Mypy documentation now uses modern syntax variants and imports in many examples. Some
examples no longer work on Python 3.8, which is the earliest Python version that mypy supports.

Notably, `Iterable` and other protocols/ABCs are imported from `collections.abc` instead of
`typing`:
python
from collections.abc import Iterable, Callable


Examples also avoid the upper-case aliases to built-in types: `list[str]` is used instead
of `List[str]`. The `X | Y` union type syntax introduced in Python 3.10 is also now prevalent.

List of documentation updates:

* Document `--output=json` CLI option (Edgar Ramírez Mondragón, PR [17611](https://github.com/python/mypy/pull/17611))
* Update various references to deprecated type aliases in docs (Jukka Lehtosalo, PR [17829](https://github.com/python/mypy/pull/17829))
* Make "X | Y" union syntax more prominent in documentation (Jukka Lehtosalo, PR [17835](https://github.com/python/mypy/pull/17835))
* Discuss upper bounds before self types in documentation (Jukka Lehtosalo, PR [17827](https://github.com/python/mypy/pull/17827))
* Make changelog visible in mypy documentation (quinn-sasha, PR [17742](https://github.com/python/mypy/pull/17742))
* List all incomplete features in `--enable-incomplete-feature` docs (sobolevn, PR [17633](https://github.com/python/mypy/pull/17633))
* Remove the explicit setting of a pygments theme (Pradyun Gedam, PR [17571](https://github.com/python/mypy/pull/17571))
* Document ReadOnly with TypedDict (Jukka Lehtosalo, PR [17905](https://github.com/python/mypy/pull/17905))
* Document TypeIs (Chelsea Durazo, PR [17821](https://github.com/python/mypy/pull/17821))

Experimental Inline TypedDict Syntax

Mypy now supports a non-standard, experimental syntax for defining anonymous TypedDicts.
Example:

python
def func(n: str, y: int) -> {"name": str, "year": int}:
 return {"name": n, "year": y}


The feature is disabled by default. Use `--enable-incomplete-feature=InlineTypedDict` to
enable it. *We might remove this feature in a future release.*

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

## Summary by Sourcery

Update pytest to 8.3.4, opencensus to 0.11.4, black to 24.10.0, grpcio to 1.69.0, and mypy to 1.14.1.

Copy link

sourcery-ai bot commented Jan 20, 2025

Reviewer's Guide by Sourcery

This pull request updates several development and release dependencies. The most significant updates are to pytest, opencensus, black, grpcio, and mypy. These updates include bug fixes, performance improvements, and new features.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Updated pytest from 7.1.2 to 8.3.4.
  • Updated pytest version in requirements/dev.txt.
requirements/dev.txt
Updated opencensus from 0.9.0 to 0.11.4.
  • Updated opencensus version in requirements/release.txt.
  • This update includes changes to httpx and fastapi integrations, as well as updates to azure, context, flask, and requests modules.
requirements/release.txt
Updated black from 22.3.0 to 24.10.0.
  • Updated black version in requirements/dev.txt.
  • This update includes support for Python 3.13, fixes for crashes involving comments and f-strings, and performance improvements.
  • It also includes a fix for a security vulnerability (CVE-2024-21503).
requirements/dev.txt
Updated grpcio from 1.46.3 to 1.69.0.
  • Updated grpcio version in requirements/release.txt.
requirements/release.txt
Updated mypy from 0.960 to 1.14.1.
  • Updated mypy version in requirements/dev.txt.
  • This update includes changes to enum membership semantics, support for deprecated decorators, and the ability to analyze untyped modules.
  • It also includes support for new style type variable defaults and improved for loop index variable type narrowing.
requirements/dev.txt

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time. You can also use
    this command to specify where the summary should be inserted.

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have skipped reviewing this pull request. It seems to have been created by a bot (hey, pyup-bot!). We assume it knows what it's doing!

@pyup-bot
Copy link
Collaborator Author

Closing this in favor of #178

@pyup-bot pyup-bot closed this Jan 27, 2025
@amor71 amor71 deleted the pyup/scheduled-update-2025-01-20 branch January 27, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants