I've got a constraints file generated by `pip-comp...
# general
I've got a constraints file generated by
that includes an extra like:
Copy code
but Pants doesn't like that:
Copy code
DEPRECATION: Constraints are only allowed to take the form of a package name and a version specifier. Other forms were originally permitted as an accident of the implementation, but were undocumented. The new implementation of the resolver no longer supports these forms. A possible replacement is replacing the constraint with a requirement.. You can find discussion regarding this at <https://github.com/pypa/pip/issues/8210>.
ERROR: Constraints cannot have extras
Aren't extras required for proper support in some cases? What's the correct way to deal with an optional extra that is required by the code if I want to be freezing dependencies?
Hey Oliver! It looks like that error message is coming from pip, rather than Pants. I believe if you keep the extra in the requirements.txt, the extra will still end up getting resolved. So for now, try removing it from the constraints. Is that working or not doing what you'd want? -- Btw, my main project this month is revisiting Python dependency management to improve some things like: 1) add dedicated lock files per tool 2) support multiple lockfiles possible for your own code 3) Pants can generate lockfiles for you It's very likely we will stop using Pip's constraints file feature and instead use a different approach that sidesteps these limitations of constraints files, which will avoid this problem you're having
cool. Thanks!
❤️ 1
Yeah, I think the purpose of the constraints file is just to lock versions, but the extras still have to be in requirements.txt. This is a pip-level thing.