/mr-piper

The super simple project package manager

Primary LanguagePython

Mr Piper 🎻🐍 - Super simple project package manager

windows linux macos

image0 image1 image2 image3 image4 Travis


Heavily inspired by yarn, Piper offers a dead simple way to manage a project's dependencies (and more).

Piper uses pip and virtualenv under the hood, and (just like NPM and Yarn) always installs packages in a project isolated environment.

Piper makes it easy to make modules installable (and updatable) via a piper.json JSON file, instead of fiddling with setup.py.

https://i.imgur.com/QfiOH6z.gif

πŸ€” Why?

  • No need to jump through countless hoops to get a test project going ☺️ (with proper package management)
  • Keep your environment nice and clean ✨, with auto-removal of unnecessary components
  • It's easy to make reproducible environments for your CI and deployments (no more "it-works-on-my-machine" syndrome)
  • Easily make installable modules, no more setup.py fiddling
  • Piper increases usefulness of some basic pip commands (e.g. check out piper list, piper outdated)
  • A bunch of convenient utilities are included (e.g. piper why)
  • Easy install from Github (e.g. piper add requests/requests)
  • Effortlessly keep your project version and git tags updated

A star makes the developers happy 😊

star-gif


Installation

$ pip install mr-piper

Usage

Concise docs on usage and API going here

$ piper
Usage: piper [OPTIONS] COMMAND [ARGS]...

|  _____ _
| |  __ (_)
| | |__) | _ __   ___ _ __
| |  ___/ | '_ \ / _ \ '__|
| | |   | | |_) |  __/ |
| |_|   |_| .__/ \___|_|
|         | |
|         |_|
|

Options:
--help  Show this message and exit.

Commands:
add       Install and add a package to requirements
info      info all installed packages
init      Initialise project with virtual environment,...
install   Install all packages in requirement files.
list      List all installed packages
outdated  Deletes virtualenv, requirements folder/files...
remove    Remove a list of packages and their...
upgrade   Upgrade a list of packages.
why       Explain why a package exists
wipe      Wipe virtualenv, requirements folder/files...

Initialize project piper init

e.g. piper init --py 3.6 --outside

Initializing a project creates:

  • the PIP requirement files (base, dev and frozen lock files)
  • the virtualenv (either outside or inside the project folder)
  • a Piper file (where project information is stored)
  • a Piper lock (where the reproducible working project configuration is stored)
  • a working setup.py

https://transfer.sh/34gGu/Hyper_2017-09-21_16-50-13.png


Example piper.json

{
    "created": "2017-09-20T21:10:07",
    "name": "mr-piper",
    "version": "0.1.3a2",
    "description": "The simple project package manager",
    "source_dir": "mrpiper",
    "repository": "https://github.com/jamespacileo/mr-piper",
    "author": "James Pacileo",
    "author_email": "",
    "keywords": "pip piper mrpiper package manager",
    "license": "MIT",
    "readme_filename": "README.rst",
    "py_modules": [
        "mrpiper.cli"
    ],
    "entry_points": {
        "console_scripts": [
            "piper=mrpiper.cli:cli"
        ]
    },
    "classifiers": [
        "License :: OSI Approved :: MIT License",
        "Programming Language :: Python",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.3",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: Implementation :: CPython",
        "Programming Language :: Python :: Implementation :: PyPy"
    ],
    "data_files": [],
    "package_data": [],
    "exclude_packages": [],
    "dependencies": {
        "requests": "requests>=2.0.0",
        "path.py": "path.py>=10.4",
        "click": "click>=6.7",
        "click-log": "click-log>=0.2.0",
        "delegator.py": "delegator.py>=0.0.13",
        "future": "future>=0.16.0",
        "parse": "parse>=1.8.2",
        "semantic-version": "semantic-version>=2.6.0",
        "simplejson": "simplejson>=3.11.1",
        "tabulate": "tabulate>=0.7.7",
        "crayons": "crayons>=0.1.2",
        "click-spinner": "click-spinner>=0.1.7",
        "emoji": "emoji>=0.4.5"
    },
    "dev_dependencies": {
        "coverage": "coverage>=4.4.1",
        "coveralls": "coveralls>=1.2.0",
        "pytest": "pytest>=3.2.2"
    },
    "private": false
}

Install development packages piper add

e.g. piper add pytest --dev

Dev only packages can be installed with the --dev option. These are automatically added to the dependencies and the lock is refreshed.

https://transfer.sh/zXigS/Hyper_2017-09-21_16-51-27.png


Install a package from github piper add username/project@tag

e.g. piper add django/django@1.11.5

Easy install of python modules stored on Github.

https://transfer.sh/U6ReQ/Hyper_2017-09-21_16-52-31.png


Removing a package piper remove

e.g. piper remove django

Remove a package and all safely deletable sub-dependencies, for a sparkly clean environment.

https://transfer.sh/MpUXN/Hyper_2017-09-21_16-53-00.png


Install all dependencies (uses lock by default) piper install

e.g. piper install --dev

Install (or reinstall) dependencies specified in the requirements. It uses the locked dependencies by default to guarantee a working version.

https://transfer.sh/G8QRZ/Hyper_2017-09-21_19-37-38.png


Find outdated packages piper outdated

e.g. piper outdated --all

https://transfer.sh/3gfBu/Hyper_2017-09-21_17-02-56.png


List project's package structure piper list

e.g. piper list

https://transfer.sh/TYZGX/Hyper_2017-09-21_16-57-49.png


Update porject version (and git tag) piper version

e.g. piper version -y

Easily check and update the project's version, with the option ability to add a git tag version.

https://transfer.sh/gyhnV/Hyper_2017-09-21_19-22-24.png


Why does a package exist piper why

e.g. piper why idna

Check why a package is installed.

https://transfer.sh/CCLhh/Hyper_2017-09-21_19-44-55.png


Get virtualenv activate command piper activate

e.g. piper activate

Returns the shell command used to activate the virtualenv

https://transfer.sh/JKnuk/Hyper_2017-09-21_20-27-12.png


Concise docs on usage and API going here

Current TODO

  • ⬜ Complete basic docs
  • ⬜ Prune and cleanup code
  • ⬜ Add a few more tests
  • ⬜ 90%+ test coverage

Planned CLI APIs

  • piper shell - Spawn a shell where the virtualenv is activated
  • piper build - Build distributable package from project
  • piper publish --build - Build and publish project on PyPI (or other index)
  • piper run command - Run custom command (inspired by npm/yarn commands)
  • piper licenses - List all dependency licences
  • piper config - To store user global settings for Piper's behavior

ROADMAP (PyconUK 2017 sprint):

This list is undergoing changes.

  • ⬜ Improve documentation
  • ⬜ Prune some dependencies used
  • ⬜ Integrate packages hashes
  • ⬜ Easy way to add setup.py commands (e.g. packaga.json scripts)
  • ⬜ Custom virtualenv location
  • ⬜ Optional: Pipfile support