DEV Community

Productive Python with Poetry

Dylan Anthony on May 18, 2019

This is part of a series explaining the different options for managing Python dependencies. Make sure you've read the previous posts, this one w...
Collapse
 
rhymes profile image
rhymes

Thanks Dylan, these series has been really informative! I'll definitely take a look at Poetry.

The fact that it can export to requirements.txt shouldn't make deploy a big deal, most PaaS services support requirements.txt. I guess that if it becomes a bigger project they'll add support for its own lock files, the same way it happened for Pipenv.

Didn't know about hatch and dephell seems a tool created by someone that was so fed up with the current state of package management that they said to themselves "f*ck it, I'm going nuclear, I'll support everything"

Collapse
 
rhymes profile image
rhymes

I'm testing it already with a project, the UI is much better and the tool seems faster.

The poetry.lock is also much more readable for a human (it's common that one wants to know exactly which version of a transitive dependency is installed).

poetry init was a great experience with its search and everything. poetry update is insanely faster than Pipenv's. Search and publish are game changers. Love the version command as well.

The export functionality definitely needs some love but I guess I'm a convert now, thanks again Dylan! :D

Collapse
 
dbanty profile image
Dylan Anthony

I’m glad you tried it and liked it! Pretty sure there are already improvements to export underway, it’s just a matter of time.

Another great thing I didn’t mention is that the code quality is very good. While they don’t have the Python API documented yet, it didn’t take me long at all to figure out how to make a custom build script which adds some extra export functionality just by reading the code.

Thread Thread
 
rhymes profile image
rhymes

it didn’t take me long at all to figure out how to make a custom build script which adds some extra export functionality just by reading the code

wow that's great!

Collapse
 
orsinium profile image
Gram

Nice article! BTW, I'm the author of DepHell :) The coolest thing about DepHell is you can use it along with poetry. DepHell can audit dependencies, show licenses list, make requirements.txt, bump project version etc.

If you find lack of some features -- please, open an issue. I am happy to make DepHell better :)

Collapse
 
dbanty profile image
Dylan Anthony • Edited

Great to hear from you! We actually have a smattering of projects using Pipenv that I’ll someday have to convert to poetry. I found DepHell when looking for a tool to convert between the two (since Poetry can’t do it natively yet).

Using it as a better poetry export tool sounds like a good idea too, I can more easily convince people to use the non-alpha version of Poetry.

Okay, I guess I’ll take a closer look at it and give it a go, especially now that you’re on DEV :).

Collapse
 
orsinium profile image
Gram

especially now that you’re on DEV

I've registered here for you <3 I'm looking at all mentions of DepHell to get feedback and make it better.

Collapse
 
dbanty profile image
Dylan Anthony

I’ve just been reading through the docs, they are very thorough. Being able to really understand what a tool does just by reading the docs is rare, well done!

The one thing I didn’t see any mention of is private PyPI repositories. Seems like dephell uses its own resolver and isn’t just a wrapper around Poetry, so it probably doesn’t use the configured credentials. I think this means it wouldn’t work for converting between formats if they use private repos and wouldn’t work for installing/adding/etc. if some packages were private.

Please correct me if I’m wrong, but if I’m not, private repo support is the only thing holding me back from using this.

Collapse
 
orsinium profile image
Gram • Edited

Private warehouse on the way:
github.com/dephell/dephell/issues/53
You can subscribe on this issue and get a notification when it is done :)

I also have some projects with a local warehouse (artifactory), so I interested in this feature too. For a while, I use DepHell for environments management in these projects.

Collapse
 
cjadeveloper profile image
Cristian Javier Azulay • Edited

Ey, nice article!

I think you have a mistake. In the "Virtual Environments" paragraph, you wrote:

  • Activating the environment: pipenv shell (also spawns a new shell)

I think you wanted to write: poetry shell, isn't it?

Collapse
 
dbanty profile image
Dylan Anthony

Yes, you are correct. Thank you and fixed!