Is Python making Poetry REDUNDANT?!

preview_player
Показать описание

0:00 - Intro
1:14 - PEP 735 [1]
3:06 - Dependency groups
4:38 - Editable installs
4:57 - Using dependency groups
6:40 - Closing thoughts
8:43 - Outro



If you enjoy my content, consider supporting me on Patreon or becoming a member!

If you need help with anything, feel free to join the Discord server:

I get a lot of people asking, so here's my Visual Studio Code setup!



If you have any questions, don't hesitate to ask in the comments! I'll try and answer as soon as I can, providing someone else hasn't already done so.

#python #coding #howto
Рекомендации по теме
Комментарии
Автор

python packaging is still a mess, sometimes i wish python had something similar to cargo as a standard

knolljo
Автор

We may argue whether the syntax is more or less convenient for this and that, but having a unified way of managing dependencies which can be improved over time is going to be a big win for use Pythoneers.

JaumeSabater
Автор

That is not why people use poetry. This is like saying pip will have a cleaner `--version` switch, which is wonderful, but not like a reason for changing anything, to use a bad metaphor. Early pip used to let every project uninstall the dependencies of deps installed just seconds ago, leading to nondeterministic venv creation. That led to both pipenv, poetry, which have incredibly complex solver and lock file creation algos. Pip has been playing catchup and the PEPs, which are well meaning, are going off in some other random direction to ensure that the landscape remains balkanized for at least another decade.

pythonlibrarian
Автор

I love the simplicity of conda. A more modern version like pixi seems awesome, its not feature complete yet. But I love that its a single binary and can manage other languages as well. Its also great thag it can now somewhat manage pypi packages not just conda packages. I also really love the ability to install global packages. I really dont like Python project managers that rely on python to work. Poetry for example needs many libraries.

jhonyortiz
Автор

I honestly don't get all the fuss about package managers, I do use pipenv to simplify vertualenv management (yes I am lazy), the lock files and the rest of the stuff are just an extra. How many packages do you people have to use in project?

obkf-too
Автор

Let‘s hope they include syntax for environment markers. Otherwise this will just be garbage again for any project, which should be developed on multiple platforms. I want proper lock files with hashes and environment markers. I’m going insane otherwise.

stonemannerie
Автор

I wonder how this differs from poetry. I've been using poetry over the last year, and it pretty much handles all these cases, including dependency groups (you can create arbitrary groups), editable install, and it handles them well.

I guess poetry in the past only had "dev" dependencies, but this was in an older version. I know that because it shows that this command is deprecated.

To be honest though, in my experience for some packages, the dependency resolver can be a bit slow with specific packages, like apache beam.

hazemkhairy
Автор

Thoughts on rye for package and python version management?

putnam
Автор

Not sure about the include syntax. You can already do this with the “extras” syntax. If your project.name is “analytics-workspace”, you can define and include it from with “analytics-workspace[docs]”, as though it were a published package.

I guess the include is there because these specifically aren’t published, but it seems a little silly.

Also, AFAIK pdm and poetry and everyone else in every other language tool chain calls these “dev dependencies”. “Dependency groups” is what optional dependencies already do. So, this name seems easy for PEP authors and confusing for end users.

teluial
Автор

The python community still has no standard lockfile format, and the comments here suggesting more alternatives to poetry make me want to run away from Python as fast as I can. I've been pushing for Go and Rust at work and using have been using Go as much as possible for standalone applications/scripts where python would have been used otherwise.

For the python packages I've had to write, I've been using protocols/duck typing and DI to avoid explicitly importing third party dependencies as much as possible, and I'm maximally conservative about the APIs I use to maximize the version ranges of the libraries that it may work with. That way, injecting a Pydantic model, a dbapi compliant connection object, or a callback that the user defines is something I let the user do, and I avoid the dependency mess as much as possible myself since I don't want to touch that ****.

BosonCollider
Автор

2024 but still using config files instead of code as config

maksimon
Автор

poetry has been going downhill for a while now

Ldmp
Автор

from 00:00 all I hear is bla bla bla... man you need to work on how you sound.

_nikolanenadovic
Автор

Poetry just makes me swear, a lot. Good riddance, hopefully.

mrc
Автор

I'm trying out uv and have gotten this to work:

```toml

linting = ["jupyter-black"]
testing = ["tox"]
formatting = ["ruff"]
dev = ["sql_pg[linting]", "sql_pg[testing]", "sql_pg[formatting]"]
```

$ uv pip compile pyproject.toml --extra dev > requirements.txt

nice!

NostraDavid
Автор

venv + requirements.txt 👍 simple and straight forward

samucancld