Skip to content

How does it compare to pipenv? #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
abloch opened this issue Feb 7, 2019 · 2 comments
Open

How does it compare to pipenv? #2

abloch opened this issue Feb 7, 2019 · 2 comments

Comments

@abloch
Copy link

abloch commented Feb 7, 2019

Pipenv is an official tool supported by pypa
And to my best understanding serves a similar idea in a different way.

Could you please describe the pros and cons of each?

@florimondmanca
Copy link

florimondmanca commented Feb 15, 2019

@abloch i haven’t built pythonloc but here’s my POV:

Pipenv does indeed allow to have per-repository dependencies, but it still uses virtual environments under the hood and requires you to use them anyway (see pipenv shell). So it still has that kind of cognitive load and learning curve for beginners, although it is very convenient once you know how it works and how to use it IMO.

From my understanding, pypackages (of which pythonloc is an early implementation) doesn’t use virtualenvs at all — it just modifies the PATH to prefer importing from local packages instead of other ones. It’s a very intuitive workflow I think, and again simplicity and beginner-friendliness is a big pro. Even for seasoned devs, I think this would simplify greatly how we manage dependencies on a per-project basis.

One con I may see is ok isolation — it seems pypackages encourage you to use your system Python everywhere. It means you may have access to packages you haven’t installed locally (and your project doesn’t dépend to) if you don’t take enough care. Maybe there’s an option in the pypackages spec to address this that I’m not aware of.

@zooba
Copy link
Contributor

zooba commented Feb 15, 2019

(Disclosure: I'm a co-author of PEP 582 that this is implementing.)

Florimond's answer is basically correct. The fundamental difference is that when implemented, CPython will no longer need to rely on your terminal being configured correctly to locate your packages.

Like venv and virtualenv (and also pipenv), it basically relies on sys.path having more entries in it when you start running. For the existing tools, you need to have configured environment variables in your terminal for this to work (which is done by a combination of activating the environment and/or launching Python via a symlink/redirector where CPython is able to figure out that it's in a venv - and believe me, this code in CPython is far messier than what PEP 582 would require!)

The other difference from pipenv (and also venv/virtualenv, depending on how you use them) is that your dependencies live in the same directory as your code. So your entire directory is totally relocatable to anywhere else on your machine or (if you're careful about native dependencies) another machine. It is the lightest-weight isolation we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants