Skip to content

Commit 2a4a9e4

Browse files
committed
Merge remote-tracking branch 'origin/main' into distutils-e8eb87855
2 parents 7193429 + cbd1195 commit 2a4a9e4

76 files changed

Lines changed: 492 additions & 399 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/main.yml‎

Lines changed: 30 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,6 @@ concurrency:
2222
permissions:
2323
contents: read
2424

25-
env:
26-
# Environment variable to support color support (jaraco/skeleton#66)
27-
FORCE_COLOR: 1
28-
29-
# Suppress noisy pip warnings
30-
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
31-
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
32-
33-
# Ensure tests can sense settings about the environment
34-
TOX_OVERRIDE: >-
35-
testenv.pass_env+=GITHUB_*,FORCE_COLOR
36-
37-
3825
jobs:
3926
test:
4027
strategy:
@@ -66,86 +53,14 @@ jobs:
6653
- platform: ubuntu-latest
6754
python: "3.10"
6855
distutils: stdlib
69-
runs-on: ${{ matrix.platform }}
70-
continue-on-error: ${{ matrix.python == '3.15' || matrix.python == 'pypy3.11' }}
71-
# XXX: pypy seems to be flaky with unrelated tests in #6345
72-
env:
73-
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.distutils || 'local' }}
74-
timeout-minutes: 75
75-
steps:
76-
- uses: actions/checkout@v4
77-
- name: Install build dependencies
78-
# Install dependencies for building packages on pre-release Pythons
79-
# jaraco/skeleton#161
80-
if: matrix.python == '3.15' && matrix.platform == 'ubuntu-latest'
81-
run: |
82-
sudo apt update
83-
sudo apt install -y libxml2-dev libxslt-dev
84-
- name: Setup Python
85-
id: python-install
86-
uses: actions/setup-python@v5
87-
with:
88-
python-version: ${{ matrix.python }}
89-
allow-prereleases: true
90-
# Workaround for actions/setup-python#981 on macos
91-
# Workaround for https://github.com/pypa/setuptools/issues/5143 on windows
92-
# (env var only modified for this specific step)
93-
env:
94-
SETUPTOOLS_USE_DISTUTILS: >-
95-
${{
96-
(
97-
( matrix.platform == 'macos-latest' || matrix.platform == 'windows-latest' )
98-
&& matrix.python == '3.9'
99-
&& 'stdlib'
100-
)
101-
|| matrix.distutils
102-
|| 'local'
103-
}}
104-
- uses: actions/cache@v4
105-
id: cache
106-
with:
107-
path: setuptools/tests/config/downloads/*.cfg
108-
key: >-
109-
${{ hashFiles('setuptools/tests/config/setupcfg_examples.txt') }}-
110-
${{ hashFiles('setuptools/tests/config/downloads/*.py') }}
111-
- name: Populate download cache
112-
if: steps.cache.outputs.cache-hit != 'true'
113-
working-directory: setuptools/tests/config
114-
run: python -m downloads.preload setupcfg_examples.txt
115-
- name: Adjust env vars
116-
shell: bash
117-
run: |
118-
echo 'PIPX_DEFAULT_PYTHON=${{ steps.python-install.outputs.python-path }}' >> $GITHUB_ENV
119-
- name: Pre-build distributions for test
120-
shell: bash
121-
run: |
122-
rm -rf dist
123-
# workaround for pypa/setuptools#4333
124-
pipx run --pip-args 'pyproject-hooks!=1.1' build
125-
echo "PRE_BUILT_SETUPTOOLS_SDIST=$(ls dist/*.tar.gz)" >> $GITHUB_ENV
126-
echo "PRE_BUILT_SETUPTOOLS_WHEEL=$(ls dist/*.whl)" >> $GITHUB_ENV
127-
rm -rf setuptools.egg-info # Avoid interfering with the other tests
128-
- name: Workaround for unreleased PyNaCl (pyca/pynacl#805)
129-
if: contains(matrix.python, 'pypy')
130-
run: echo "SETUPTOOLS_ENFORCE_DEPRECATION=0" >> $GITHUB_ENV
131-
- name: Install tox
132-
run: python -m pip install tox
133-
- name: Run
134-
run: tox
135-
- name: Create coverage report
136-
if: hashFiles('.coverage') != '' # Rudimentary `file.exists()`
137-
run: pipx run coverage xml --ignore-errors
138-
- name: Publish coverage
139-
if: hashFiles('coverage.xml') != '' # Rudimentary `file.exists()`
140-
uses: codecov/codecov-action@v4
141-
with:
142-
flags: >- # Mark which lines are covered by which envs
143-
CI-GHA,
144-
${{ github.job }},
145-
OS-${{ runner.os }},
146-
VM-${{ matrix.platform }},
147-
Py-${{ steps.python-install.outputs.python-version }}
148-
token: ${{ secrets.CODECOV_TOKEN }}
56+
uses: ./.github/workflows/test-suite.yml
57+
with:
58+
job: ${{ github.job }}
59+
python: ${{ matrix.python }}
60+
platform: ${{ matrix.platform }}
61+
distutils: ${{ matrix.distutils }}
62+
full-test: true
63+
secrets: inherit
14964

15065
collateral:
15166
strategy:
@@ -154,19 +69,10 @@ jobs:
15469
job:
15570
- diffcov
15671
- docs
157-
runs-on: ubuntu-latest
158-
steps:
159-
- uses: actions/checkout@v4
160-
with:
161-
fetch-depth: 0
162-
- name: Setup Python
163-
uses: actions/setup-python@v5
164-
with:
165-
python-version: 3.x
166-
- name: Install tox
167-
run: python -m pip install tox
168-
- name: Eval ${{ matrix.job }}
169-
run: tox -e ${{ matrix.job }}
72+
uses: ./.github/workflows/test-suite.yml
73+
with:
74+
platform: ubuntu-latest
75+
tox-env: ${{ matrix.job }}
17076

17177
check: # This job does nothing and is only used for the branch protection
17278
if: always()
@@ -196,6 +102,14 @@ jobs:
196102
- windows-latest
197103
runs-on: ${{ matrix.platform }}
198104
timeout-minutes: 75
105+
# Decoupled from the reusable test-suite.yml (Cygwin needs its own shell);
106+
# env vars shared with that workflow are duplicated here deliberately.
107+
env:
108+
FORCE_COLOR: 1
109+
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
110+
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
111+
TOX_OVERRIDE: >-
112+
testenv.pass_env+=GITHUB_*,FORCE_COLOR
199113
steps:
200114
- uses: actions/checkout@v4
201115
- name: Install Cygwin with Python
@@ -270,12 +184,12 @@ jobs:
270184
if: steps.changed-files-specific-distutils.outputs.any_changed == 'true'
271185
run: |
272186
echo "One or more files in the setuptools/_distutils folder has changed." | tee "${GITHUB_STEP_SUMMARY}"
273-
exit 1
187+
exit 1
274188
- name: Fail the job if any file(s) in the _vendor folder change
275189
if: steps.changed-files-specific-vendor.outputs.any_changed == 'true'
276190
run: |
277191
echo "One or more files in the setuptools/_vendor folder has changed." | tee "${GITHUB_STEP_SUMMARY}"
278-
exit 1
192+
exit 1
279193
280194
integration-test:
281195
needs: test
@@ -289,6 +203,14 @@ jobs:
289203
# With that in mind, the integration tests can run for a single setup
290204
runs-on: ubuntu-latest
291205
timeout-minutes: 75
206+
# Decoupled from the reusable test-suite.yml; env vars shared with that
207+
# workflow are duplicated here deliberately.
208+
env:
209+
FORCE_COLOR: 1
210+
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
211+
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
212+
TOX_OVERRIDE: >-
213+
testenv.pass_env+=GITHUB_*,FORCE_COLOR
292214
steps:
293215
- uses: actions/checkout@v4
294216
- name: Install OS-level dependencies

‎.github/workflows/test-suite.yml‎

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Test Suite
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
python:
7+
description: Python version
8+
type: string
9+
default: "3.x"
10+
platform:
11+
description: Runner platform
12+
type: string
13+
default: ubuntu-latest
14+
tox-env:
15+
description: >-
16+
Tox environment to run; if empty, runs default tox
17+
type: string
18+
default: ""
19+
job:
20+
description: >-
21+
Name of the calling job, used to tag published coverage
22+
type: string
23+
default: ""
24+
distutils:
25+
description: >-
26+
Value for SETUPTOOLS_USE_DISTUTILS (defaults to 'local')
27+
type: string
28+
default: ""
29+
full-test:
30+
description: >-
31+
Run setuptools' full test harness: pre-built distributions, the
32+
setupcfg download cache, and coverage publishing. Off for the
33+
lighter collateral jobs (docs, diffcov).
34+
type: boolean
35+
default: false
36+
37+
env:
38+
# Environment variable to support color support (jaraco/skeleton#66)
39+
FORCE_COLOR: 1
40+
41+
# Suppress noisy pip warnings
42+
PIP_DISABLE_PIP_VERSION_CHECK: 'true'
43+
PIP_NO_WARN_SCRIPT_LOCATION: 'true'
44+
45+
# Ensure tests can sense settings about the environment
46+
TOX_OVERRIDE: >-
47+
testenv.pass_env+=GITHUB_*,FORCE_COLOR
48+
49+
jobs:
50+
run:
51+
runs-on: ${{ inputs.platform }}
52+
# Tolerate failures on pre-release Pythons (jaraco/skeleton#199)
53+
# XXX: pypy seems to be flaky with unrelated tests in pypa/setuptools#6345
54+
continue-on-error: ${{ inputs.python == '3.15' || inputs.python == 'pypy3.11' }}
55+
permissions:
56+
contents: read
57+
timeout-minutes: 75
58+
env:
59+
SETUPTOOLS_USE_DISTUTILS: ${{ inputs.distutils || 'local' }}
60+
steps:
61+
- uses: actions/checkout@v4
62+
with:
63+
fetch-depth: 0
64+
- name: Install build dependencies
65+
# Install dependencies for building packages on pre-release Pythons
66+
# jaraco/skeleton#161
67+
if: inputs.python == '3.15' && inputs.platform == 'ubuntu-latest'
68+
run: |
69+
sudo apt update
70+
sudo apt install -y libxml2-dev libxslt-dev
71+
- name: Setup Python
72+
id: python-install
73+
uses: actions/setup-python@v5
74+
with:
75+
python-version: ${{ inputs.python }}
76+
allow-prereleases: true
77+
- uses: actions/cache@v4
78+
if: inputs.full-test
79+
id: cache
80+
with:
81+
path: setuptools/tests/config/downloads/*.cfg
82+
key: >-
83+
${{ hashFiles('setuptools/tests/config/setupcfg_examples.txt') }}-
84+
${{ hashFiles('setuptools/tests/config/downloads/*.py') }}
85+
- name: Populate download cache
86+
if: inputs.full-test && steps.cache.outputs.cache-hit != 'true'
87+
working-directory: setuptools/tests/config
88+
run: python -m downloads.preload setupcfg_examples.txt
89+
- name: Adjust env vars
90+
if: inputs.full-test
91+
shell: bash
92+
run: |
93+
echo 'PIPX_DEFAULT_PYTHON=${{ steps.python-install.outputs.python-path }}' >> $GITHUB_ENV
94+
- name: Pre-build distributions for test
95+
if: inputs.full-test
96+
shell: bash
97+
run: |
98+
rm -rf dist
99+
# workaround for pypa/setuptools#4333
100+
pipx run --pip-args 'pyproject-hooks!=1.1' build
101+
echo "PRE_BUILT_SETUPTOOLS_SDIST=$(ls dist/*.tar.gz)" >> $GITHUB_ENV
102+
echo "PRE_BUILT_SETUPTOOLS_WHEEL=$(ls dist/*.whl)" >> $GITHUB_ENV
103+
rm -rf setuptools.egg-info # Avoid interfering with the other tests
104+
- name: Workaround for unreleased PyNaCl (pyca/pynacl#805)
105+
if: inputs.full-test && contains(inputs.python, 'pypy')
106+
run: echo "SETUPTOOLS_ENFORCE_DEPRECATION=0" >> $GITHUB_ENV
107+
- name: Install tox
108+
run: python -m pip install tox
109+
- name: Run
110+
if: ${{ !inputs.tox-env }}
111+
run: tox
112+
- name: Run ${{ inputs.tox-env }}
113+
if: ${{ inputs.tox-env }}
114+
run: tox -e ${{ inputs.tox-env }}
115+
- name: Create coverage report
116+
if: inputs.full-test && hashFiles('.coverage') != '' # Rudimentary `file.exists()`
117+
run: pipx run coverage xml --ignore-errors
118+
- name: Publish coverage
119+
if: inputs.full-test && hashFiles('coverage.xml') != '' # Rudimentary `file.exists()`
120+
uses: codecov/codecov-action@v4
121+
with:
122+
flags: >- # Mark which lines are covered by which envs
123+
CI-GHA,
124+
${{ inputs.job || github.job }},
125+
OS-${{ runner.os }},
126+
VM-${{ inputs.platform }},
127+
Py-${{ steps.python-install.outputs.python-version }}
128+
token: ${{ secrets.CODECOV_TOKEN }}

‎AGENTS.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
This project follows the [skeleton](https://blog.jaraco.com/skeleton); please read for context on development.
2-
3-
Before committing, ensure .git/info/exclude is populated from jaraco/dotfiles .gitignore_global so that generated artifacts are never staged.
1+
**Required first step:** Before reading further or making any changes, fetch and read the [skeleton](https://blog.jaraco.com/skeleton/) document in its entirety. It is the authoritative source of truth for this project's structure, conventions, testing, and release process, and is not duplicated here. Do not act until you have ingested it.

‎_distutils_hack/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def spec_for_distutils(self):
118118

119119
try:
120120
mod = importlib.import_module('setuptools._distutils')
121-
except Exception:
121+
except Exception: # noqa: BLE001 # intentional broad fallback
122122
# There are a couple of cases where setuptools._distutils
123123
# may not be present:
124124
# - An older Setuptools without a local distutils is

‎pyproject.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ enabler = [
129129
type = [
130130
# upstream
131131

132-
# Exclude PyPy from type checks (python/mypy#20454 jaraco/skeleton#187)
132+
# Exclude PyPy from type checks (python/mypy#20454 jaraco/skeleton#187)
133133
"pytest-mypy >= 1.0.1; platform_python_implementation != 'PyPy'",
134134

135135
# local

‎ruff.toml‎

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,13 @@ extend-select = [
1111
"C901", # complex-structure
1212
"I", # isort
1313
"PERF401", # manual-list-comprehension
14+
"UP", # pyupgrade (Code modernization for strings, annotations, conditions, ...)
1415

1516
# Ensure modern type annotation syntax and best practices
1617
# Not including those covered by type-checkers or exclusive to Python 3.11+
1718
"FA", # flake8-future-annotations
1819
"F404", # late-future-import
1920
"PYI", # flake8-pyi
20-
"UP006", # non-pep585-annotation
21-
"UP007", # non-pep604-annotation
22-
"UP010", # unnecessary-future-import
23-
"UP035", # deprecated-import
24-
"UP037", # quoted-annotation
25-
"UP043", # unnecessary-default-type-args
2621

2722
# local
2823
"ANN2", # missing-return-type-*
@@ -39,21 +34,15 @@ extend-select = [
3934
]
4035
ignore = [
4136
# upstream
37+
"UP015", # redundant-open-modes, explicit is preferred
4238

4339
# Typeshed rejects complex or non-literal defaults for maintenance and testing reasons,
4440
# irrelevant to this project.
4541
"PYI011", # typed-argument-default-in-stub
4642
# https://docs.astral.sh/ruff/formatter/#conflicting-lint-rules
4743
"W191",
48-
"E111",
49-
"E114",
50-
"E117",
5144
"D206",
5245
"D300",
53-
"Q000",
54-
"Q001",
55-
"Q002",
56-
"Q003",
5746
"COM812",
5847
"COM819",
5948

@@ -64,11 +53,15 @@ ignore = [
6453
"PT012", # pytest-raises-with-multiple-statements, avoid extra dummy methods for a few lines, sometimes we explicitly assert in case of no error
6554
"TRY003", # raise-vanilla-args, avoid multitude of exception classes
6655
"TRY301", # raise-within-try, it's handy
67-
"UP015", # redundant-open-modes, explicit is preferred
6856
# Only enforcing return type annotations for public functions
6957
"ANN202", # missing-return-type-private-function
7058
]
7159

60+
[lint.flake8-comprehensions]
61+
# Retain the elegant dict(a=1) keyword-call style; C408 still flags dict()
62+
# and dict([...]). See jaraco/skeleton#210.
63+
allow-dict-calls-with-keyword-arguments = true
64+
7265
[lint.per-file-ignores]
7366
# Suppress nuisance warnings about module-import-not-at-top-of-file (E402) due to workaround for #4476
7467
"setuptools/__init__.py" = ["E402"]

0 commit comments

Comments
 (0)