Closed bskinn closed 2 years ago
cc @abravalheri
Hi @bskinn, thank you very much for reporting this, the option in (2) should succeed. I think that is the compliant/preferred way forward. I will have a look on this (probably tomorrow evening).
Thanks for the super-quick fix, @abravalheri! v62 builds great in configuration (2).
Glad to know it is working @bskinn, thank you very much for the feedback.
setuptools version
setuptools===61.3.1
Python version
Python 3.9.12
OS
Debian Linux bullseye (Debian 11)
Additional environment information
No response
Description
This is downstream of #1688 & the recent experimental PEP621 implementation.
For my Python projects on PyPI, I use a
setuptools
packaging workflow where I dynamically modify the contents ofREADME.md
(alternativelyREADME.rst
) as part ofsetup.py
, before passing those contents into thelong_description
argument tosetup()
. One example of this is here, where I'm changing some documentation links -- as README sits in the repo, they point to thelatest
docs; when packaged for PyPI, though, I want the links point to a specific historicalvx.y
docs version.I'm attempting to convert this workflow to PEP621. In doing so, it appears that it's currently impossible to configure
setuptools
to properly accept this state of affairs.readme
inproject.dynamic
, I get a_WouldIgnoreField
warning.readme
inproject.dynamic
, I get aKeyError
from an attempted access todynamic_cfg["readme"]
project.dynamic = ["version", "long_description"]
, instead of["version", "readme"]
, I getValueError: invalid pyproject.toml config: project.dynamic[1]
Expected behavior
I would expect it to be necessary to declare my
long_description
asdynamic
, since I am generating it dynamically withinsetup.py
. Thus, (1.) above (and the future behavior of completely rejecting a dynamicreadme
when it is not declared asdynamic
) is expected behavior.I would expect (2.) to result in a successful build. I would guess that the PEP621
project.readme
field, and in particular thereadme
element withindynamic_cfg
, is not being correctly linked to/populated with the contents oflong_description
coming fromsetup.py
.Given that the
pyproject.toml
table key forproject.dynamic
expects to seereadme
and notlong_description
, the error in (3.) is expected.How to Reproduce
Setup
pip install build
; or, just use an externally-installed version ofbuild
(e.g., viapipx
).Repro
$ git checkout readme-static && python -m build
readme
is not included inproject.dynamic
; (1.) above$ git checkout readme-dynamic && python -m build
readme
is included inproject.dynamic
; (2.) above$ git checkout long-desc-in-dynamic && python -m build
long_description
is included inproject.dynamic
,readme
is omitted; (3.) aboveOutput