Skip to content

Instantly share code, notes, and snippets.

@stevepeak
Last active December 17, 2015 00:28
Show Gist options
  • Save stevepeak/5520777 to your computer and use it in GitHub Desktop.
Save stevepeak/5520777 to your computer and use it in GitHub Desktop.
Create and mange a pip project
*.pyc
.DS_Store
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
bin
var
sdist
develop-eggs
.installed.cfg
lib
lib64
__pycache__
# This one is needed when you want to release a package to PyPI
[distutils]
index-servers =
pypi
[pypi]
username:USERNAME
password:PASSWORD

pip

  1. register with pip
    • setup .pypirc file, see .pypirc example
    • put file in $HOME
      • osx touch ~/.pypirc
  2. install PasteScript
    • sudo easy_install PasteScript
  3. search for package, find a project name
    • pip search __name__
  4. create project
    • paster create __name__
      • add package folder add to setup dict arguments packages = ['__folder__']
      • optional remove content in setup.cfg via $ echo "[egg_info]" > setup.cfg
  5. git ignore to ignore package stuff, see .gitignore example
  6. register package
    • python setup.py register
  7. upload
    • python setup.py sdist upload

New versions

  • chanage version number in setup.py
  • upload python setup.py sdist upload

Install

  • pip install __packagename__

Upgrade

  • pip install __packagename__ --upgrade
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment