0

I need to find a rule to put in requirements.txt for a package x in order to match any version starting with major 3, even if they are alpha, beta, rc, whatever is the latest.

So for example that rule should match:

3.0.0a3
3.0.0b5
3.0.0rc2
3.0.0
3.0.1
3.1.0b0
3.1.0
...

whatever is the latest.

At the moment, the true latest version of x is 3.0.0b8.

I tried with: x==3.* but it doesn't work:

ERROR: Could not find a version that satisfies the requirement x==3.* (from versions: 3.0.0b5, 3.0.0b6, 3.0.0b7, 3.0.0b8)
ERROR: No matching distribution found for x==3.*

I tried to read PEP440 but I couldn't figure that out. Any ideas?

Thanks

edoedoedo
  • 1,469
  • 2
  • 21
  • 32
  • Does this answer your question? [How to pip install a package with min and max version range?](https://stackoverflow.com/questions/8795617/how-to-pip-install-a-package-with-min-and-max-version-range) – FlyingTeller Jul 22 '21 at 11:50
  • No luck, tried with `x>=3,<4` but still it doesn't find the current `3.0.0b8` – edoedoedo Jul 22 '21 at 11:59
  • What is the name of the package? – FlyingTeller Jul 22 '21 at 12:02
  • I didn't mention because unfortunately it is a private package hosted on a private repo so it cannot be publicly accessed – edoedoedo Jul 22 '21 at 12:03
  • However I believe that is something related to the pre release versions, because it seems that `>=3` won't match `3.0.0b8` because `3.0.0b8 < 3.0.0` – edoedoedo Jul 22 '21 at 12:04
  • 1
    You are right, see [this](https://pip.pypa.io/en/stable/cli/pip_install/#pre-release-versions) for a fix – FlyingTeller Jul 22 '21 at 12:18
  • As indicated the `--pre` flag works so it considers also the prerelease version, thank you! – edoedoedo Jul 22 '21 at 15:37

0 Answers0