DEV Community

Discussion on: How to create a PIP package hosted on private Github repo

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
rf_schubert profile image
Raphael Schubert

Sorry for the giant delay! The pip package has this for default. You will just need to something like: pip install myawesomepackage==1.0.1 where the version should be the exact version that you need, even if is old.

Collapse
 
karfau profile image
Christian Bewernitz

But are you aware of combining the approach that you describe (using git URL) with setting a fixed version? I would hope that it works using git tags. Would be nice if anybody has tried this can report here :)

Thread Thread
 
rf_schubert profile image
Raphael Schubert

Sorry for the delay bro... but yes, it's absolutely possible and highly recommended! Using Git tags is the standard way to combine the Git URL approach with a fixed version.

The syntax for installing a specific version based on a tag is straightforward:

pip install git+github.com/your-username/your-repo...

Here, @v1.0.0 refers to the specific tag you've created in your repository. This ensures that the package installation is always tied to that exact version, regardless of any future changes on the main branch. This is a crucial practice for managing dependencies and ensuring reproducible builds.