Skip to content

Commit ea3c086

Browse files
committed
pyproject: upgrade to modern setuptools
It turns out `--global-option` still works, even though it is deprecated. So let's adopt modern setuptools, reintroduce use of `--global-option`, and update licensing metadata to new conventions.
1 parent 541be65 commit ea3c086

File tree

10 files changed

+26
-51
lines changed

10 files changed

+26
-51
lines changed

.github/workflows/external-zstd.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,8 @@ jobs:
2828
persist-credentials: false
2929

3030
- name: Build
31-
env:
32-
PIP_CONSTRAINT: 'ci/constraints.txt'
3331
run: |
34-
python -m pip install --config-settings=--build-option=--system-zstd .
32+
python -m pip install --config-settings=--global-option=--system-zstd .
3533
3634
macOS:
3735
runs-on: 'macos-13'
@@ -57,7 +55,5 @@ jobs:
5755
persist-credentials: false
5856

5957
- name: Build
60-
env:
61-
PIP_CONSTRAINT: 'ci/constraints.txt'
6258
run: |
63-
python -m pip install --config-settings=--build-option=--system-zstd .
59+
python -m pip install --config-settings=--global-option=--system-zstd .

.github/workflows/pypy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646

4747
- name: Build
4848
run: |
49-
python -m pip -v wheel --constraint ci/constraints.txt -w wheelhouse .
49+
python -m pip -v wheel -w wheelhouse .
5050
5151
test:
5252
strategy:

.github/workflows/sphinx.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@ jobs:
1616
with:
1717
version: "0.8.11"
1818
- name: Run Sphinx
19-
env:
20-
PIP_CONSTRAINT: 'ci/constraints.txt'
2119
run: |
2220
uv venv --python 3.13 venv
2321
source venv/bin/activate
2422
uv pip install -r ci/requirements.docs.txt
25-
uv pip install --config-settings=--build-option=--no-c-backend .
23+
uv pip install --config-settings=--global-option=--no-c-backend .
2624
make -C docs html

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ jobs:
113113
run: |
114114
# We need --reinstall to get uv to pick up the config settings change.
115115
# Unsure if this is a bug.
116-
uv -v run --locked --config-settings-package 'zstandard:--build-option=--rust-backend' --reinstall pytest --numprocesses=auto --hypothesis-profile=${HYPOTHESIS_PROFILE} -v
116+
uv -v run --locked --config-settings-package 'zstandard:--global-option=--rust-backend' --reinstall pytest --numprocesses=auto --hypothesis-profile=${HYPOTHESIS_PROFILE} -v

.readthedocs.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ build:
99
jobs:
1010
create_environment:
1111
- python3 -m venv venv
12-
- venv/bin/python3 -m pip install -c ci/constraints.txt -r ci/requirements.docs.txt
13-
- venv/bin/python3 -m pip install --config-settings=--build-option=--no-c-backend .
12+
- venv/bin/python3 -m pip install -r ci/requirements.docs.txt
13+
- venv/bin/python3 -m pip install --config-settings=--global-option=--no-c-backend .
1414
build:
1515
htmlzip:
1616
- make -C docs html SPHINXBUILD=$(pwd)/venv/bin/sphinx-build BUILDDIR=$READTHEDOCS_OUTPUT

ci/constraints.txt

Lines changed: 0 additions & 5 deletions
This file was deleted.

docs/installing.rst

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,7 @@ Legacy Format Support
5050
To enable legacy zstd format support which is needed to handle files compressed
5151
with zstd < 1.0 you need to provide an installation option::
5252

53-
$ pip install zstandard --install-option="--legacy"
54-
55-
and since pip 7.0 it is possible to have the following line in your
56-
requirements.txt::
57-
58-
zstandard --install-option="--legacy"
53+
$ pip install zstandard --config-settings='--global-option=--legacy'
5954

