Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.3.1.post1.dev1 is not newer then 2.3.1 #7585

Closed
Paebbels opened this issue Jan 12, 2020 · 6 comments
Closed

2.3.1.post1.dev1 is not newer then 2.3.1 #7585

Paebbels opened this issue Jan 12, 2020 · 6 comments
Labels
auto-locked Outdated issues that have been locked by automation type: support User Support

Comments

@Paebbels
Copy link

Environment

  • pip version: 19.3.1 (pip3)
  • Python version: CPython, 3.8.1
  • OS: Windows 10, x64-86

Description
I'm patching packages from Sphinx core, because the developers don't want to add these updates. I created a Git repository on GitHub and my own package namespace for the patched variations. For tagging I use the original version number with postfix 2.3.1.postN to create post-releases. Development versions of such post-releases are tagged additionally with .devN like 2.3.1.post1.dev1.

(Other version postfixes for releases after 2.3.1 are not accepted by PyPI due to rules in PEP440.)

To summarize:

  • 2.3.1 - commit with original code based on Sphinx 2.3.1
  • 2.3.1.post1.dev1 - code based on 2.3.1 for development towards 2.3.1.post1
  • 2.3.1.post1 - code based on 2.3.1 with my patches

I packages and pushed this to PyPI.
Next, I changed my requirements.txt file and added:

btd.sphinx.graphviz>=2.3.1

According to PEP440, section post-releases, a post-release is newer than a release.

But pip reports differently:
image
(See below for a non-screenshot version.)

I looks like version postfixes like .postN and .devN are not handled correctly in relational operators.

Expected behavior

pip should accept post-releases as newer version than an ordinary release.

How to Reproduce

  1. Get package from PyPI:
    pip install -U btd.sphinx.inheritance-diagram
  2. An error occurs.

Output

C:\WINDOWS\system32> py -3 -m pip install -U btd.sphinx.inheritance-diagram
Collecting btd.sphinx.inheritance-diagram
  Using cached https://files.pythonhosted.org/packages/77/e2/c287faaf9a5d7cb617b6b2515f16862c1b15a381d85860bab0a6f015cd21/btd.sphinx.inheritance_diagram-2.3.1.post1-py3-none-any.whl
ERROR: Could not find a version that satisfies the requirement btd.sphinx.graphviz>=2.3.1 (from btd.sphinx.inheritance-diagram) (from versions: 2.3.1.post1.dev1)
ERROR: No matching distribution found for btd.sphinx.graphviz>=2.3.1 (from btd.sphinx.inheritance-diagram)
@triage-new-issues triage-new-issues bot added the S: needs triage Issues/PRs that need to be triaged label Jan 12, 2020
@Paebbels
Copy link
Author

I managed to create a post-release without .dev1 postfix. This works and my package and its dependencies were installed. So I would reduce my error report to:

.postN in combination with .devN does not work as expected.

After publishing 2.3.1.post1 on PyPI (2.3.1.post1.dev1 is still in the PyPI archive), I get these outputs:

C:\WINDOWS\system32> py -3 -m pip install btd.sphinx.inheritance-diagram
Collecting btd.sphinx.inheritance-diagram
  Using cached https://files.pythonhosted.org/packages/77/e2/c287faaf9a5d7cb617b6b2515f16862c1b15a381d85860bab0a6f015cd21/btd.sphinx.inheritance_diagram-2.3.1.post1-py3-none-any.whl
Requirement already satisfied: sphinx>=2.3.1 in c:\program files\python3.8\lib\site-packages (from btd.sphinx.inheritance-diagram) (2.3.1)
Collecting btd.sphinx.graphviz>=2.3.1
  Using cached https://files.pythonhosted.org/packages/3b/37/0dcebcf413260211501e350128f47b542fe5a79072edb40b742e5318d3c7/btd.sphinx.graphviz-2.3.1.post1-py3-none-any.whl
