Select Ruff rules for modern type annotations#160
Conversation
Ensure modern type annotation syntax and best practices Not including those covered by type-checkers or exclusive to Python 3.11+ Not including rules currently in preview either. These are the same set of rules I have in pywin32 as of mhammond/pywin32#2458 setuptools has all the same rules enabled (except it also includes the `UP` group directly)
johnslavik
left a comment
There was a problem hiding this comment.
We can as well enable UP038 as long as we set the proper target version.
I wouldn't enable UP038: astral-sh/ruff#7871 (comment) |
|
Oh, didn't know of its flaws. Have to agree with Alex that the (lack of?) distinction between types (as in the typing spec) and runtime objects is somewhat fuzzy, unclear, and artificial; and it shouldn't be. Thanks @Avasam |
jaraco
left a comment
There was a problem hiding this comment.
Overall, looks good.
Do we have any sense of how much churn this will cause in downstream repos?
Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
A lot less than enabling mypy ^^" I'm hoping for not too much. I tried being cautious when adding new annotations to keep using modern practice wherever possible. So hopefully very little manual churn. And it should only affect imports and annotations that are essentially obsolete. But that's only a guess and hopes. |
| # Not including those covered by type-checkers or exclusive to Python 3.11+ | ||
| "FA", # flake8-future-annotations | ||
| "F404", # late-future-import | ||
| "PYI", # flake8-pyi |
There was a problem hiding this comment.
This rule turns out to be noisy (PYI024 in particular). It requires re-writing all namedtuples to typing.NamedTuples and can't be fixed mechanically.
…version 77.0.1
Anderson Bravalheri (41):
Export `PyInit_pkg` for `pkg.__init__` instead of `PyInit___init__`
Prevent deprecated license classifiers from being written to core metadata
Improve message in warning
Use a more explicit method for preserving static-ness of classifiers
Add news fragment
Keep warning about license classifiers but raise an error if license expression is used
Update newsfragment
Use a better docs URL for warning
Ensure _apply_pyproject sets field on dist.metadata object not on dist
Update URL for warning
Fix bypassed assertion in tests
Attempt to fix sphinx warnings
Attempt to improve display of pep links
Add deprecation warning for project.license as a table in pyproject.toml
Adequate tests to warning
Add news fragment
Ensure _finalize_license_expression preserve "static-ness"
Ensure PEP 639 implementation plays nicely with PEP 643
Improve license/license_expression relationship with 'dynamic' in pyproject.toml
Add comments and test about dynamic x license_files
Apply suggestions from code review
Add minimal validation to license glob patterns
Skip _finalize_license_files in test without source tree
Add test for unmatch license-files pattern
Add news fragment
Avoid path separator problem in doctest on windows
Validate license-files glob patterns individually
[CI] Address problems with `cygwin` (pypa/setuptools#4832, pypa/distutils#328)
Fix new mandatory configuration field for RTD (jaraco/skeleton#159)
Small adjustments and fixes to make tests work
Add thanks note to newsfragment
Enable 'edit this page' button in the docs
Update vendored copy of wheel
Add news fragment
Add news fragment for PEP 639 marking as 'breaking'
Update URL in warning
Bump version: 76.1.0 → 77.0.0
Manually fix news fragment entries
Add news fragments
Change news fragment name to imply patch version bump
Bump version: 77.0.0 → 77.0.1
Avasam (16):
Merge typeshed's `setuptools._distutils` annotations
Make sdist.metadata_check an actual boolean
Add make_archive overloads
Fix impossible _Env import
Fix runtime bound typevars
Fix deprecated
Fix TypeAlias import
from __future__ import annotations
from __future__ import annotations
Missing noqa
Select Ruff rules for modern type annotations (jaraco/skeleton#160)
Consistent import sorting (isort) (jaraco/skeleton#157)
Fix failing test
Fix condition post-merge
Reduce Ruff configs that duplicates upstream after skeleton merge
Restore missing public symbols after compilers move
DWesl (12):
ENH: Don't add system library directories to rpath
ENH: Drop LIBDIR from RPATH only if starting with /usr/lib.
TST: Get all tests passing on Cygwin.
STY: Apply suggestions from CI running black
CI: Install a library to link to on Cygwin
TST: Try testing rpath with non-FHS library dir
TST: Use different library file for link test
DBG: Print ELF headers of extension on Linux.
TST: Clarify RPATH testing asserts.
FIX: Sort library names by length to avoid links
BUG: Resolve links before sorting library paths.
TST: Remove the part of the new test checking old behavior.
Jason R. Coombs (37):
👹 Feed the hobgoblins (delint).
Move compiler implementations into their own package.
Rename classes and add compatibility shims.
Move compiler execeptions to their package.
In compiler package, rely on compiler errors.
Move compiler tests to the compilers package.
Direct tests to the new names
Add news fragment.
Add support for building lxml on pre-release Pythons.
Mark failing tests as xfail. Ref #4864.
Remove Python version gate in _make_strs.
Remove _make_strs and update msvc to accept WindowsPath.
Always rewrite a Python shebang to #!python.
👹 Feed the hobgoblins (delint).
Reword note.
Bump version: 75.8.2 → 75.9.0
Add news fragment.
In config command, move to eager imports. Restore LinkError to ccompilers module.
Add news fragment.
Remove more lazy imports.
Bump version: 75.9.0 → 75.9.1
Bump version: 75.9.1 → 76.0.0
Clean up docstring.
Merge pull request #4766 from di/fix/3777
Repoint the news fragment.
Bump version: 75.3.0 → 75.3.1
Pin ruff at 2024-10-29 to avoid emergent failures from later releases.
Mark failing tests as xfail. Ref #4864.
Mark failing test as xfail.
Add a news entry.
Bump version: 75.3.1 → 75.3.2
Add test capturing missed expectation.
Calculate host_id in one expression.
Add news fragment.
Restore implicit expectation that importing unixccompiler makes distutils.ccompiler available.
Fix reference in changelog.
Bump version: 76.0.0 → 76.1.0
Marc Mueller (16):
Store license-files in licenses subfolder
Update validate-pyproject to 0.23.0
Adjust test example
Use os.sep for replace
Add initial support for License-Expression (PEP 639)
Additional test case
Normalize license expression
Remove License-Expression field
Review
Replace error with warning and remove license classifier
Revert removing the license classifier
Bump core metadata version to 2.4
Deprecate tools.setuptools.license-files
Suggestions
Fix reference
Update link in userguide
Scott Talbert (1):
setuptools.msvc: set host_dir correctly on ARM64 hosts
shenxianpeng (4):
Fix TODO comments and typos
Fix more typos
Revert remove TODO comment code
Revert change files under _vendor
… version 7.2.0
Anderson Bravalheri (3):
Add `--fix` flag to ruff pre-commit hook for automatic suggestion of fixes (jaraco/skeleton#140)
Bump pre-commit hook for ruff to avoid clashes with pytest-ruff (jaraco/skeleton#150)
Fix new mandatory configuration field for RTD (jaraco/skeleton#159)
Avasam (6):
Add Protocols, remove @overload, from `.coveragerc` `exclude_also` (jaraco/skeleton#135)
Loosen restrictions on mypy (jaraco/skeleton#136)
Fix an incompatibility (and source of merge conflicts) with projects using Ruff/isort.
Select Ruff rules for modern type annotations (jaraco/skeleton#160)
Consistent import sorting (isort) (jaraco/skeleton#157)
remove extra spaces in ruff.toml (jaraco/skeleton#164)
Dimitri Papadopoulos Orfanos (3):
Update to the latest ruff version (jaraco/skeleton#137)
Enable ruff rules ISC001/ISC002 (jaraco/skeleton#158)
Update to the latest ruff version (jaraco/skeleton#166)
Jason R. Coombs (25):
Split the test dependencies into four classes (test, cover, type, check). (jaraco/skeleton#139)
Add upstream and local sections for 'type' extra, since many projects will have 'types-*' dependencies.
🧎♀️ Genuflect to the types.
🧎♀️ Genuflect to the types.
Disable mypy for now. Ref jaraco/skeleton#143
Move overload-overlap disablement to its own line for easier diffs and simpler relevant comments.
Add a degenerate nitpick_ignore for downstream consumers. Add a 'local' comment to delineate where the skeleton ends and the downstream begins.
Add support for linking usernames.
Include the trailing slash in disable_error_code(overload-overlap), also required for clean diffs.
Remove workaround for sphinx-contrib/sphinx-lint#83
Allow the workflow to be triggered manually.
Add Python 3.13 and 3.14 into the matrix. (jaraco/skeleton#146)
Add Python 3.13 and 3.14 into the matrix. (jaraco/skeleton#151)
Include pyproject.toml in ruff.toml.
Require Python 3.9 or later now that Python 3.8 is EOL.
Use extend for proper workaround.
👹 Feed the hobgoblins (delint).
Bump badge for 2025.
Removing dependabot config. Closes jaraco/skeleton#156
Add support for building lxml on pre-release Pythons.
Remove pycodestyle warnings, no longer meaningful when using ruff formatter.
👹 Feed the hobgoblins (delint).
cpython-v3.14.0a5 rev=3c289d5d1b73
cpython-main rev=72e5b25efb58
Finalize
…6.1 to version 8.7.0
Anderson Bravalheri (1):
Fix new mandatory configuration field for RTD (jaraco/skeleton#159)
Avasam (2):
Select Ruff rules for modern type annotations (jaraco/skeleton#160)
Consistent import sorting (isort) (jaraco/skeleton#157)
Jason R. Coombs (17):
Bump badge for 2025.
Removing dependabot config. Closes jaraco/skeleton#156
Add support for building lxml on pre-release Pythons.
👹 Feed the hobgoblins (delint).
Remove unused imports.
Prefer typing.NamedTuple
👹 Feed the hobgoblins (delint).
Refactored parsing and handling of EntryPoint.value.
Raise a ValueError if no match.
Also raise ValueError on construction if the value is invalid.
Prefer a cached property, as the property is likely to be retrieved at least 3 times (on construction and for module:attr access).
Allow metadata to return None when there is no metadata present.
Fix type errors where metadata could be None.
Add news fragment.
Refactor the casting into a wrapper for brevity and to document its purpose.
Add a new test capturing the new expectation.
Finalize
Ensure modern type annotation syntax and best practices.
Not including those covered by type-checkers or exclusive to Python 3.11+
Not including rules still in preview in Ruff 0.8+ either.
These are the same set of rules I have in pywin32 as of mhammond/pywin32#2458
setuptools has all the same rules enabled (except it also includes the
UPgroup directly)Solves jaraco/jaraco.context#11 (CC @bswck )