6055
All Install Arguments
6156
=====================
@@ -86,11 +81,14 @@ All Install Arguments
8681
``--rust-backend``
8782
Compile the Rust backend (not yet feature complete).
8883

89-
If you invoke ``setup.py``, simply pass the aforementioned arguments. e.g.
90-
``python3.9 setup.py --no-cffi-backend``. If using ``pip``, use the
91-
``--install-option`` argument. e.g.
92-
``python3.9 -m pip install zstandard --install-option --warning-as-errors``.
93-
Or in a pip requirements file: ``zstandard --install-option="--rust-backend"``.
84+
Packaging tools newer than ~2023 likely require using a PEP 517
85+
build backend instead of invoking ``setup.py`` directly. In order to send
86+
custom arguments to our ``setup.py``, you need to use ``--config-settings``.
87+
e.g. ``python3 -m pip install zstandard --config-settings='--global-option=--no-cffi-backend'``.
88+
89+
Older packaging tools allowed you to use e.g.
90+
``python3 -m pip install zstandard --install-option --no-cffi-backend`` or
91+
just ``python3 setup.py --no-cffi-backend`` directly.
9492

9593
In addition, the following environment variables are recognized:
9694

docs/news.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,14 @@ Version History
2727
wheels. (Enabling this test coverage did not uncover any failures.)
2828
* The ``pyproject.toml`` build backend has been switched from
2929
``setuptools.build_meta:__legacy__`` to ``setuptools.build_meta``.
30+
* The setuptools build dependency has been upgraded from <69.0.0 to >=77.0.0.
31+
Modern versions of setuptools broke
32+
``--config-settings=--build-option=...`` as part of implementing PEP 660.
33+
A workaround is to use `--config-settings=--global-option=...`` instead.
34+
`--global-option`` apparently is deprecated and the setuptools folks have yet
35+
to figure out how to thread config settings into ``setup.py`` invocations.
36+
(`--build-option`` is sent to the ``build_wheel`` command but not the
37+
``build_editable`` command.)
3038

3139
0.24.0 (released 2025-08-17)
3240
============================

pyproject.toml

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,11 @@ readme = { file = "README.rst", content-type = "text/x-rst" }
66
authors = [
77
{ name = "Gregory Szorc", email = "[email protected]" },
88
]
9-
license = { text = "BSD" }
9+
license = "BSD-3-Clause"
1010
requires-python = ">=3.9"
1111
classifiers = [
1212
"Development Status :: 5 - Production/Stable",
1313
"Intended Audience :: Developers",
14-
"License :: OSI Approved :: BSD License",
1514
"Programming Language :: C",
1615
"Programming Language :: Python :: 3.9",
1716
"Programming Language :: Python :: 3.10",
@@ -36,7 +35,7 @@ Documentation = "https://python-zstandard.readthedocs.io/en/latest/"
3635
requires = [
3736
"cffi>=1.17.0 ; platform_python_implementation != 'PyPy'",
3837
"packaging",
39-
"setuptools",
38+
"setuptools>=77.0.0",
4039
]
4140
build-backend = "setuptools.build_meta"
4241

@@ -82,19 +81,3 @@ test-command = [
8281
"set PYTHON_ZSTANDARD_IMPORT_POLICY=cffi",
8382
"pytest -v --numprocesses=auto",
8483
]
85-
86-
# This is needed to suppress generation of license-file, which isn't
87-
# compatible with metadata version 2.1, which our pinned setuptools
88-
# version currently uses.
89-
# TODO delete this after we adopt modern setuptools.
90-
[tool.setuptools]
91-
license-files = []
92-
93-
[tool.uv]
94-
build-constraint-dependencies = [
95-
# 69.0.0 breaks handling of --config-settings=--build-option, which our CI
96-
# relies on. So constrained to an older version until we figure out a
97-
# workaround. See comment at
98-
# https://github.com/pypa/pip/issues/11859#issuecomment-2132287974.
99-
"setuptools<69.0.0",
100-
]

uv.lock

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)