pipm
pipm copied to clipboard
Python dependency management workflow using setup.cfg and requirements files without reinventing the wheels
Deprecation Notice: Since PEP-621 is now accepted, it is advised to use pyproject.toml to store the Project's dependency list. Here are some projects supporting PEP-621
pipm
Python package management using pip, requirements file & setup.cfg.
Installation
- Adviced to install only inside virtualenv
Install from PyPI
pip install pipm
Note:
- This tool manipulates all your requirements file. So be sure to use a version control software to keep track of the changes.
Quickstart
- Both
pipandpipmcommand will work as the same. - Create a virtualenv for the project and install pipm with
pip install pipm
- Create an alias as
alias pip=pipmor use as it is -pipm
I. Install
- install all your dependencies from the base requirements file (
requirements.txt)
pipm install
pipm install --all # *requirements*.txt - all environment -> test/prod/dev
2. Add new packages to project
pipm install pkg-name
pipm install pkg-name --dev # as development dependency
pipm install pkg-name --test # as testing dependency
3. Removal of packages
- Remove one or more packages. Their dependencies will also get uninstalled. No orphaned packages.
pipm uninstall pkg-name
4. update all your dependencies in requirements.txt
pipm update
pipm update --dev
Features
- No new set of files.
*-requirements.txtworks like the lockfile with pinned versions - Just a wrapper around the standard pip's
install/uninstallcommand. So all the cli options will work - Handles multiple
requirementsfiles and setup.cfg stores abstract dependencies.
Commands
1. install
- a wrapper around standard
pip installcommand and accepts all the standard options
Below are the things that pipm brings to the table
- Extra functionality
- when package names are given it will be saved to the requirements.txt file in the current directory.
If you have
requirementsdirectory structure withbase.txtinside then that file will be used. Otherwise it will create one in the current directory. - when no package name is given then it is equivalent to
-r requirements.txtand it will install all requirements from the current directory
- when package names are given it will be saved to the requirements.txt file in the current directory.
If you have
- Additional options:
It will search for the matching one in the following pattern
<name>-requirements.txtorrequirements/<name>.txtorrequirements-<name>.txtthe below saves to file when package name given otherwise equivalent to passing requirements file name.--dev- saves to development requirements--prod- saves to production requirements--test- saves to testing requirements--doc- saves to documentation requirements--env <name>- if you have any special set of requirements that belong to a separate file you could pass the name here.
2. uninstall
- a wrapper around standard
pip uninstallcommand - alias
rmis available - when uninstalling a package, this command also checks packages that are no longer required by any of user installed packages and removes them
- ofcourse it removes the packages from
requirementsfiles
3. update
- new command
- equivalent to calling
pip installwith--upgradeflag - update a single package or the whole environment when no argument given.
- by default the packages are updated interactively
- set
--auto-updateto disable this
- set
4. save/freeze
- extends the standard freeze command to save the currently installed packages
Development
- clone the repository and create new virtualenv
git clone [email protected]:jnoortheen/pipm.git
cd pipm
pew new pipm -a .
pip install -r dev-requirements.txt
- to test from local sources
pip install -e .
- Commit message should follow this style-guide.
Testing
- run
invoke testfrom the root directory.
TODOs:
- rm will check whether a package is present in setup.cfg