silly-waitress-33423
11/04/2024, 2:52 PMpyproject.toml
(in the poetry style — as that is what the repo was configured to use pre-pants). I would like to add a new package. How do I go about finding the correct version? I used to use poetry add $PACKAGE
, but I can’t seem to find a similar goal (or subtarget) for pants. thank you (in advance)!better-van-82973
11/04/2024, 4:19 PMpython_requirement
target if you want to manage that new package through Pants, you’ll just have to make sure it belongs to the same resolve as the requirements that you’re pulling in through Poetrybetter-van-82973
11/04/2024, 4:20 PMsilly-waitress-33423
11/04/2024, 4:20 PMrequests
? pants add requests
?silly-waitress-33423
11/04/2024, 4:21 PMpants
needs to figure out a version that will work, and I’m not sure what version will work with all my other dependenciesbetter-van-82973
11/04/2024, 4:21 PMpython_requirement
target to your build file and then regenerate the PEX lockfile using pants generate-lockfiles
better-van-82973
11/04/2024, 4:22 PMpoetry add
and Pants will pick up your new package if you’ve defined a poetry_requirements
target pointing at your pyproject.toml
filesilly-waitress-33423
11/04/2024, 4:23 PMsilly-waitress-33423
11/04/2024, 4:23 PMbetter-van-82973
11/04/2024, 4:25 PMpants generate-lockfiles
to ensure that your new dependency makes it into the lockfilesilly-waitress-33423
11/04/2024, 4:27 PMhappy-kitchen-89482
11/04/2024, 10:08 PMhappy-kitchen-89482
11/04/2024, 10:08 PMhappy-kitchen-89482
11/04/2024, 10:09 PMpoetry add
is just a convenience for hand-editing pyproject.tomlsilly-waitress-33423
11/04/2024, 11:09 PMpoetry add requests
will determine a version that works, or maybe it just uses the latest version. So if it’s the later case, then I guess yeah, just always hand edit until you find a version that worksbetter-van-82973
11/04/2024, 11:10 PMsilly-waitress-33423
11/04/2024, 11:11 PMhappy-kitchen-89482
11/05/2024, 2:19 AMrequests
in the inputs to that lockfile (e.g. in pyproject.toml), and you shouldn’t need to do any manual trial and error. However you may sometimes want to manually constraint that input, to prevent the lockfile selecting a version that doesn’t have a feature you need.silly-waitress-33423
11/05/2024, 12:40 PMhappy-kitchen-89482
11/05/2024, 4:47 PMrequests = "*"
? I’m no poetry expert though, maybe that doesn’t work for some reasonhappy-kitchen-89482
11/05/2024, 4:48 PMrequirements.txt
you would just put requests
on a line by itself