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

5.0.0 should not be pip installable for Python < 3.8 #2858

Closed
zmeves opened this issue Sep 19, 2024 · 4 comments · Fixed by #2859
Closed

5.0.0 should not be pip installable for Python < 3.8 #2858

zmeves opened this issue Sep 19, 2024 · 4 comments · Fixed by #2859

Comments

@zmeves
Copy link
Contributor

zmeves commented Sep 19, 2024

pypdf 5.0.0 is pip-installable for Python 3.7, but support for 3.7 is dropped as noted in the Changelog.

Packages that require pypdf > X but don't specify <5 are subject to erroneously installing pypdf >= 5 when running on Python 3.7.

Environment

Python 3.7, any OS

$ python -m platform
Windows-10-10.0.22621-SP0

$ python -c "import pypdf;print(pypdf._debug_versions)"
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\__init__.py", line 11, in <
module>
    from ._doc_common import DocumentInformation
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\_doc_common.py", line 48, i
n <module>
    from ._encryption import Encryption
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\_encryption.py", line 46, i
n <module>
    from ._utils import logger_warning
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\_utils.py", line 523, in <m
odule>
    @dataclass
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\_utils.py", line 525, in Fi
le
    from .generic import IndirectObject
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\generic\__init__.py", line
38, in <module>
    from ._base import (
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\generic\_base.py", line 37,
 in <module>
    from .._protocols import PdfObjectProtocol, PdfWriterProtocol
  File "C:\Users\zmeve\AppData\Local\Programs\Python\Python37\lib\site-packages\pypdf\_protocols.py", line 5, in
<module>
    from typing import IO, Any, Dict, List, Optional, Protocol, Tuple, Union
ImportError: cannot import name 'Protocol' from 'typing' (C:\Users\zmeve\AppData\Local\Programs\Python\Python37\l
ib\typing.py)

Code + PDF

This is a minimal, complete example that shows the issue:

import pypdf
print(pypdf.__version__)

Traceback

Same as listed above.

Suggested Fixes

  1. Update the pyproject.toml to mark the minimum Python version as 3.8
  2. "Yank" the pypdf 5.0.0 distribution from PyPI for Python 3.7. I'm not sure if this is possible for a specific Python version - if not, it may still be best to yank the entire 5.0.0 release and re-publish it as 5.0.0.post1, or even 5.0.1.
@stefan6419846
Copy link
Collaborator

Thanks for the report. Yanking only works for complete releases.

For now, I am not completely sure what the desired behavior is here. Personally, I would expect users to pin their requirements and to not use any Python version being EOL for more than one year any more (although we might have supported it).

Before doing any yanking, let's wait for some further opinions from @pubpub-zz and @MartinThoma (who would have to do the yanking anyway).

@cedk
Copy link

cedk commented Sep 19, 2024

I'm in favor of "yanking" otherwise you force other project to manage themselves the dependencies of pypdf.
Other projects (like libraries) do not pin their dependencies just like pypdf does not pin its dependencies.

@weeix
Copy link

weeix commented Sep 26, 2024

I pinned xhtml2pdf==0.2.11, but it requires pypdf>=3.1.0, so I added pypdf==4.3.1 to my requirements.txt to fix the error.

@pubpub-zz
Copy link
Collaborator

I have no strong opinion. I'm OK ready to publish 5.0.1 this week-end if the change in pyproject.toml is OK.
As @stefan6419846 said, @MartinThoma may have to yank 5.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants