https://pantsbuild.org/ logo
g

gray-shoe-19951

12/19/2022, 3:44 PM
A question on the poetry_requirements macro. Is there a way for pants to ignore dev-dependencies in project.toml?
h

hundreds-father-404

12/19/2022, 3:47 PM
Not currently, but it would be reasonable and not super hard to add a field to it called
dev_dependencies
, with a default to True. Any interest in adding that? If so, I'm happy to give some thoughts on how to implement it
g

gray-shoe-19951

12/19/2022, 3:49 PM
Sure. Sounds a fun task if I am bored during the holiday.
h

hundreds-father-404

12/19/2022, 4:02 PM
Cool! So you'd add a
BoolField
subclass in src/python/pants/backend/python/macros/poetry_requirements.py with a default to True. https://www.pantsbuild.org/docs/target-api-new-fields talks about how to add a new field Then it looks like you'll want to modify the function
parse_poetry_requirements
to take an argument for whether to include dev dependencies. With this line
parse_requirements_callback=partial(parse_poetry_requirements, build_root),
, you'll want to add to the args something like
dev_dependencies=request.generator[MyNewField].value
4 Views