I have a package (foo) in a private git repo. I want to install foo for use by another package, bar, via bar's setup.py. I want a specific version - the versioning in setup.py for foo matches its git tags (0.3.2, the git tag is v0.3.2)
The setup.py for bar looks like this:
#!/usr/bin/env python
from setuptools import setup, find_packages
setup(name='bar',
install_requires=['foo@ git+ssh://git@github.com/fergusmac/foo.git@v0.3.2#subdirectory=somedir']
)
I have also tried added the version explicitly at the end:
install_requires=['foo@ git+ssh://git@github.com/fergusmac/foo.git@v0.3.2#subdirectory=somedir==0.3.2']
I currently have version 0.3.1 installed in my venv. When I try to install this setup.py, via pip install ., or pip install . -U the version isn't upgraded - the repo isn't even checked out:
Requirement already satisfied, skipping upgrade: foo@ git+ssh://git@github.com/fergusmac/foo.git@v0.3.2#subdirectory=src==0.3.2 from
git+ssh://****@github.com/fergusmac/foo.git@v0.3.2#subdirectory=src==0.3.2 in
./venv/lib/python3.8/site-packages (from bar==0.0.0) (0.3.1)
However, when I use pip to install foo directly, the upgrade is done:
pip install git+ssh://git@github.com/fergusmac/foo.git@v0.3.2#subdirectory=src
Collecting git+ssh://****@github.com/fergusmac/foo.git@v0.3.2#subdirectory=src
Cloning ssh://****@github.com/fergusmac/foo.git (to revision v0.3.2) to /tmp/pip-req-build-gxj2duq6
Running command git clone -q 'ssh://****@github.com/fergusmac/foo.git' /tmp/pip-req-build-gxj2duq6
Running command git checkout -q 40fa65eb75fc26541c90ee9e489ae6dd5538db1f
Running command git submodule update --init --recursive -q
...
Installing collected packages: foo
Attempting uninstall: foo
Found existing installation: foo0.3.1
Uninstalling foo-0.3.1:
Successfully uninstalled foo-0.3.1
Running setup.py install for foo... done
Successfully installed foo-0.3.2
I can't understand why installing with setup.py gives different behaviour. How do I ensure that it checks out the repo and looks for the correct version?
Follow up question - how would I specify 'check master branch for foo and install whatever version is there if it is higher than the current installed version'?
from Installing python package from git at tag with setup.py
No comments:
Post a Comment