I have a python project with all dependencies and versions managed by pyproject.toml
file.
One of these dependencies is a git reference:
[project]
name = 'my_package'
version = '1.0.0'
dependencies = [
'my_dependency @ git https://github.com/some_user/some_repo.git'
]
In order to improve version management after some time I started to use tags to specify exact "version". Like this:
dependencies = [
'my_dependency @ git https://github.com/some_user/[email protected]'
]
But this is still not enough. Ideally I want something flexible, open for minor or patch version increase. Like this:
dependencies = [
'my_dependency >= 1.2 @ git https://github.com/some_user/some_repo.git'
]
To be clear: I want pip
to look for different versions in the entire repo history and take one's that match the condition. According to semver.
In this particular case with >= 1.2
it should take 1.2.1
, 1.2.2
, 1.3
, 1.157.256
or any other commit with version in pyproject.toml
(or at least git tag) greater or equal to 1.2
.
Is this possible?
Can pip
manage versions so well for git repositories?
CodePudding user response:
Unfortunately it's not possible. As specified here https://peps.python.org/pep-0508/ or here https://pip.pypa.io/en/stable/reference/requirement-specifiers/, you can't use of version requirements with url based dependencies. Your second approach about using tags is the one you need.