We’ve just uploaded mypy 1.10 to the Python Package Index (PyPI). 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.
Support TypeIs (PEP 742)
Mypy now supports TypeIs (PEP 742), which allows
functions to narrow the type of a value, similar to isinstance(). Unlike TypeGuard,
TypeIs can narrow in both the if and else branches of an if statement:
#12069: A deprecation warning is now raised when implementations of one of the following hooks request a deprecated py.path.local parameter instead of the pathlib.Path parameter which replaced it:
pytest_ignore_collect{.interpreted-text role="hook"} - the path parameter - use collection_path instead.
pytest_collect_file{.interpreted-text role="hook"} - the path parameter - use file_path instead.
pytest_pycollect_makemodule{.interpreted-text role="hook"} - the path parameter - use module_path instead.
pytest_report_header{.interpreted-text role="hook"} - the startdir parameter - use start_path instead.
pytest_report_collectionfinish{.interpreted-text role="hook"} - the startdir parameter - use start_path instead.
The replacement parameters are available since pytest 7.0.0.
The old parameters will be removed in pytest 9.0.0.
See legacy-path-hooks-deprecated{.interpreted-text role="ref"} for more details.
Features
#11871: Added support for reading command line arguments from a file using the prefix character @, like e.g.: pytest @tests.txt. The file must have one argument per line.
See Read arguments from file <args-from-file>{.interpreted-text role="ref"} for details.
Improvements
#11523: pytest.importorskip{.interpreted-text role="func"} will now issue a warning if the module could be found, but raised ImportError{.interpreted-text role="class"} instead of ModuleNotFoundError{.interpreted-text role="class"}.
The warning can be suppressed by passing exc_type=ImportError to pytest.importorskip{.interpreted-text role="func"}.
See import-or-skip-import-error{.interpreted-text role="ref"} for details.
#11728: For unittest-based tests, exceptions during class cleanup (as raised by functions registered with TestCase.addClassCleanup <unittest.TestCase.addClassCleanup>{.interpreted-text role="meth"}) are now reported instead of silently failing.
#11777: Text is no longer truncated in the short test summary info section when -vv is given.
#12112: Improved namespace packages detection when consider_namespace_packages{.interpreted-text role="confval"} is enabled, covering more situations (like editable installs).
#9502: Added PYTEST_VERSION{.interpreted-text role="envvar"} environment variable which is defined at the start of the pytest session and undefined afterwards. It contains the value of pytest.__version__, and among other things can be used to easily check if code is running from within a pytest run.
Bug Fixes
#12065: Fixed a regression in pytest 8.0.0 where test classes containing setup_method and tests using @staticmethod or @classmethod would crash with AttributeError: 'NoneType' object has no attribute 'setup_method'.
Now the request.instance <pytest.FixtureRequest.instance>{.interpreted-text role="attr"} attribute of tests using @staticmethod and @classmethod is no longer None, but a fresh instance of the class, like in non-static methods.
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_>.
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_.
Improve best_match (and thereby error messages from jsonschema.validate) in cases where there are multiple sibling errors from applying anyOf / allOf -- i.e. when multiple elements of a JSON array have errors, we now do prefer showing errors from earlier elements rather than simply showing an error for the full array (#1250).
(Micro-)optimize equality checks when comparing for JSON Schema equality by first checking for object identity, as == would.
Improve best_match (and thereby error messages from jsonschema.validate) in cases where there are multiple sibling errors from applying anyOf / allOf -- i.e. when multiple elements of a JSON array have errors, we now do prefer showing errors from earlier elements rather than simply showing an error for the full array (#1250).
(Micro-)optimize equality checks when comparing for JSON Schema equality by first checking for object identity, as == would.
Commits
9882dbe Add / ignore the new specification test suite property.
Allow poetry plugin with empty command prefix to run tasks included from another file by @nat-n in nat-n/poethepoet#216
Breaking changes
Relative paths for envfiles imported from within an included tasks file will now be resolved relative to the cwd path configured on the include (if any) nat-n/poethepoet#160
╭────────── FastAPI CLI - Development mode ───────────╮
│ │
│ Serving at: http://127.0.0.1:8000 │
│ │
│ API docs: http://127.0.0.1:8000/docs │
│ │
│ Running in development mode, for production use: │
│ │
│ fastapi run │
│ │
╰─────────────────────────────────────────────────────╯
INFO: Will watch for changes in these directories: ['/home/user/code/awesomeapp']
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
INFO: Started reloader process [2248755] using WatchFiles
INFO: Started server process [2248757]
INFO: Waiting for application startup.
INFO: Application startup complete.
Refactors
🔧 Add configs and setup for fastapi-slim including optional extras fastapi-slim[standard], and fastapi including by default the same standard extras. PR #11503 by @tiangolo.
0.110.3
Latest Changes
Docs
📝 Update references to Python version, FastAPI supports all the current versions, no need to make the version explicit. PR #11496 by @tiangolo.
✏️ Fix typo in fastapi/security/api_key.py. PR #11481 by @ch33zer.
Sphinx 7.3.0 and above changed caching and serialization checks. Now instead of passing
instantiated classes like ResetArgv(), classes like FileNameSortKey, or
callables like notebook_modification_function in sphinx_gallery_conf,
you should pass fully qualified name strings to classes or callables. If you change
to using name strings, you can simply use a function as the use of classes to ensure
a stable __repr__ would be redundant.
Dependabot tried to update this pull request, but something went wrong. We're looking into it, but in the meantime you can retry the update by commenting @dependabot rebase.
Bumps the deps group with 11 updates in the / directory:
4.17.0
4.18.0
1.9.0
1.10.0
8.1.1
8.2.0
7.4.3
7.5.1
4.21.1
4.22.0
0.70.0
0.71.0
0.25.0
0.26.1
1.34.0
1.35.0
0.110.0
0.111.0
1.33.0
1.34.0
0.15.0
0.16.0
Updates
pytelegrambotapi
from 4.17.0 to 4.18.0Commits
d9c4abe
Merge pull request #2264 from Badiboy/master3532812
Split out the class ChatFullInfo from the class Chat and changed the return t...9a3d048
Suppress some warnings (not for BotAPI 7.3)25241c4
Added the classes ChatBackground, BackgroundType, BackgroundFill and the fiel...f75814b
Fix copy_message (not for BotAPI 7.3) u1cad5025
Fix copy_message (not for BotAPI 7.3)2c9aa1d
Added the class InputPollOption and changed the type of the parameter options...0e45ef5
Added the parameters question_parse_mode and question_entities to the method ...9c64ad2
Added the parameters question_parse_mode and question_entities to the method ...4bee6ff
Added the field questiAdded the field question_entities to the class Poll.on_...Updates
mypy
from 1.9.0 to 1.10.0Changelog
Sourced from mypy's changelog.
... (truncated)
Commits
3faf0fc
Remove +dev for version for release 1.10a5998d2
Update CHANGELOG.md (#17159)62ea5b0
Various updates to changelog for 1.10 (#17158)2f0864c
Update CHANGELOG.md with draft for release 1.10 (#17150)e1443bb
fix: incorrect returned type of access descriptors on unions of types (#16604)5161ac2
Sync typeshed (#17124)e2fc1f2
Fix crash when expanding invalid Unpack in aCallable
alias (#17028)3ff6e47
Docs: docstrings in checker.py, ast_helpers.py (#16908)732d98e
Fix string formatting for string enums (#16555)8019010
Narrow individual items when matching a tuple to a sequence pattern (#16905)Updates
pytest
from 8.1.1 to 8.2.0Release notes
Sourced from pytest's releases.
... (truncated)
Commits
6bd3f31
Tweak changelog for 8.2.09b6219b
Prepare release version 8.2.0835765c
Merge pull request #12130 from bluetech/fixtures-inline7e7503c
unittest: report class cleanup exceptions (#12250)882c4da
fixtures: inlinefail_fixturefunc
2e8fb9f
fixtures: extract a_check_fixturedef
methodacf2971
fixtures: inline_getnextfixturedef
into_get_active_fixturedef
3c77aec
fixtures: move "request" check earlyd217d68
fixtures: inline_compute_fixture_value
530be28
fixtures: use early return in_get_active_fixturedef
Updates
coverage
from 7.4.3 to 7.5.1Changelog
Sourced from coverage's changelog.
... (truncated)
Commits
be938ea
docs: sample HTML for 7.5.102c66d7
docs: prep for 7.5.15fa9f67
fix: avoid max recursion errors in ast code. #177434af01d
build: easier to run metasmoke on desired python version6b0cac5
perf: cache _human_key to speed html report by about 10%fdc0ee8
docs: oops, typo60e6cb4
docs: changelog for #754 and #1773277c8c4
fix: '# pragma: no branch' in multiline if statements. #754 (#1773)34d3eb7
docs: update changelog for #1786. Thanks, Daniel Diniz2bb5ef2
fix(html): make HTML column sorting consistent across index pages (fix #1766)...Updates
jsonschema
from 4.21.1 to 4.22.0Release notes
Sourced from jsonschema's releases.
Changelog
Sourced from jsonschema's changelog.
Commits
9882dbe
Add / ignore the new specification test suite property.ebc90bb
Merge commit '8fcfc3a674a7188a4fcc822b7a91efb3e0422a20'8fcfc3a
Squashed 'json/' changes from b41167c74..54f3784a830b7537
Pin pyenchant to pre from below until pyenchant/pyenchant#302 is released.c3729db
Enable doctests for the rest of the referencing page.70a994c
Remove a now-unneeded noqa since apparently this is fixed in new ruff.e6d0ef1
Fix a minor typo in the referencing example docs.bceaf41
Another placeholder benchmark for future optimization.b20234e
Consider errors from earlier indices (in instances) to be better matches41b49c6
Minor improvement to test failure message when a best match test fails.Updates
python-on-whales
from 0.70.0 to 0.71.0Release notes
Sourced from python-on-whales's releases.
Commits
6ef2cc9
Bump version to 0.71.04a74fd8
Docker Buildx Pruning Logs Streaming (#578)de46667
Added timezone argument to run and create (#579)0a9edc5
:sparkles: Support podman's--preserve-fds
arg to container run/exec (#576)4e0c80c
Emit aDeprecationWarning
when downloading the docker client (#577)a10959c
feat: Add--wait-timeout
option fordocker.compose.up
(#573)ac0e53b
Fix time argument formatting to include time zone (#574)32770a1
:sparkles: Make docker.compose.down accept an optional list of service names ...a8714e4
Update cli_wrapper.py (#572)070bf6e
:sparkles: Add stream output for pruning containers (#566)Updates
poethepoet
from 0.25.0 to 0.26.1Release notes
Sourced from poethepoet's releases.
Commits
4b66184
Bump version to 0.26.10cb96ca
Fix faulty validation of subtask names in sequence tasks (#219)0bd2a08
Bump version to 0.26.04409ef2
Add passing test for #198edb3383
Allow poetry plugin with empty command prefix to run tasks included from anot...6016f30
Add POE_PROJECT_DIR env var as default for -C option (#215)57ea176
Use -C and --directory for pyproject.toml directory path (#213)583e12b
Major refactor of config classes and config include logic (#214)152f687
Bump version to 0.25.1262017f
Make poetry plugin work with the --directory option on the poetry cli (#211)Updates
telethon
from 1.34.0 to 1.35.0Commits
d77ac18
Bump to v1.358137b12
Fix readthedocs requirements10a6d16
Update to layer 1783ac11e1
Fix get_messages type hint (#4357)3625bf8
Fix get_entity type hint (#4352)d3a201a
Fix regression on supported Python version (#4347)49a8f11
Add missing attributes to Message (#4346)723fbd5
Update to layer 17726aa178
Handle FileReferenceExpiredError during download9f3e7e4
Fix TelegramClient init with None session (#4339)Updates
fastapi
from 0.110.0 to 0.111.0Release notes
Sourced from fastapi's releases.
... (truncated)
Commits
1c3e691
📝 Update release notesab8f557
📝 Update release notes67da3bb
🔖 Release version 0.111.09ed94e4
📝 Update release notesd71be59
✨ Add FastAPI CLI, the newfastapi
command (#11522)a94ef33
📝 Update release notesea1f219
🔧 Add configs and setup forfastapi-slim
including optional extras `fastapi...32be95d
🔖 Release version 0.110.392b67b1
📝 Update release notese0a9692
📝 Update release notesUpdates
streamlit
from 1.33.0 to 1.34.0Release notes
Sourced from streamlit's releases.
Commits
bddd5e8
Up version to 1.34.0be16876
Docstrings for 1.34.0 (#8588)a8a5f9b
Fix broken python github actions (#8580)7266453
Enable the usage of the pydeck-carto package with st.pydeck_chart (#8422)64a3459
Bump axios from 0.27.2 to 1.6.8 in /frontend (#8567)43e7a7c
Add support for Modin and Snowpark Pandas (#8506)7b9f046
Non-emoji icons (#8307)c9de002
Fix empty generator usage withst.write_stream
(#8560)940bd5d
Support background colors for text (#8435)2b3b22c
Add support for autoplayingst.audio
andst.video
media (#8481)Updates
sphinx-gallery
from 0.15.0 to 0.16.0Release notes
Sourced from sphinx-gallery's releases.
... (truncated)
Commits
f87e6d3
MAINT version 0.16 (#1296)2120054
ENH: Allow plain list as subsection_order and support a wildcard (#1295)f0e716e
BUG: Fix serialization with Sphinx 7.3 (#1289)0b243bf
[pre-commit.ci] pre-commit autoupdate (#1294)0790260
readme: adding quickstart section (#1291)8af7edb
DOC Update FFMpeg note in conf animation docs (#1292)Dependabot tried to update this pull request, but something went wrong. We're looking into it, but in the meantime you can retry the update by commenting
@dependabot rebase
.Looks like these dependencies are updatable in another way, so this is no longer needed.