Goodbye Virtual Environments?

  • Learning curve: explaining “virtual environments” to people who just want to jump in and code is not always easy
  • Terminal isolation: Virtual Environments are activated and deactivated on a per-terminal basis
  • Cognitive overhead: Setting up, remembering installation location, activating/deactivating

Enter PEP 582 — Python local packages directory

Try it Today

> piploc install requests
Successfully installed certifi-2018.11.29 chardet-3.0.4 idna-2.8 requests-2.21.0 urllib3-1.24.1
> tree -L 4
.
└── __pypackages__
└── 3.6
└── lib
├── certifi
├── certifi-2018.11.29.dist-info
├── chardet
├── chardet-3.0.4.dist-info
├── idna
├── idna-2.8.dist-info
├── requests
├── requests-2.21.0.dist-info
├── urllib3
└── urllib3-1.24.1.dist-info
> python -c "import requests; print(requests)"
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'requests'
> pythonloc -c "import requests; print(requests)"
<module 'requests' from '/tmp/demo/__pypackages__/3.6/lib/requests/__init__.py'>
pip install --user pythonloc

Installing Multiple Dependencies or Lockfiles

piploc install .
piploc install -r requirements.txt
pipenv lock --requirements
poetry run pip freeze > requirements.txt

Freezing Dependencies

pipfreezeloc
requests==2.21.0
pip freeze > requirements.txt
pipfreezeloc > requirements.txt

Update (2/19/19): What about …?

BINARY [ARGS] # i.e. pytest --help
pipx run BINARY [ARGS] # i.e. pipx run pytest --help

Conclusion

--

--

--

Software engineer and open source developer https://github.com/cs01

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Configuring WebServer & Python Interpreter on Docker Container

This week in DApps — Ep. 07

[TW]²: Aug 19 — Aug 25 2019 | #34

The Jenkins Operator 0.7.0 on Openshift 4

Redis to the Rescue

How a Little-Known Jackson Feature Helped Secure My Domain Code

Workflow Task Configuration SQL

New Relic Alert Policies

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Chad Smith

Chad Smith

Software engineer and open source developer https://github.com/cs01

More from Medium

Installing TensorFlow with GPU support on Windows 10 with nvidia graphics card in 5 steps

Optimization with Python: Solving Infeasibility with Google OR Tools

System Reliability Optimization by Evolutionary Strategy

How to Improve Portfolio Performance with Markowitz Optimization