Skip to content

Conversation

@abravalheri
Copy link
Contributor

Summary of changes

  • Dependencies set in pyproject.toml now completely overwrite setup.py install_requires.
  • Add warning when the overwriting take place.

For the time being, no action is taken on optional-dependencies, because of the internal mechanism setuptools uses for handling environment markers (internally environment markers are transformed in extras so we need to merge existing optional dependencies to the ones given in pyproject.toml, see #3223).

Closes #3300

Pull Request Checklist


def _dependencies(dist: "Distribution", val: list, _root_dir):
existing = getattr(dist, "install_requires", [])
_set_config(dist, "install_requires", existing + val)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm reading PEP 621 wrong, couldn't dependencies also be one of the keys that can be specified as dynamic? Wouldn't this always overwrite?

Copy link
Contributor Author

@abravalheri abravalheri May 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nullableVoidPtr thank you very much for the review. It is very appreaciated!

Yes, that is correct, dynamic can contain dependencies. But in that case the dependencies key cannot be present in the project table (according to PEP 621, a key can only be specified either statically or dynamically, never both -- this should enforced during the validation phase).

In turn, this means that the _dependencies function will not be called (line 66 of setuptools/config/_apply_pyprojecttoml.py). Right?

Copy link
Contributor

@nullableVoidPtr nullableVoidPtr May 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yep, all good; wasn't looking at the bigger picture 😅 LGTM

@abravalheri abravalheri merged commit aec2215 into pypa:main May 16, 2022
@abravalheri abravalheri deleted the issue-3300 branch May 16, 2022 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] PEP 631 TOMLs can conflict with deprecated configuration files

2 participants