web-dev-qa-db-fra.com

Installez git commit spécifique avec pip

Je développe une application Django et j'utilise pip pour gérer mes besoins. Comment puis-je installer un commit spécifique à un git?

Dans mon cas, j'ai besoin d'installer ce commit: https://github.com/aladagemre/Django-notification/commit/2927346f4c513a217c8ad076e494dd1adbf70e1

129
kelwinfc

Vous pouvez spécifier un hachage de validation, un nom de branche, une balise.

Pour le nom de la branche et la balise, vous pouvez également installer une distribution compressée. Ceci est plus rapide et plus efficace, car il ne nécessite pas de cloner le référentiel entier. GitHub crée ces bundles automatiquement.

hash:

$ pip install git+git://github.com/aladagemre/Django-notification.git@2927346f4c513a217ac8ad076e494dd1adbf70e1

Nom de la filiale

Avec git

$ pip install git+git://github.com/aladagemre/Django-notification.git@cool-feature-branch

ou du paquet source

$ pip install https://github.com/aladagemre/Django-notification/archive/cool-feature-branch.tar.gz

tag

avec git 

$ pip install git+git://github.com/aladagemre/[email protected]

ou du paquet source

$ pip install https://github.com/aladagemre/Django-notification/archive/v2.1.0.tar.gz

Cette fonctionnalité n’est pas bien documentée, mais vous pouvez trouver plus d’informations sur https://pip.pypa.io/en/latest/reference/pip_install.html#git

213
Hugo Tavares

Un commentaire supplémentaire à la réponse de @ hugo-tavares:

S'il s'agit d'un référentiel privé GitHub, vous devez utiliser:

pip install git+ssh://[email protected]/....

Dans ton cas:

pip install git+ssh://[email protected]/aladagemre/Django-notification.git@2927346f4c513a217ac8ad076e494dd1adbf70e1
13
PGuiv

Il est possible d'installer automatiquement un package python à l'aide du fichier exigences.txt de votre projet en ajoutant simplement la ligne suivante:

-e git+https://github.com/owner/repository.git@branch_or_commit

et lancez la ligne de commande:

$ pip install -r requirements.txt

10
mannysz

Si vous voulez créer un paquet Egg, vous pouvez toujours utiliser le même appendice @branch_or_commit: pip install git+ssh://[email protected]/myrepo.git@mybranch#Egg=myeggscript

0
Dannid