Skip to content

Commit

Permalink
Merge branch 'main' into debt/msvc-monkey
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Aug 27, 2024
2 parents 481bccf + e55c19e commit ac62989
Show file tree
Hide file tree
Showing 36 changed files with 391 additions and 158 deletions.
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
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ include tox.ini
include setuptools/tests/config/setupcfg_examples.txt
include setuptools/config/*.schema.json
global-exclude *.py[cod] __pycache__
prune .tox
4 changes: 2 additions & 2 deletions _distutils_hack/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ def add_shim():


class shim:
def __enter__(self):
def __enter__(self) -> None:
insert_shim()

def __exit__(self, exc, value, tb):
def __exit__(self, exc: object, value: object, tb: object) -> None:
_remove_shim()


Expand Down
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
24 changes: 16 additions & 8 deletions mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,16 @@ warn_redundant_casts = True
# required to support namespace packages: https://github.com/python/mypy/issues/14057
explicit_package_bases = True
exclude = (?x)(
# Avoid scanning Python files in generated folders
^build/
| ^.tox/
| ^.eggs/
| ^pkg_resources/tests/data/my-test-package-source/setup.py$ # Duplicate module name
| ^setuptools/_vendor/ # Vendored
| ^setuptools/_distutils/ # Vendored
| ^setuptools/config/_validate_pyproject/ # Auto-generated
| ^setuptools/config/_validate_pyproject/
# These are vendored
| ^setuptools/_vendor/
| ^setuptools/_distutils/
# Duplicate module name
| ^pkg_resources/tests/data/my-test-package-source/setup.py$
)
# Too many false-positives
disable_error_code = overload-overlap
Expand All @@ -35,10 +38,15 @@ disable_error_code = import-not-found
# - 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.*,jaraco.*,trove_classifiers,wheel.*]
# - The following are not marked as py.typed:
# - jaraco.develop: https://github.com/jaraco/jaraco.develop/issues/22
# - jaraco.envs: https://github.com/jaraco/jaraco.envs/issues/7
# - jaraco.packaging: https://github.com/jaraco/jaraco.packaging/issues/20
# - jaraco.path: https://github.com/jaraco/jaraco.path/issues/2
# - jaraco.test: https://github.com/jaraco/jaraco.test/issues/7
# - jaraco.text: https://github.com/jaraco/jaraco.text/issues/17
# - wheel: does not intend on exposing a programatic API https://github.com/pypa/wheel/pull/610#issuecomment-2081687671
[mypy-distutils.*,jaraco.develop,jaraco.envs,jaraco.packaging.*,jaraco.path,jaraco.test.*,jaraco.text,wheel.*]
ignore_missing_imports = True

# Even when excluding a module, import issues can show up due to following import
Expand Down
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 ac62989

Please sign in to comment.