poetry-plugin-export
poetry-plugin-export copied to clipboard
Export poetry dependencies without `python_version` interval
- [x] I have searched the issues of this repo and believe that this is not a duplicate.
- [x] I have searched the FAQ and general documentation and believe that my question is not already covered.
Feature Request
I have been looking for a way to export my project dependencies. I know there is the command poetry export
with its flags, which performs what I am looking for. However, I added additionally the flags --without-hashes
and --without-urls
to turn it less verbose than before.
On the conventional exporting way with pip freeze
, the format corresponds to package_name==package_version
. I can perform this same pattern on Linux with the command below, but it would be great to have an additional flag --without-pyversion
poetry export --without-hashes --without-urls | awk '{ print $1 }' FS=';'
this issue belongs in https://github.com/python-poetry/poetry-plugin-export/, not here
however I expect the answer should be "no": poetry makes you declare the range of python versions that you support and the export faithfully reflects that.
Also simply removing the python version markers indiscriminately is definitely wrong: what if some project uses foo==1.0.0
for python versions 3.7 and 3.8, but foo==2.0
for python versions 3.9 and higher?
I do not think it is "black" on this right-wrong categorization, but certainly, there is this pathway in which pip resolves dependencies for itself.
However, I do agree with your remark that poetry brings fresh air akin to this gray-and-fuzzy feature in package management.
I disagree with trying to force the programmer to accept one way of doing requirements.txt. The package should enable the programmer to reach the result they want, not dictate the format of a script and try to unnecessarily force the programmer to accept all of its commands and idiosyncrasies.
People who need a requirements.txt file without the python_version string are going to figure it out on their own regardless, but wouldn't it be much better for the package itself to have that as an inbuilt option.
Thank you brunolnetto.
poetry export --without-hashes --without-urls | awk '{ print $1 }' FS=';' > requirements.txt
@annie-maria this: https://www.youtube.com/watch?v=dQGrvCAmt-A
@annie-maria Thank you for sharing the command. I also had to remove the strict python_full_version marker since I work in GCP App Engine standard environment and there are few options for a python environment.
I think a --without-markers
flag can be a nice addition.
I come here after wasting some hours trying to figure out why my Cloud Function deployment wasn't working. It turns out that Google has a taste for plain requirements.txt .
Thank you @brunolnetto
I had the exact same problem with windmill. Their pip installer is very picky, too https://github.com/windmill-labs/windmill/issues/4376
entertainingly the most recent comment in support of this arrived near enough simultaneously with a demonstration of why it is the wrong thing to do https://github.com/python-poetry/poetry-plugin-export/issues/28#issuecomment-2371007822
Mixed opinions. To be in control is as desired as to rely on automatic actions. Faith and Science eternal battle.
What about specifying the target Python version in the export? Then the export is correct and no conditionals for the python version are needed. I just want to use sane dependency pinning where the build-in dependency installer does silly things.