Skip to content

Commit

Permalink
Merge branch 'main' into pytest-mypy-log-filename
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam authored Aug 22, 2024
2 parents 18d961a + c117671 commit 45615b7
Show file tree
Hide file tree
Showing 177 changed files with 1,744 additions and 1,968 deletions.
2 changes: 1 addition & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 72.1.0
current_version = 73.0.1
commit = True
tag = True

Expand Down
6 changes: 4 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ disable_warnings =
[report]
show_missing = True
exclude_also =
# jaraco/skeleton#97
@overload
# Exclude common false positives per
# https://coverage.readthedocs.io/en/latest/excluding.html#advanced-exclusion
# Ref jaraco/skeleton#97 and jaraco/skeleton#135
class .*\bProtocol\):
if TYPE_CHECKING:
11 changes: 6 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
hooks:
- id: ruff
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ recursive-include newsfragments *
include *.py
include *.rst
include MANIFEST.in
include LICENSE
global-include LICEN[CS]E* COPYING* NOTICE* AUTHORS*
include launcher.c
include msvc-build-launcher.cmd
include mypy.ini
include pytest.ini
include tox.ini
include setuptools/tests/config/setupcfg_examples.txt
include setuptools/config/*.schema.json
global-exclude *.py[cod] __pycache__
52 changes: 52 additions & 0 deletions NEWS.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,55 @@
v73.0.1
=======

Bugfixes
--------

- Remove `abc.ABCMeta` metaclass from abstract classes. `pypa/setuptools#4503 <https://github.com/pypa/setuptools/pull/4503>`_ had an unintended consequence of causing potential ``TypeError: metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases`` -- by :user:`Avasam` (#4579)


v73.0.0
=======

Features
--------

- Mark abstract base classes and methods with `abc.ABC` and `abc.abstractmethod` -- by :user:`Avasam` (#4503)
- Changed the order of type checks in ``setuptools.command.easy_install.CommandSpec.from_param`` to support any `collections.abc.Iterable` of `str` param -- by :user:`Avasam` (#4505)


Bugfixes
--------

- Prevent an error in ``bdist_wheel`` if ``compression`` is set to a `str` (even if valid) after finalizing options but before running the command. -- by :user:`Avasam` (#4383)
- Raises an exception when ``py_limited_api`` is used in a build with
``Py_GIL_DISABLED``. This is currently not supported (python/cpython#111506). (#4420)
- Synced with pypa/distutils@30b7331 including fix for modified check on empty sources (pypa/distutils#284).


Deprecations and Removals
-------------------------

- ``setuptools`` is replacing the usages of :pypi:`ordered_set` with simple
instances of ``dict[Hashable, None]``. This is done to remove the extra
dependency and it is possible because since Python 3.7, ``dict`` maintain
insertion order. (#4574)


Misc
----

- #4534, #4546, #4554, #4559, #4565


v72.2.0
=======

Features
--------

- Merged with pypa/distutils@b7ee725f3 including: Support for Pathlike objects in data files and extensions (pypa/distutils#272, pypa/distutils#237), native support for C++ compilers (pypa/distuils#228) and removed unused get_msvcr() (pypa/distutils#274). (#4538)


v72.1.0
=======

Expand Down
3 changes: 1 addition & 2 deletions _distutils_hack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# don't import any costly modules
import sys
import os

import sys

report_url = (
"https://github.com/pypa/setuptools/issues/new?"
Expand Down
1 change: 0 additions & 1 deletion conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import pytest
from pytest_mypy import MypyFileItem, MypyResults


pytest_plugins = 'setuptools.tests.fixtures'


Expand Down
32 changes: 32 additions & 0 deletions docs/development/developer-guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -131,3 +131,35 @@ simple Python script ``tools/vendor.py``.
To refresh the dependencies, run the following command::

$ tox -e vendor

----------------
Type annotations
----------------

Most standards and best practices are enforced by
`Ruff <https://docs.astral.sh/ruff/rules/>`_'s ``ANN2``, ``FA``, ``PYI``, ``UP``
and ``YTT`` rules.

Explicit return types have to be added for typed public functions whose
parameters are *all* annotated. This is enforced by ``ANN2``, but it's worth noting
that this is due to mypy inferring ``Any`` even for simple return types. Mypy also
doesn't count functions with missing parameter annotations as "typed". (see
`python/mypy#4409 <https://github.com/python/mypy/issues/4409>`_,
`python/mypy#10149 <https://github.com/python/mypy/issues/10149>`_ and
`python/mypy#6646 <https://github.com/python/mypy/issues/6646>`_).
Otherwise, return annotations can be omitted to reduce verbosity,
especially for complex return types.

Instead of typing an explicit return type annotation as
``Generator[..., None, None]``, we'll prefer using an ``Iterator`` as it is more
concise and conceptually easier to deal with. Returning a ``Generator`` with no
``yield`` type or ``send`` type can sometimes be considered as exposing
implementation details. See
`Y058 <https://github.com/PyCQA/flake8-pyi/blob/main/ERRORCODES.md#Y058>`_.

Avoid importing private type-checking-only symbols. These are often
`typeshed <https://github.com/python/typeshed>`_ internal details and are not
guaranteed to be stable.
Importing from ``_typeshed`` or ``typing_extensions`` is fine, but if you find
yourself importing the same symbol in ``TYPE_CHECKING`` blocks a lot, consider
implementing an alias directly in ``setuptools``.
3 changes: 3 additions & 0 deletions docs/history.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
History
*******

.. meta::
:keywords: changelog

.. towncrier-draft-entries:: DRAFT, unreleased as on |today|

.. include:: ../NEWS (links).rst
Expand Down
3 changes: 2 additions & 1 deletion docs/userguide/package_discovery.rst
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,9 @@ exactly to the directory structure, you also need to configure ``package_dir``:
package_dir = {
"mypkg": "lib", # mypkg.module corresponds to lib/module.py
"mypkg.subpkg1": "lib1", # mypkg.subpkg1.module1 corresponds to lib1/module1.py
"mypkg.subpkg2": "lib2" # mypkg.subpkg2.module2 corresponds to lib2/module2.py
"mypkg.subpkg2": "lib2", # mypkg.subpkg2.module2 corresponds to lib2/module2.py
# ...
}
)
.. tab:: pyproject.toml
Expand Down
21 changes: 12 additions & 9 deletions mypy.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[mypy]
# CI should test for all versions, local development gets hints for oldest supported
# Some upstream typeshed distutils stubs fixes are necessary before we can start testing on Python 3.12
python_version = 3.8
# But our testing setup doesn't allow passing CLI arguments, so local devs have to set this manually.
# python_version = 3.8
strict = False
warn_unused_ignores = True
warn_redundant_casts = True
Expand All @@ -15,14 +15,13 @@ exclude = (?x)(
| ^setuptools/_vendor/ # Vendored
| ^setuptools/_distutils/ # Vendored
| ^setuptools/config/_validate_pyproject/ # Auto-generated
| ^setuptools/tests/bdist_wheel_testdata/ # Duplicate module name
)
# Too many false-positives
disable_error_code = overload-overlap

# Ignoring attr-defined because setuptools wraps a lot of distutils classes, adding new attributes,
# w/o updating all the attributes and return types from the base classes for type-checkers to understand
# Especially with setuptools.dist.command vs distutils.dist.command vs setuptools._distutils.dist.command
# DistributionMetadata.license_files and DistributionMetadata.license_file
# are dynamically patched in setuptools/_core_metadata.py
# and no DistributionMetadata subclass exists in setuptools
[mypy-setuptools.*]
disable_error_code = attr-defined

Expand All @@ -31,16 +30,20 @@ disable_error_code = attr-defined
[mypy-pkg_resources.tests.*]
disable_error_code = import-not-found

# - distutils._modified has different errors on Python 3.8 [import-untyped], on Python 3.9+ [import-not-found]
# - distutils doesn't exist on Python 3.12, unfortunately, this means typing
# will be missing for subclasses of distutils on Python 3.12 until either:
# - support for `SETUPTOOLS_USE_DISTUTILS=stdlib` is dropped (#3625)
# for setuptools to import `_distutils` directly
# - or non-stdlib distutils typings are exposed
# - All jaraco modules are still untyped
# - _validate_project sometimes complains about trove_classifiers (#4296)
# - wheel appears to be untyped
# - pytest_mypy isn't marked as py.typed
[mypy-distutils._modified,jaraco.*,trove_classifiers,wheel.*,pytest_mypy.*]
[mypy-distutils.*,jaraco.*,trove_classifiers,wheel.*,pytest_mypy.*]
ignore_missing_imports = True

# Even when excluding a module, import issues can show up due to following import
# https://github.com/python/mypy/issues/11936#issuecomment-1466764006
[mypy-setuptools.config._validate_pyproject.*]
[mypy-setuptools.config._validate_pyproject.*,setuptools._distutils.*]
follow_imports = silent
# silent => ignore errors when following imports
Loading

0 comments on commit 45615b7

Please sign in to comment.