Installing Private Python Packages Hosted on GitHub

From Littledamien Wiki
Revision as of 20:39, 22 July 2023 by Video8 (talk | contribs) (→‎Installing packages)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Overview[edit]

Use pip and virtual environments to install private python packages hosted on GitHub.

Workflow[edit]

Installing packages[edit]

Add the package to either requirements-to-install.txt or requirements.txt:

git+https://github.com/johnf1004/my_package.git
git+https://github.com/johnf1004/my_package.git@alternate-branch

Install with pip:

$ pip install -r requirements-to-install.txt --upgrade

At this point, validation errors will be displayed if GitHub credentials haven't been configured.

Configuring GitHub credentials[edit]

Install the GitHub CLI.

$ brew install gh

Enter credentials:

$ gh autho login

At this point pip should be able to install from the private repo.

More information[edit]