pants icon indicating copy to clipboard operation
pants copied to clipboard

pants cannot infer package extra from poetry configuration in pyproject.toml

Open Sage0614 opened this issue 11 months ago • 3 comments

Describe the bug when a poetry_requirement is provided, pants only infer the package on the surface level as dependencies but not package extra, for example, if I provide

[tool.poetry.dependencies]
polars = {extras = ["adbc"],version="^0.20.16"}

only polars with be infered as project dependency, but not adbc. this is confirmed by running pants dependencies and cause pants test :: to fail due to missing dependency of adbc

Pants version 2.19.1

OS Linux

Additional info Add any other information about the problem here, such as attachments or links to gists, if relevant.

Sage0614 avatar Mar 22 '24 17:03 Sage0614

Shouldn't be too hard to fix. @Sage0614 , want to take a crack at it?

benjyw avatar Mar 23 '24 14:03 benjyw

It looks like we do attempt to do something with extras: https://github.com/pantsbuild/pants/blob/0cada92c46d56dbb0b1870d7af97ba6790d41e30/src/python/pants/backend/python/macros/poetry_requirements.py#L275

So it would require debugging that code to see if and why it's not doing the right thing.

benjyw avatar Mar 23 '24 14:03 benjyw

Shouldn't be too hard to fix. @Sage0614 , want to take a crack at it?

I am pretty new to pants, I can try after getting familiar with it, it may take some time.

Sage0614 avatar Mar 24 '24 15:03 Sage0614