Skip to content

Commit 901f07b

Browse files
committed
Redraft to respond to comments
1 parent 1d6a1c0 commit 901f07b

1 file changed

Lines changed: 15 additions & 32 deletions

File tree

docs/options.md

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ This option can also be set using the [command-line option](#command-line)
402402
> Manually set the Python compatibility of your project
403403
404404
By default, cibuildwheel reads your package's Python compatibility from
405-
`pyproject.toml` following [PEP621](https://www.python.org/dev/peps/pep-0621/)
405+
`pyproject.toml` following the [project metadata specification](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/)
406406
or from `setup.cfg`; finally it will try to inspect the AST of `setup.py` for a
407407
simple keyword assignment in a top level function call. If you need to override
408408
this behaviour for some reason, you can use this option.
@@ -416,43 +416,26 @@ Default: reads your package's Python compatibility from `pyproject.toml`
416416
`setup.py` `setup(python_requires="...")`. If not found, cibuildwheel assumes
417417
the package is compatible with all versions of Python that it can build.
418418

419-
420419
!!! note
421-
Rather than using this option, it's recommended you set
422-
`project.requires-python` in `pyproject.toml` instead:
423-
424-
```toml
425-
[project]
426-
requires-python = ">=3.6"
427-
```
420+
Rather than using this option, it's recommended you set this value
421+
statically in a way that your build backend can use it, too. This ensures
422+
that your package's metadata is correct when published on PyPI.
428423

429-
A few things to note:
430-
431-
- If your project didn't already have a `pyproject.toml`, be sure to
432-
set the build system to your build backend.
424+
- If you have a `pyproject.toml` containing a `[project]` table, you can
425+
specify `requires-python` there.
433426

434427
```toml
435-
[build-system]
436-
requires = ["setuptools>=42", "wheel"]
437-
build-backend = "setuptools.build_meta"
428+
[project]
429+
requires-python = ">=3.6"
438430
```
439431

440-
- If you didn't already have a `pyproject.toml` that had a `[project]`
441-
table, you should migrate values from `setup.py` or `setup.cfg`, or
442-
list them in the [the `dynamic` field](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#dynamic).
443-
The values to include and the format is listed in the
444-
[project source metadata specification](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#dynamic)
445-
(as originally defined in PEP 621).
446-
447-
- Adding `[project]` to `pyproject.toml` can
448-
change the behaviour of your build (e.g. `setuptools` may ignore
449-
`install_requires` specified via `setup.py` or `setup.cfg`). Make sure
450-
to double-check the build after adding.
451-
452-
This option is not available in `pyproject.toml` under
453-
`tool.cibuildwheel.project-requires-python`, since it should be set with the
454-
[PEP621](https://www.python.org/dev/peps/pep-0621/) location instead,
455-
`project.requires-python`.
432+
Note that build backend support for the `[project]` table is still patchy, and
433+
adding `[project]` to `pyproject.toml` can change the behaviour of your build
434+
(e.g. setuptools may ignore `install_requires` specified via `setup.py` or
435+
`setup.cfg`). Make sure to double-check the build after adding.
436+
437+
- If you're using setuptools, [you can set this value in `setup.cfg` or `setup.py`](https://setuptools.pypa.io/en/latest/userguide/dependency_management.html#python-requirement)
438+
and cibuildwheel will read it from there.
456439

457440
#### Examples
458441

0 commit comments

Comments
 (0)