poetry-core
poetry-core copied to clipboard
Add support for the `project` section (PEP 621)
Closes #567
should not be squashed
Hints:
- Do not rebase without updating the downstream branch python-poetry/poetry#9135
- Downstream tests were disabled because this will be breaking for downstream
Notable changes compared to #567 or "why I did not just rebase it":
- Instead of two complete schemas (one legacy and one PEP 621), I decided to introduce two partial schemas (one for
tool.poetryand one forproject). Reasoning:- By introducing the non-package mode, having one legacy schema and one PEP 621 schema as in #567 does not work well anymore. In non-package mode all
projectfields are optional. - Further, I had difficulties distinguishing the definitions of the
projectsection and thetool.poetrysection in the PEP 621 compatible schema. - Using a complete schema makes it easier to define relations between the
projectsection and thetool.poetrysection. However, this would require heavy use ofanyOf(because of the non-package mode) and this results in hard-to-understand error messages, see https://github.com/python-poetry/poetry-core/blob/7d40189393b441b975f7490845204a5598813730/src/poetry/core/factory.py#L390-L404 Thus, it makes more sense not to useanyOfand validate the relation between both sections in thevalidate()method anyway.
- By introducing the non-package mode, having one legacy schema and one PEP 621 schema as in #567 does not work well anymore. In non-package mode all
- See https://github.com/python-poetry/poetry-core/pull/567#issuecomment-1962301897
- Do not introduce
[tool.poetry.dependency-options]but keep[tool.poetry.dependencies], just make version optional and implement the distinction/merging of abstract dependencies ([project.dependencies]) and concrete dependencies ([tool.poetry.dependencies]). - Do not change anything related to
[tool.poetry.group]. That especially makes sense since there might be a standard way for dependency groups in the future (see PEP 735) so we can have the same distinction between abstract and concrete dependencies.
- Do not introduce
- Deprecate fields in
tool.poetrythat can be completely replaced by fields in theprojectsection, seeFactory.validate().
another way to do this would be not-chaning poetry's internal layout of configuration at all, and just mapping the project section's features into poetry's features, right?
Quality Gate passed
Issues
8 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
@radoering @charliermarsh What's the status of this PR?
What's the status of this PR?
It is ready for review.