Helps you manage python libraries and environments
pip install git+https://git.io/plm.gitCreate and activate an environment:
plm
# equivalent to: plm create && plm activateThen, you can install a package:
plm install requests numpy
# also works: plm i requests numpyNow requests and numpy will be installed in your venv/ and they will also be added to requirements-dev.txt and requirements.txt.
Traditionally, to create an environment and activate it:
python -m venv venv
source venv/bin/activateThen, to install a library and track dependencies:
pip install requests numpy
echo -e "requests\nnumpy" >> requirements-dev.txt
pip freeze > requirements.txtInstead, with plm, you just need to do this:
plm create
plm activate
plm i requests numpyFurthermore, it's easier to manage a project dependencies for GitHub projects. If you used plm to manage a project and pushed it to a repo username/project, then someone can start using your project using the following commands:
git clone https://github.com/username/project.git
cd project/
plm
plm iit is essentially equivalent to this:
git clone https://github.com/username/project.git
cd project/
python -m venv venv
/bin/bash --rcfile venv/bin/activate # slighly different from source <script>
pip install -r requirements-dev.txt # or requirements.txtYou can customize the name of the venv:
plm create myvenv
plm activate myvenvplm install has the shorthand plm i. There's many ways to install packages:
plm install requests
plm i pandas==1.*
plm i numpy PillowYou can also install from a file:
plm i -r requirements.txtIf you don't specify anything by running
plm iplm will install the libraries specified in requirements-dev.txt, or fall back to requirements.txt if the former does not exist.
requirements-dev.txt loosely keeps track of your packages, which is good for readability and upgradability. It will be updated every time you pip install a package, e.g. if you run plm install <package 1> <package 2> then it will look like this:
<old package 1>
...
<old package N>
<package 1>
<package 2>
requirements.txt on the other hands keeps track of the exact requirements (e.g. for deploying to a server). It's the output of pip freeze > requirements.txt.
plm's not meant as a replacement for pip or venv, it simply wraps usual/repetitive commands in a easy-to-remember CLI. The codebase is < 200 lines, which makes it ideally for forking and extending. If you are planning to do more serious environment managment, please use conda, which also has conda create and conda activate commands and has significantly more features. If you are planning to do serious dependencies management, use pipenv instead.
Commands like create, activate are inspired from conda. install (or i) is inspired from npm.