Piton is a python package manager modelled after NPM. Piton makes it easier for Python developers to share and reuse code. It makes package management simple by doing the following:
-
Install packages locally at
python_modules
folder -
Track dependencies in
package.json
with NodeJS-like semantic versioning{ "pythonDependencies": { "djangorestframework": "^3.3.3", "django": "^1.9.1" }, "pythonDevDependencies": { "django-debug-toolbar": "1.0.0" } }
-
Automatic management of nested dependencies. Packages that are installed via nested dependency are removed automatically once packages requiring it are removed
-
Simplify unreasonably verbose pip commands such as
install --upgrade <package> >> requirements.txt
andlist --outdated
to more human friendly npm-like commands.update
,outdated
,install --save
, etc
Our plans are implement all the features mentioned in the docs repo.
pip install piton
piton <command>
piton init //creates a package.json
piton install django --save
piton install django-debug-toolbar --save
IMPORTANT: ADD python_modules as a python path
-
Method 1:
Add
.python_modules
toPYTHONPATH
in.bash_profile
Or use
piton path --save
to do it automatically. -
Method 2 (more explicit):
Use the following code at each application entry point:
def setup_path(): import sys import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) #OR where the python_modules folder is at sys.path.append(os.path.join(BASE_DIR, "python_modules")) setup_path()
-
Method 3 (recommended):
Use piton as a task runner:
-
Define application entry points in
package.json
underscripts
{ "scripts": { "develop": "python3 manage.py runserver" }, "pythonDependencies": { ... } }
-
Run task with
piton run <task>
-
Command | Status |
---|---|
init | working |
outdated | working |
install | working |
remove | working |
update | working |
bugs tracker | planned |
run | working |
list | working |
prune | working |
path | working |
Piton is all about making package management local. While it replaces Virtualenv, it is not meant to be a repalcement for setuptools.
Piton continues to use setuptools, and PYPI in the background, along with very limited use of pip. In future versions the dependency on pip will be removed.
Piton can be run with develop_entry.py without installing.
Deployment:
# Change version number in setup.py
python3 setup.py sdist upload -r pypi
# Amend commit with egg-info