Ruff's new parser is >2x faster, which translates to a 20-40% speedup for all linting and formatting invocations. There's a lot to say about this exciting change, so check out the blog post for more details!
With this release, we also want to highlight our new language server. ruff server is a Rust-powered language server that comes built-in with Ruff. It can be used with any editor that supports the Language Server Protocol (LSP). It uses a multi-threaded, lock-free architecture inspired by rust-analyzer and it will open the door for a lot of exciting features. It’s also faster than our previous Python-based language server -- but you probably guessed that already.
ruff server is only in alpha, but it has a lot of features that you can try out today:
Lints Python files automatically and shows quick-fixes when available
Formats Python files, with support for range formatting
Comes with commands for quickly performing actions: ruff.applyAutofix, ruff.applyFormat, and ruff.applyOrganizeImports
Supports source.fixAll and source.organizeImports source actions
Automatically reloads your project configuration when you change it
To setup ruff server with your editor, refer to the README.md.
Preview features
[pycodestyle] Do not trigger E3 rules on defs following a function/method with a dummy body (#10704)
[pylint] Allow NoReturn-like functions for __str__, __len__, etc. (PLE0307) (#11017)
Parser: Use empty range when there's "gap" in token source (#11032)
[ruff] Ignore stub functions in unused-async (RUF029) (#11026)
Parser: Expect indented case block instead of match stmt (#11033)
0.4.0
A new, hand-written parser
Ruff's new parser is >2x faster, which translates to a 20-40% speedup for all linting and formatting invocations.
There's a lot to say about this exciting change, so check out the blog post for more details!
With this release, we also want to highlight our new language server. ruff server is a Rust-powered language
server that comes built-in with Ruff. It can be used with any editor that supports the Language Server Protocol (LSP).
It uses a multi-threaded, lock-free architecture inspired by rust-analyzer and it will open the door for a lot
of exciting features. It’s also faster than our previous Python-based language server
-- but you probably guessed that already.
ruff server is only in alpha, but it has a lot of features that you can try out today:
Lints Python files automatically and shows quick-fixes when available
Formats Python files, with support for range formatting
Comes with commands for quickly performing actions: ruff.applyAutofix, ruff.applyFormat, and ruff.applyOrganizeImports
Supports source.fixAll and source.organizeImports source actions
Automatically reloads your project configuration when you change it
To setup ruff server with your editor, refer to the README.md.
Preview features
[pycodestyle] Do not trigger E3 rules on defs following a function/method with a dummy body (#10704)
This release is not a usual bug fix release -- it contains features and improvements, being a follow up
to 8.1.0, which has been yanked from PyPI.
:::
Features
#11475: Added the new consider_namespace_packages{.interpreted-text role="confval"} configuration option, defaulting to False.
If set to True, pytest will attempt to identify modules that are part of namespace packages when importing modules.
#11653: Added the new verbosity_test_cases{.interpreted-text role="confval"} configuration option for fine-grained control of test execution verbosity.
See Fine-grained verbosity <pytest.fine_grained_verbosity>{.interpreted-text role="ref"} for more details.
Improvements
#10865: pytest.warns{.interpreted-text role="func"} now validates that warnings.warn{.interpreted-text role="func"} was called with a [str]{.title-ref} or a [Warning]{.title-ref}.
Currently in Python it is possible to use other types, however this causes an exception when warnings.filterwarnings{.interpreted-text role="func"} is used to filter those warnings (see [CPython #103577](python/cpython#103577) for a discussion).
While this can be considered a bug in CPython, we decided to put guards in pytest as the error message produced without this check in place is confusing.
#11311: When using --override-ini for paths in invocations without a configuration file defined, the current working directory is used
as the relative directory.
Previoulsy this would raise an AssertionError{.interpreted-text role="class"}.
#11475: --import-mode=importlib <import-mode-importlib>{.interpreted-text role="ref"} now tries to import modules using the standard import mechanism (but still without changing :pysys.path{.interpreted-text role="data"}), falling back to importing modules directly only if that fails.
This means that installed packages will be imported under their canonical name if possible first, for example app.core.models, instead of having the module name always be derived from their path (for example .env310.lib.site_packages.app.core.models).
#11801: Added the iter_parents() <_pytest.nodes.Node.iter_parents>{.interpreted-text role="func"} helper method on nodes.
It is similar to listchain <_pytest.nodes.Node.listchain>{.interpreted-text role="func"}, but goes from bottom to top, and returns an iterator, not a list.
#11850: Added support for sys.last_exc{.interpreted-text role="data"} for post-mortem debugging on Python>=3.12.
#11962: In case no other suitable candidates for configuration file are found, a pyproject.toml (even without a [tool.pytest.ini_options] table) will be considered as the configuration file and define the rootdir.
#11978: Add --log-file-mode option to the logging plugin, enabling appending to log-files. This option accepts either "w" or "a" and defaults to "w".
Previously, the mode was hard-coded to be "w" which truncates the file before logging.
Removed support for xdist rsync (now deprecated).
Contributed by Matthias Reichenbach in [#623](https://github.com/pytest-dev/pytest-cov/issues/623) <https://github.com/pytest-dev/pytest-cov/pull/623>_.
Switched docs theme to Furo.
Various legacy Python cleanup and CI improvements.
Contributed by Christian Clauss and Hugo van Kemenade in
[#630](https://github.com/pytest-dev/pytest-cov/issues/630) <https://github.com/pytest-dev/pytest-cov/pull/630>,
[#631](https://github.com/pytest-dev/pytest-cov/issues/631) <https://github.com/pytest-dev/pytest-cov/pull/631>,
[#632](https://github.com/pytest-dev/pytest-cov/issues/632) <https://github.com/pytest-dev/pytest-cov/pull/632>_ and
[#633](https://github.com/pytest-dev/pytest-cov/issues/633) <https://github.com/pytest-dev/pytest-cov/pull/633>_.
Added a pyproject.toml example in the docs.
Contributed by Dawn James in [#626](https://github.com/pytest-dev/pytest-cov/issues/626) <https://github.com/pytest-dev/pytest-cov/pull/626>_.
Modernized project's pre-commit hooks to use ruff. Initial POC contributed by
Christian Clauss in [#584](https://github.com/pytest-dev/pytest-cov/issues/584) <https://github.com/pytest-dev/pytest-cov/pull/584>_.
As of v0.23, pytest-asyncio attaches an asyncio event loop to each item of the test suite (i.e. session, packages, modules, classes, functions) and allows tests to be run in those loops when marked accordingly. Pytest-asyncio currently assumes that async fixture scope is correlated with the new event loop scope. This prevents fixtures from being evaluated independently from the event loop scope and breaks some existing test suites (see #706). For example, a test suite may require all fixtures and tests to run in the same event loop, but have async fixtures that are set up and torn down for each module. If you're affected by this issue, please continue using the v0.21 release, until it is resolved.
Fix typing errors with recent versions of mypy #769
Prevent DeprecationWarning about internal use of asyncio.get_event_loop() from affecting test cases #757
Known issues
As of v0.23, pytest-asyncio attaches an asyncio event loop to each item of the test suite (i.e. session, packages, modules, classes, functions) and allows tests to be run in those loops when marked accordingly. Pytest-asyncio currently assumes that async fixture scope is correlated with the new event loop scope. This prevents fixtures from being evaluated independently from the event loop scope and breaks some existing test suites (see #706). For example, a test suite may require all fixtures and tests to run in the same event loop, but have async fixtures that are set up and torn down for each module. If you're affected by this issue, please continue using the v0.21 release, until it is resolved.
Commits
c34da04 [docs] Mentioned pytest 8.2 compatibility fix in changelog.
143f745 Fix compatibility with pytest 8.2 FixtureDef.unittest removal
Docker Digest for 5.0.5: sha256:b95cf0d65557475f29e7256938028eef352e23acafe8e07c071cd58b67c44708
General:
* DynamoDB: scan() now returns items in a alphabetical order
New Methods:
* SecretsManager:
* batch_get_secret_value()
Miscellaneous:
* ApplicationAutoscaling: put_scaling_policy() now generates CW alarms for DynamoDB and ECS
* DynamoDB: Fix pagination for scan()/query()
* DynamoDB: batch_write_item() now validates for duplicate DELETE or PUT requests
* Events: put_events() now validates that input-values cannot be empty
* IOT: create_topic_rule() now validates name-format
* ResourceGroupsTaggingAPI: tag_resources() now supports RDS snapshots
* SFN: Fixed a bug where the executionInput was double encoded
5.0.4
Docker Digest for 5.0.4: sha256:e13e917e563bd1e3bb745b0ce914bdcc3bd4577542e13e1468eac5078774b2aa
General:
* Lambda: The results of a Dockerless invocation can now be configured.
See http://docs.getmoto.org/en/latest/docs/services/lambda.html
* StepFunctions can now execute the provided StepFunctionMachine (opt-in), instead of returning static data (still the default).
See http://docs.getmoto.org/en/latest/docs/services/stepfunctions.html
New Service:
* ElastiCache:
* list_tags_for_resource()
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself)
- `@dependabot ignore minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself)
- `@dependabot ignore ` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself)
- `@dependabot unignore ` will remove all of the ignore conditions of the specified dependency
- `@dependabot unignore ` will remove the ignore condition of the specified dependency and ignore conditions
Bumps the python-packages group with 10 updates:
0.2.1
0.4.1
7.4.4
8.1.1
4.1.0
5.0.0
0.12.3
0.12.4
7.0.1
7.1.0
0.20.2
0.21.1
0.23.5
0.23.6
5.0.2
5.0.5
0.2.1
0.3.1
3.6.2
3.7.0
Updates
ruff
from 0.2.1 to 0.4.1Release notes
Sourced from ruff's releases.
... (truncated)
Changelog
Sourced from ruff's changelog.
... (truncated)
Commits
0ff25a5
Bump version to 0.4.1 (#11035)34873ec
Add a script to fuzz the parser (courtesy ofpysource-codegen
) (#11015)d3cd61f
Use empty range when there's "gap" in token source (#11032)9b80cc0
Select fewer ruff rules when linting Python files inscripts/
(#11034)9bb23b0
Expect indented case block instead of match stmt (#11033)06c248a
[ruff]
Ignore stub functions inunused-async
(RUF029
) (#11026)27902b7
[pylint
] Implementinvalid-index-returned
(PLE0305
) (#10962)97acf1d
ENH: Bumpruff
dependency versions to support the latest release of `v0.4.0...adf63d9
[pylint
] Implementinvalid-hash-returned
(PLE0309
) (#10961)5d3c9f2
ruff server
: fix Neovim setup guide command (#11021)Updates
pytest
from 7.4.4 to 8.1.1Release notes
Sourced from pytest's releases.
... (truncated)
Commits
81653ee
Adjust changelog manually for 8.1.1e60b4b9
Prepare release version 8.1.115fbe57
[8.1.x] Revert legacy path removals (#12093)86c3aab
[8.1.x] Do not import duplicated modules with --importmode=importlib (#12077)5b82b0c
[8.1.x] Yank version 8.1.0 (#12076)0a53681
Merge pull request #12054 from pytest-dev/release-8.1.0b9a167f
Prepare release version 8.1.000043f7
Merge pull request #12038 from bluetech/fixtures-rm-arg2indexf4e1025
Merge pull request #12048 from bluetech/fixture-teardown-excgroup43492f5
Merge pull request #12051 from jakkdl/test_debugging_pythonbreakpointUpdates
pytest-cov
from 4.1.0 to 5.0.0Changelog
Sourced from pytest-cov's changelog.
Commits
5295ce0
Bump version: 4.1.0 → 5.0.01181b06
Update changelog.9757222
Fix a minor grammar error (#636)9f5cd81
Cleanup releasing instructions. Closes #616.93b5047
Add test for pyproject.toml loading without explicit --cov-config. Ref #508.ff50860
docs: add config instructions for pyproject.toml.4a5a4b5
Keep GitHub Actions up to date with GitHub's Dependabot1d7f559
Fix or remove URLs that are causing docs tests to fail6a5af8e
Update changelog.d9fe8df
Switch to furo. Closes #618.Updates
tomlkit
from 0.12.3 to 0.12.4Release notes
Sourced from tomlkit's releases.
Changelog
Sourced from tomlkit's changelog.
Commits
911cccd
chore: release 0.12.4712dba7
fix: -1 index error when setting dotted keyFixes #332Signed-off-by: Frost Min...0c2c30d
fix:|=
does not work as expected on TOMLDocumentFixes #331Signed-off-by: F...a3ed6a1
chore(deps-dev): bump jinja2 from 3.1.2 to 3.1.3 (#329)b963483
fix: indent exist check before accessing its property (#328)Updates
importlib-metadata
from 7.0.1 to 7.1.0Changelog
Sourced from importlib-metadata's changelog.
Commits
f5d6b5f
Finalize2ef3b5f
Merge commit '1711b2c198'1711b2c
Need to include names from test.support for py312 compat.47b14ac
Make MetadataPathFinder.find_distributions a classmethod for consistency with...adc4b12
Ensure tests do not leak references in sys.modules.07d894d
Copy backport of isolated_modules from importlib_resources.e30a16d
Consolidated test support logic in jaraco.test.cpython.41ca039
Moved compatibility tests to the compat package, as they're not included in C...5950f43
Remove legacy logic for Python 3.7.ffa719b
Moved compatibility module to compat package.Updates
respx
from 0.20.2 to 0.21.1Release notes
Sourced from respx's releases.
Changelog
Sourced from respx's changelog.
Commits
1f55faa
Release 0.21.14237976
Fix files pattern not handlingstr
andBytesIO
(#260)de7a983
Add support forNone
values in data pattern (#259)15522db
Release 0.21.0e565cdf
Enhance docs on named routes and catch-all route (#257)3c35da1
Enhance docs on iterable side effects (#255)e97b677
AddSetCookie
utility (#254)24ee4a9
Addfiles
pattern (#253)07ae887
Add python 3.12 to CI4bc9c5d
Fix matching request data when files are provided (#252)Updates
pytest-asyncio
from 0.23.5 to 0.23.6Release notes
Sourced from pytest-asyncio's releases.
Commits
c34da04
[docs] Mentioned pytest 8.2 compatibility fix in changelog.143f745
Fix compatibility with pytest 8.2 FixtureDef.unittest removal13d4b79
Remove unused function_removesuffix
cdd2c49
UseFixtureRequest
instead ofSubRequest
c3429fa
Build(deps): Bump packaging from 23.2 to 24.0 in /dependencies/docs5f2338d
Build(deps): Bump pypa/gh-action-pypi-publish from 1.8.12 to 1.8.14726c6e0
Build(deps): Bump coverage from 7.4.3 to 7.4.4 in /dependencies/default8bd8288
Build(deps): Bump pytest from 8.0.2 to 8.1.1 in /dependencies/defaultef3b347
Build(deps): Bump packaging from 23.2 to 24.0 in /dependencies/defaultb22d84e
[docs] Fixes the example showing how to run all tests in a session-scoped loop.Updates
moto
from 5.0.2 to 5.0.5Changelog
Sourced from moto's changelog.
... (truncated)
Commits
af6bc3a
Prep release 5.0.5 (#7574)32e187f
Feature: ResourceGroupsTaggingAPI: add tags for RDS snapshot (#7565)3f121df
ResourceGroupsTaggingAPI: Fix Workspaces access in unsupported region (#7569)5c1d1d0
fix(cognito-idp): avoid KeyError on unexisting refresh token (#7563)7fcea4a
Admin: Update py-partiql dependency (#7573)24fe459
IOT: create_topic_rule() now validates name-format (#7572)5ed366d
IOTData: Fix typing (#7568)d6948ff
SFN: Input for mock should be the same as input for parser (#7567)cb66217
ApplicationAutoscaling: put_scaling_policy() now generates CW alarms (for som...7289a6c
CloudWatch: Improve typing/docs (#7560)Updates
pytest-ruff
from 0.2.1 to 0.3.1Commits
9efc242
fix: pytest 8.1 compat (#16)41ec4c4
Silence some deprecation warnings for Python 3.14ef9d0e0
Fail tests with warnings37b8e73
Support old pytests (#13)463bb48
Fix cov (#14)8a6a5a3
Run tox with 3.12 and drop 3.71ef9b22
Merge pull request #10 from cclauss/patch-1951ece4
Upgrade GitHub Actions and add Python 3.12Updates
pre-commit
from 3.6.2 to 3.7.0Release notes
Sourced from pre-commit's releases.
Changelog
Sourced from pre-commit's changelog.
Commits
7b4667e
v3.7.0d46c8fc
Merge pull request #3168 from pre-commit/fix-fail-fastfc62215
fix per-hook fail_fast to not fail on previous failures716da1e
Merge pull request #3155 from pre-commit/pre-commit-ci-update-config0939c11
[pre-commit.ci] pre-commit autoupdate3bdf9fb
Merge pull request #3150 from pre-commit/pre-commit-ci-update-config75b3e52
[pre-commit.ci] pre-commit autoupdate5e11c26
Merge pull request #3122 from glehmann/docker-ttye580096
give docker a tty output when expecting color7b868c3
Merge pull request #3132 from pre-commit/pre-commit-ci-update-configDependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot show