Live data from Hacker News

Current State of Python Packaging

stefanoborini.com

41–50 of 77 posts

Re: Current State of Python Packaging

#41

Yet another state of python packaging that: - skip the explanation on the py command on windows, the version suffixes on unix, -m and why you need to install pip on linux but not on the other OSes. - doen't address the various sys path issues of pip and poetry. Because at some point you need to install peotry. - ignore the existence of the excellent and simple setup.cfg. - ignore the consequences of using poetry on I…

> Python packaging is not hard anymore Would you tell us which is "the right way to do it" nowadays? Possibly, in a maintainable, kind-of-officially supported way that doesn't change or disappear in a few months? Please note: I use Python professionally since 2005, I've been involved a lot in Python packaging for production apps (including giving some talks on the bad state of Python packaging at Europython around 20…

Not on my phone from the subway, but maybe when I'm back at home I'll take the time.

Re: Current State of Python Packaging

#43
post #40

Yet another state of python packaging that: - skip the explanation on the py command on windows, the version suffixes on unix, -m and why you need to install pip on linux but not on the other OSes. - doen't address the various sys path issues of pip and poetry. Because at some point you need to install peotry. - ignore the existence of the excellent and simple setup.cfg. - ignore the consequences of using poetry on I…

Hi, I am the author of the post. Thank you for the ideas. The post is meant to be "dynamic" and I will integrate your ideas in it. I just woke up so in an hour or so I will update it.

Kudos

Re: Current State of Python Packaging

#44
post #29

I'm not sure what Poetry tries this to simplify on the development side... using venv and pip/requirements.txt is simple enough for me. And you don't even have to do it by hand, Pycharm will do it for you and activate the right venv in the shell tab. Distribution is something else, but I wouldn't expect users to type commands in a shell anyway, so there is only a need for one-click installers and/or self contained ex…

In deployment you'll still need to use the command line. Poetry is IDE and OS agnostic. It manages also the lock file, and resolve deps better than pip. At last, it lets you put all meta data in one file, including dev deps, then build a wheel. You can do that with regular setuptool and setup.cfg and it's compatible with pip though.

I don't have a problem with the command line, I just find the argument of "tool X and tool Y are boring to use so you'd better tool Z" (as found on the linked article) a bit weak. I guess that's one of these tools that solves problems I don't have (like the need for a lock file... just specify the version in requirements.txt), so unless it becomes the new standard, I'll stay away from it. But I'm sure it's gonna be helpful for many.

Re: Current State of Python Packaging

#45
post #44

Earlier quoted context omitted.

In deployment you'll still need to use the command line. Poetry is IDE and OS agnostic. It manages also the lock file, and resolve deps better than pip. At last, it lets you put all meta data in one file, including dev deps, then build a wheel. You can do that with regular setuptool and setup.cfg and it's compatible with pip though.

I don't have a problem with the command line, I just find the argument of "tool X and tool Y are boring to use so you'd better tool Z" (as found on the linked article) a bit weak. I guess that's one of these tools that solves problems I don't have (like the need for a lock file... just specify the version in requirements.txt), so unless it becomes the new standard, I'll stay away from it. But I'm sure it's gonna be h…

The lock file doesn't just specify the version of the packages, but of all dependancies as well, in a nested manner. This let poetry detects incompatibilites you can't with a flat requirement file.

Poetry also updates the files properly at each install, so you don't have to do it. And it can't install something outside of a venv by mistake.

But yes, a requirement file is ok in many cases. I use them myself often.

Re: Current State of Python Packaging

#46

I’ve been coding in Python for about 8 years now and this is the first time I’ve even heard of Poetry.

For 7 of those years Poetry didn't exist. For the 8th year however Poetry and Pipenv have been pretty big news in the Python packaging world.

Re: Current State of Python Packaging

#47
post #39

Earlier quoted context omitted.

It was NEVER recommended by any Python organization or official person, it was just Kenneth's usual bullshit marketing.

In the link below it says, “Pipenv is recommended for collaborative projects” https://packaging.python.org/tutorials/managing-dependencies...

Yes, they toned it down, but still to a wording that suggests a formal recommendation. If you find the discussion, it was not meant to be an exclusive recommendation. Bit of a mistake, in my opinion.

Re: Current State of Python Packaging

#48
post #29

I'm not sure what Poetry tries this to simplify on the development side... using venv and pip/requirements.txt is simple enough for me. And you don't even have to do it by hand, Pycharm will do it for you and activate the right venv in the shell tab. Distribution is something else, but I wouldn't expect users to type commands in a shell anyway, so there is only a need for one-click installers and/or self contained ex…

using venv and pip/requirements.txt is simple enough for me

Sure - it depends on what you're doing. Requirements.txt won't work if you're writing a library; you'll need to move (or duplicate) your dependencies into setup.py.

Re: Current State of Python Packaging

#49

I really hope poetry will win. It's just so good, easy to use and just works.

I like poetry but it comes with 2 problems: - it uses only pyproject.toml. Despite the current com on this format, it's not stable, it's an incomplete standard and it's not well supported by the ecosystem. Setup.cfg is a much better alternative in the mean time. In fact, just the auto include features make it better. - there is no nice way to install it. Pip install poetry is the usual one, and it got many gotchas fo…

The point about the beginners is solid, but consider the use case for Poetry: you need it if you want to package and publish a library, which is not an area I would associate with beginners.
Post reply on HN