Installing Private Python Packages Hosted on GitHub: Difference between revisions
Jump to navigation
Jump to search
(Created page with "== Overview == Use pip and virtual environments to install private python packages hosted on GitHub. == Workflow == === Installing packages === Add the package to either `requirements-to-install.txt` or `requirements.txt`: <syntaxhighlight lang="txt"> git+https://github.com/johnf1004/my_package.git </syntaxhighlight> Install with pip: <syntaxhighlight lang="bash"> $ pip install -r requirements-to-install.txt --upgrade </syntaxhighlight> At this point, validation...") Tag: wikieditor |
Tag: wikieditor |
||
| (One intermediate revision by the same user not shown) | |||
| Line 11: | Line 11: | ||
<syntaxhighlight lang="txt"> | <syntaxhighlight lang="txt"> | ||
git+https://github.com/johnf1004/my_package.git | git+https://github.com/johnf1004/my_package.git | ||
git+https://github.com/johnf1004/my_package.git@alternate-branch | |||
</syntaxhighlight> | </syntaxhighlight> | ||
| Line 36: | Line 37: | ||
At this point pip should be able to install from the private repo. | At this point pip should be able to install from the private repo. | ||
== More information == | |||
* [https://stackoverflow.com/a/72477639 Pip install with requirements.txt from private repo prompting for password] - Stack Overflow | |||
* [[GitHub_Cookbook#Personal_access_tokens|GitHub personal access tokens]] - Wiki | |||
[[category:Python]] [[Category:Git]] [[Category:Web Development]] | [[category:Python]] [[Category:Git]] [[Category:Web Development]] | ||
Latest revision as of 20:39, 22 July 2023
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.