-
Notifications
You must be signed in to change notification settings - Fork 54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow exporting constraints for pip #125
Comments
We would definitely do this as Also, if you're exporting pinned versions, what use case requires |
Thanks for the quick feedback. I'll take a deeper look and see how feasible it'd be for me to write the new exporter myself. My use case is for https://github.com/certbot/certbot. It's a large monorepo containing many Python packages, some of which need to be able to function without the others, and the dependencies vary based on the OS and Python version. To help us pin everything down more reliably while allowing us to install only the subset of packages that's actually needed, we have dummy pyproject.toml files under https://github.com/certbot/certbot/tree/master/tools/pinning and scripts that use poetry to generate and export files which we then use as constraints for pip. |
Adding a constraints export method to https://github.com/python-poetry/poetry-plugin-export/blob/main/src/poetry_plugin_export/exporter.py doesn't look too bad. Do you know if this text from https://pip.pypa.io/en/latest/user_guide/#constraints-files contains the full list of differences that you'd want?
I'm imagining just dropping any extras declared for the package. For the two conditions of "constraints must have a name" and "they cannot be editable", I'd either error out or exclude the package based on y'all's preference. How does that sound? |
I personally would factor out You have found the canonical source for the format -- I would suggest failing for now myself on any unexportable constraints. |
Thanks for the guidance. To be clear, are you OK with the constraints exporter dropping extras (e.g. turning |
I think it only makes sense to drop extras, as by definition constraints.txt is 'versions without install details.' The same packages will be captured anyway as Poetry locks all requested extras. Editable installs are ambiguous and I think we should error for them. You won't need to deal with unnamed constraints as the exporter already names them with Looking at the code instead of remembering what it used to look like, it looks like we've already got support for format-based dynamic dispatch. As such I'd suggest that you simply move the body of |
This also came up in #108 Not to discourage contributions - quite the opposite, this is evidence that there's real demand for this! - but as I suggested there, you might find it considerably less effort to |
I don't disagree @dimbleby, but I do think that given certbot does seem to need 'real' constraints, first class support is a good idea so that they don't break in the future because of a brittle reliance on sed/"don't set |
I'm absolutely not against Someone adding this function - as I say, evidence is mounting that it's a thing people want. I do think it's only fair to be sure that OP is aware that they probably have quicker (and dirtier) solutions available before they spend a bunch of time being that Someone. |
I opened #128 for this. |
`constraints.txt` does not support develop (editable/`-e`) dependencies, or extras, but is otherwise symmetrical with `requirements.txt` Fixes #125 Co-authored-by: Bjorn Neergaard <[email protected]>
The format 'requirements.txt' is no longer compatible with pip contraints. This change adapts the poetry export call to use the new 'constraints.txt' format. see also: python-poetry/poetry-plugin-export#125
The format 'requirements.txt' is no longer compatible with pip contraints. This change adapts the poetry export call to use the new 'constraints.txt' format. see also: python-poetry/poetry-plugin-export#125
The format 'requirements.txt' is no longer compatible with pip contraints. This change adapts the poetry export call to use the new 'constraints.txt' format. see also: python-poetry/poetry-plugin-export#125
The format 'requirements.txt' is no longer compatible with pip contraints. This change adapts the poetry export call to use the new 'constraints.txt' format. see also: python-poetry/poetry-plugin-export#125
I've been using
poetry export
to generate a constraints file for use with pip. Sometime after the poetry 1.2.0a2 and poetry-core 1.1.0a7 releases, this command is now includes extras in its output such asdocker[ssh]==6.0.0
which is not supported in pip constraints files.Would you be open to at least adding an option to change this behavior? The easiest to implement would probably be something like a
--no-extras
flag (which may need a better name to avoid confusion with--extras
). Another option would be to add support for aconstraints.txt
format.The text was updated successfully, but these errors were encountered: