Back to TILs.

Calmcode TIL

Pip install via Git logoPip install via Git

If you're using Python you're probably used to installing project by running:

python -m pip install <project-name>

This allows you to install a Python project that is hosted on the Python package index. That's great, but what if you're working on an experimental project that you don't want to formally host on the central server?

In these situations you can also choose to host the repository via GitHub. Just host the full Python project as you would normally but now point to the git URL instead. Then you can install it via:

python -m pip install "<name> @ git+<name>.git"

For example, if you'd like to install sentimany, a tool that wraps around sentiment models, you can run:

python -m pip install "sentimany @ git+"

There are a few benefits of this approach:

  1. The barrier of entry is a bit lower, because you won't need to learn how to push to pypi.
  2. It prevents experimental projects from going to pypi. In general, if a package is hosted on pypi then it's also squatting a name that could be used by another project. If the project is meant to be experimental then it's best to host it on GitHub.

Back to TILs.