Requirement already satisfied: babel!=2.0,>=1.3 in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2.8.0)
Requirement already satisfied: sphinxcontrib-htmlhelp in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.0.2)
Requirement already satisfied: Jinja2>=2.3 in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2.10.3)
Requirement already satisfied: sphinxcontrib-jsmath in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.0.1)
Requirement already satisfied: packaging in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (20.0)
Requirement already satisfied: Pygments>=2.0 in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2.5.2)
Requirement already satisfied: sphinxcontrib-devhelp in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.0.1)
Requirement already satisfied: requests>=2.5.0 in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2.22.0)
Requirement already satisfied: alabaster<0.8,>=0.7 in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (0.7.12)
Requirement already satisfied: sphinxcontrib-applehelp in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.0.1)
Requirement already satisfied: setuptools in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (45.0.0)
Requirement already satisfied: sphinxcontrib-qthelp in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.0.2)
Requirement already satisfied: docutils>=0.12 in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (0.16)
Requirement already satisfied: colorama>=0.3.5; sys_platform == "win32" in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (0.4.3)
Requirement already satisfied: snowballstemmer>=1.1 in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2.0.0)
Requirement already satisfied: imagesize in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.2.0)
Requirement already satisfied: sphinxcontrib-serializinghtml in c:\program files\python3.8\lib\site-packages (from sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.1.3)
Requirement already satisfied: pytz>=2015.7 in c:\program files\python3.8\lib\site-packages (from babel!=2.0,>=1.3->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2019.3)
Requirement already satisfied: MarkupSafe>=0.23 in c:\program files\python3.8\lib\site-packages (from Jinja2>=2.3->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.1.1)
Requirement already satisfied: six in c:\program files\python3.8\lib\site-packages (from packaging->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.13.0)
Requirement already satisfied: pyparsing>=2.0.2 in c:\program files\python3.8\lib\site-packages (from packaging->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2.4.6)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in c:\program files\python3.8\lib\site-packages (from requests>=2.5.0->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (1.25.7)
Requirement already satisfied: certifi>=2017.4.17 in c:\program files\python3.8\lib\site-packages (from requests>=2.5.0->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2019.11.28)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\program files\python3.8\lib\site-packages (from requests>=2.5.0->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\program files\python3.8\lib\site-packages (from requests>=2.5.0->sphinx>=2.3.1->btd.sphinx.inheritance-diagram) (2.8)
Installing collected packages: btd.sphinx.graphviz, btd.sphinx.inheritance-diagram
Successfully installed btd.sphinx.graphviz-2.3.1.post1 btd.sphinx.inheritance-diagram-2.3.1.post1

@chrahunt
Copy link
Member

Any .devN suffix causes the version to be considered a "prerelease" here. It should work as desired if you pass --pre to pip install.

@chrahunt chrahunt added S: awaiting response Waiting for a response/more information type: support User Support labels Jan 12, 2020
@triage-new-issues triage-new-issues bot removed the S: needs triage Issues/PRs that need to be triaged label Jan 12, 2020
@Paebbels
Copy link
Author

Does it also work with requirements.txt files?
What is the syntax?

@no-response no-response bot removed the S: awaiting response Waiting for a response/more information label Jan 12, 2020
@chrahunt
Copy link
Member

It would look like

pip install --pre btd.sphinx.inheritance-diagram

or

pip install -r requirements.txt

with a requirements.txt like

--pre
btd.sphinx.inheritance-diagram

@chrahunt chrahunt added the S: awaiting response Waiting for a response/more information label Jan 12, 2020
@uranusjr
Copy link
Member

uranusjr commented Jan 14, 2020

To clarify, pip does correctly treat 2.3.1.post1.dev1 as newer than 2.3.1 (so the issue title is inaccurate). The problem here is that pip is not selecting the (newer) dev1 version with --pre. This is also discussed in #7579 and discuss.python.org (slightly different cases, but worth reading if you’re interested in how pip works in this area).

@no-response
Copy link

no-response bot commented Jan 27, 2020

This issue has been automatically closed because there has been no response to our request for more information from the original author. With only the information that is currently in the issue, we don't have enough information to take action. Please reach out if you have or find the answers we need so that we can investigate further.

@no-response no-response bot closed this as completed Jan 27, 2020
@lock lock bot added the auto-locked Outdated issues that have been locked by automation label Feb 28, 2020
@lock lock bot locked as resolved and limited conversation to collaborators Feb 28, 2020
@pradyunsg pradyunsg removed the S: awaiting response Waiting for a response/more information label Mar 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
auto-locked Outdated issues that have been locked by automation type: support User Support
Projects
None yet
Development

No branches or pull requests

4 participants