poetry-plugin-export icon indicating copy to clipboard operation
poetry-plugin-export copied to clipboard

Export poetry dependencies without `python_version` interval

Open brunolnetto opened this issue 1 year ago • 10 comments

  • [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=';'

brunolnetto avatar Apr 01 '23 13:04 brunolnetto

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?

dimbleby avatar Apr 01 '23 13:04 dimbleby

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.

brunolnetto avatar Apr 01 '23 13:04 brunolnetto

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 avatar Oct 02 '23 21:10 annie-maria

@annie-maria this: https://www.youtube.com/watch?v=dQGrvCAmt-A

brunolnetto avatar Oct 02 '23 21:10 brunolnetto

@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.

david1542 avatar Mar 11 '24 10:03 david1542

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

dnnane avatar Apr 05 '24 09:04 dnnane

I had the exact same problem with windmill. Their pip installer is very picky, too https://github.com/windmill-labs/windmill/issues/4376

dereisele avatar Sep 24 '24 11:09 dereisele

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

dimbleby avatar Sep 24 '24 13:09 dimbleby

Mixed opinions. To be in control is as desired as to rely on automatic actions. Faith and Science eternal battle.

brunolnetto avatar Sep 24 '24 13:09 brunolnetto

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.

dereisele avatar Sep 24 '24 14:09 dereisele