7 ms·
Poetry is a modern packaging system for Python. It's really good. I hope everyone converges on it. http://python-poetry.org/ http://python-poetry.org/
by j88439h84 7y ago
Poetry is a modern packaging system for Python. It's really good. I hope everyone converges on it.
http://python-poetry.org/ http://python-poetry.org/
- xzel 7y agoI just started up a project using this. It’s pretty good so far. The documentation on common tasks is a little bit lacking. VS Code integration is sort of broken in a few random ways (for example if I try and do a find all function definition it just hangs). I also wish there was a npm style script section in the definitions. I do think it really just works though and I think it’s a great solution compared to requirements.txt.
- j88439h84 7y ago> I also wish there was a npm style script section in the definitions. Is that like [tool.poetry.scripts] ?
- xzel 7y agoI don't think so. From their docs: > This section describe the scripts or executable that will be installed when installing the package I want something such that I can run `poetry run script_name` and it will run that command line in the poetry context. Right now I either rely on my bash history or use a bash script to mimic the behavior of npm / yarn scripts. I want to turn this `poetry run python project_name/main.py` into an alias like `poetry run main` or `poetry run dev`.
- skrtskrt 7y agoI echo the sentiments about documentation. It works great but they really need to verbosely document every command option and usage. They seem like they’re trying so hard to keep the website clean and minimal, but docs are not the place for that.
- altoidaltoid 7y agoWhere is that XKCD about new standards... Ah yes: https://xkcd.com/927/ https://xkcd.com/927/
- chc 7y agoPoetry is...a little quirky. I've seen it go into infinite loops trying to resolve projects with, like, 10 dependencies. I'm not really sold on it being better than just making a virtualenv and pip installing.
- jshen 7y agoHow do other people replicate your venv? How does production replicate your venv?
- judge2020 7y agoPipenv still works for me with everything version pinned.
- takeda 7y agoCreate setup.cfg (it is better than setup.py, since it is declarative) listing immediate dependencies, use requires.txt as a lock file (I prefer to use pip-compile from pip-tools).
- kelnos 7y agoYou pin all your direct dependencies in requirements.txt, run "pip freeze >requirements-frozen.txt" to get a list of the versions of all dependencies (direct and transitive), and then you ship that. Replicating is just "virtualenv --python=python3 venv && . ./venv/bin/activate && pip install -r requirements-frozen.txt". Am I missing something here? Yes, to be absolutely sure, you need to have the same versions of python, pip, setuptools, gcc (for C extensions), C library dependencies, etc. on both systems that do the build, but that's the case for pretty much any build system out there if you want repeatable builds. And if you you just don't feel like dealing with that, you can just use Docker (aka "put my machine in a tarball and ship it").
- jshen 7y agoThis is worse than how it’s done on most modern languages.
- kitanata 7y agoWe've recently standardized on using Poetry at JP Morgan Chase for projects in our Organization. We're betting on it becoming a standardized tool everywhere.
- BiteCode_dev 7y agoUnfortunately, you need to: - discover it - install it properly - run it properly - make it create a venv with the proper python version - potentially import data from existing setup.py/cfg - make sure you are always in the right dir when you use it - not be on windows (poetry shell doesn't work there) - IDE integration is not great - people have to chose between this, pip, pip-tools, flit, pipenv, dephell, conda... And you cannot use it if you are not "in a project". But not all venv are project related.
- j88439h84 7y ago> - not be on windows (poetry shell doesn't work there) Ok that's a bug, probably fixed soon. Otherwise, most of these are true of many popular packaging tools in other languages.
- BiteCode_dev 7y agoWell, not pip and venv. It's provided on windows and mac automatically. venv forces you to chose the version of python. venv doesn't care if you are in project mode or not. IDE integration is great.