Search code examples
pythongitpippypi

Best practices for installing and using python libraries that are not available through pip or tarball distributions


What is the best practice for installing Python libraries that are available on a VCS, but are not maintained as pip installable packages?

So far I've found lots of solutions that suggest just installing directly from GitHub, but those all appear to require that the maintainer has packaged for a pip install. There's also the option of installing from tarballs, but in this case, the maintainer does not offer an installable tarball.

There are several attempts on pypi to release this, but they are all out of date or have issues of one kind or another.

The library in question is for working with E-Paper displays from waveshare. The libraries I'd like to use are buried several directories deep within the git repository. To make things worse, the project is released without a license.txt, but does have a generic license text within each library file. The license text appears to grant a wide permission to include the libraries into any type of project (see the text below).

I've come up with a few options for dealing with this, but I hope there's something better:

  1. Copy the libraries into the project

    Issues:

    • libraries get stale
    • there's no easy way to update them except for manually copying into the project
  2. Repackage the libraries and upload to pip

    Issues:

    • I now need to maintain the pypi projects
    • They end up stale and with issues exactly like the ones I've found so far

Solution

  • There is a setup.py and so it should be possible to install the project with the following command:

    pip install -e 'git+https://github.com/waveshare/e-Paper.git#egg=waveshare-epd&subdirectory=RaspberryPi&JetsonNano/python'
    

    But it fails since there is an ampersand (&) in the directory name. If it were possible to somehow escape that character, it would probably work.