<#23690 python_requirements does not tag dependenc...
# github-notifications
q
#23690 python_requirements does not tag dependencies from project.optional-dependencies Issue created by MaicoTimmerman Describe the bug The
python_requirements
target documentation states that dependencies loaded from a PEP 621
project.optional-dependencies
table receive the optional dependency group name as a tag on the generated python_requirement:
Further details about PEP 621 and pyproject.toml files are available from the PEP itself: https://peps.python.org/pep-0621/. If the project.optional-dependencies table is included, Pants will save the key/name of the optional dependency group as a tag on the generated python_requirement.
ref: https://www.pantsbuild.org/dev/reference/targets/python_requirements However, Pants currently discards the group names and generates these targets without the documented tags. This results in optional dependency groups cannot be used for tag-based target filtering or visibility rules. Reproduction: Create `pyproject.toml`: [project] dependencies = [] [project.optional-dependencies] test = [ "pytest>=8", ] Create `BUILD`: python_requirements(source="pyproject.toml") Then inspect the generated target: pants peek //:reqs#pytest The generated
python_requirement
has no
test
tag. While docs suggest the it should have: "tags": ["test"] Pants version Pants 2.33.1 OS All Additional info: Open to contributing a fix for this. pantsbuild/pants