[BUG] pyproject.toml validation breaks pdm-pep517
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
setuptools version
61.3.0
Python version
Python 3.10.4
OS
Gentoo Linux
Additional environment information
Tested on top of pdm-pep517 git (pdm-project/pdm-pep517@04ed8589ad4400422ac9ca4c09b3ecb0df8edfab).
pdm-pep517 bug report: https://github.com/pdm-project/pdm-pep517/issues/81
Description
pdm-pep517 happens to use setuptools internally to build projects with C extensions. However, these builds are now failing due to setuptools attempting to validate pyproject.toml according to its own rules, while it apparently uses an incompatible pdm-specific format. An example error is:
configuration error: `project` must not contain {'license-expression'} properties
Expected behavior
Not sure. Possibly skipping validation if pyproject.toml uses a different build system.
How to Reproduce
git clone https://github.com/pdm-project/pdm-pep517
cd pdm-pep517
python -m venv .venv
. .venv/bin/activate
pip install pdm
pdm run pytest tests
Output
The tests initially fail due to empty homepage:
-------------------------------------------------------- Captured stderr call ---------------------------------------------------------
/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:102: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
warnings.warn(msg, _ExperimentalProjectMetadata)
For maximum compatibility please make sure to include a `scheme` prefix in your URL (e.g. 'http://'). Given value:
configuration error: `project.urls.homepage` must be url
Traceback (most recent call last):
File "/tmp/pdm-pep517/tests/fixtures/projects/demo-cextension/setup.py", line 29, in <module>
setup(**setup_kwargs)
File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 122, in setup
dist.parse_config_files()
File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 854, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 54, in apply_configuration
config = read_configuration(filepath, True, ignore_option_errors, dist)
File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 120, in read_configuration
validate(subset, filepath)
File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 43, in validate
raise error from None
ValueError: invalid pyproject.toml config: `project.urls.homepage`
After fixing it not to be empty, they fail due to pdm-specific keys, e.g.:
/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py:102: _ExperimentalProjectMetadata: Support for project metadata in `pyproject.toml` is still experimental and may be removed (or change) in future releases.
warnings.warn(msg, _ExperimentalProjectMetadata)
configuration error: `project` must not contain {'license-expression'} properties
Traceback (most recent call last):
File "/tmp/pdm-pep517/tests/fixtures/projects/demo-purelib-with-build/setup.py", line 29, in <module>
setup(**setup_kwargs)
File "/usr/lib/python3.10/site-packages/setuptools/__init__.py", line 87, in setup
return distutils.core.setup(**attrs)
File "/usr/lib/python3.10/site-packages/setuptools/_distutils/core.py", line 122, in setup
dist.parse_config_files()
File "/usr/lib/python3.10/site-packages/setuptools/dist.py", line 854, in parse_config_files
pyprojecttoml.apply_configuration(self, filename, ignore_option_errors)
File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 54, in apply_configuration
config = read_configuration(filepath, True, ignore_option_errors, dist)
File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 120, in read_configuration
validate(subset, filepath)
File "/usr/lib/python3.10/site-packages/setuptools/config/pyprojecttoml.py", line 43, in validate
raise error from None
ValueError: invalid pyproject.toml config: `project`
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at setuptools/config/pyprojecttoml.py, especially the validation path shown in the traceback, and reproduce the failure with the pdm-pep517 checkout and pytest command in the issue. Determine the expected handling of a pyproject.toml using pdm-specific keys, then verify the reported fixtures no longer fail validation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100