Skip to content

Commit

Permalink
Merge branch 'main' into Type-str/repr-dunders
Browse files Browse the repository at this point in the history
  • Loading branch information
abravalheri authored Aug 27, 2024
2 parents 256d542 + d12330d commit 5630a99
Show file tree
Hide file tree
Showing 37 changed files with 370 additions and 164 deletions.
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:
74 changes: 74 additions & 0 deletions .github/workflows/pyright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Split workflow file to not interfere with skeleton
name: pyright

on:
merge_group:
push:
branches-ignore:
# temporary GH branches relating to merge queues (jaraco/skeleton#93)
- gh-readonly-queue/**
tags:
# required if branches-ignore is supplied (jaraco/skeleton#103)
- '**'
pull_request:
workflow_dispatch:

concurrency:
group: >-
${{ github.workflow }}-
${{ github.ref_type }}-
${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

env:
# pin pyright version so a new version doesn't suddenly cause the CI to fail,
# until types-setuptools is removed from typeshed.
# For help with static-typing issues, or pyright update, ping @Avasam
PYRIGHT_VERSION: "1.1.377"

# Environment variable to support color support (jaraco/skeleton#66)
FORCE_COLOR: 1

# Suppress noisy pip warnings
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
PIP_NO_PYTHON_VERSION_WARNING: 'true'
PIP_NO_WARN_SCRIPT_LOCATION: 'true'

jobs:
pyright:
strategy:
# https://blog.jaraco.com/efficient-use-of-ci-resources/
matrix:
python:
- "3.8"
- "3.12"
platform:
- ubuntu-latest
runs-on: ${{ matrix.platform }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
- name: Install typed dependencies
run: python -m pip install -e .[core,type]
- name: Inform how to run locally
run: |
echo 'To run this test locally with npm pre-installed, run:'
echo '> npx -y pyright@${{ env.PYRIGHT_VERSION }} --threads'
echo 'You can also instead install "Pyright for Python" which will install npm for you:'
if [ '$PYRIGHT_VERSION' == 'latest' ]; then
echo '> pip install -U'
else
echo '> pip install pyright==${{ env.PYRIGHT_VERSION }}'
fi
echo 'pyright --threads'
shell: bash
- name: Run pyright
uses: jakebailey/pyright-action@v2
with:
version: ${{ env.PYRIGHT_VERSION }}
extra-args: --threads
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: ruff
args: [--fix]
- id: ruff-format
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
- id: ruff-format
4 changes: 2 additions & 2 deletions docs/userguide/pyproject_config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ corresponding entry is required in the ``tool.setuptools.dynamic`` table
dynamic = ["version", "readme"]
# ...
[tool.setuptools.dynamic]
version = {attr = "my_package.VERSION"}
version = {attr = "my_package.__version__"} # any module attribute compatible with ast.literal_eval
readme = {file = ["README.rst", "USAGE.rst"]}
In the ``dynamic`` table, the ``attr`` directive [#directives]_ will read an
Expand Down Expand Up @@ -280,7 +280,7 @@ not installed yet. You may also need to manually add the project directory to
directive for ``tool.setuptools.dynamic.version``.

.. [#attr] ``attr`` is meant to be used when the module attribute is statically
specified (e.g. as a string, list or tuple). As a rule of thumb, the
specified (e.g. as a string). As a rule of thumb, the
attribute should be able to be parsed with :func:`ast.literal_eval`, and
should not be modified or re-assigned.

Expand Down
14 changes: 9 additions & 5 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 Down Expand Up @@ -30,15 +30,19 @@ 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
[mypy-distutils._modified,jaraco.*,trove_classifiers,wheel.*]
[mypy-distutils.*,jaraco.*,trove_classifiers,wheel.*]
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
1 change: 1 addition & 0 deletions newsfragments/4553.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added detection of ARM64 variant of MSVC -- by :user:`saschanaz`
1 change: 1 addition & 0 deletions newsfragments/4585.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Made ``setuptools.package_index.Credential`` a `typing.NamedTuple` -- by :user:`Avasam`
1 change: 1 addition & 0 deletions newsfragments/4592.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
If somehow the ``EXT_SUFFIX`` configuration variable and ``SETUPTOOLS_EXT_SUFFIX`` environment variables are both missing, ``setuptools.command.build_ext.pyget_ext_filename`` will now raise an `OSError` instead of a `TypeError` -- by :user:`Avasam`
1 change: 1 addition & 0 deletions newsfragments/4598.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fully typed all collection attributes in ``pkg_resources`` -- by :user:`Avasam`
Loading

0 comments on commit 5630a99

Please sign in to comment.