#68071 closed defect (fixed)

py37-coverage: ImportError: cannot import name 'Protocol' from 'typing'

Reported by: catap (Kirill A. Korinsky) Owned by: reneeotten (Renee Otten)
Priority: Normal Milestone:
Component: ports Version:
Keywords: Cc: petrrr
Port: py37-coverage

Description

I've encountered that at least py37-coverage had missed dependency:

Python 3.7.17 (default, Jun 11 2023, 06:06:55) 
[Clang 13.1.6 (clang-1316.0.21.2.5)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import coverage
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coverage/__init__.py", line 22, in <module>
    from coverage.control import (
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coverage/control.py", line 27, in <module>
    from coverage.annotate import AnnotateReporter
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coverage/annotate.py", line 13, in <module>
    from coverage.files import flat_rootname
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coverage/files.py", line 20, in <module>
    from coverage.misc import human_sorted, isolate_module, join_regex
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coverage/misc.py", line 30, in <module>
    from coverage.types import TArc
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/coverage/types.py", line 14, in <module>
    from typing import (
ImportError: cannot import name 'Protocol' from 'typing' (/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/typing.py)
>>> 

Change History (9)

comment:1 Changed 15 months ago by petrrr

This is not a missing dependency, it is a version incompatibility. coverage @7.3.0 is declared to be compatible with Python >= 3.8.

typing is part of the standard lib and typing.Protocol was introduces with version 3.8, see https://docs.python.org/3/library/typing.html

Probably we just can remove obsolete subports.

comment:2 Changed 15 months ago by catap (Kirill A. Korinsky)

Or downgrade version which supports python 3.7 for a while.

comment:3 Changed 15 months ago by petrrr

Is the py37 subport still relevant anyhow? Python 3.7 is quite dated and not supported anymore. End of life: 2023-06-27

For coverage the support was dropped with 7.3.0: https://github.com/nedbat/coveragepy/releases/tag/7.3.0

I'd rather avoid introducing too much fuss with multiple versions, when these are not officially supported. Or is there a particular reason to keep this particular version around?

comment:4 Changed 15 months ago by petrrr

Port: py-coverage added; py37-coverage removed
Summary: py37-coverage: missed dependencypy-coverage @7.3.0: python 3.7 not supported

comment:5 Changed 15 months ago by catap (Kirill A. Korinsky)

Port: py37-coverage added; py-coverage removed
Summary: py-coverage @7.3.0: python 3.7 not supportedpy37-coverage: missed dependency

Yes, it is:

√ ~ % port echo depends:py37-coverage
py37-pytest-cov                 
py37-grpcio                     
py37-codecov                    
py37-nbval                      
py37-python-coveralls           
py37-biplist                    
py37-colour                     
py37-moviepy                    
py37-myst-parser                
py37-openid                     
py37-repoze.lru                 
py37-smmap                      
py37-sure                       
py37-webtest                    
py37-zopeinterface              
√ ~ % 

Probably it might be future cleaned up, but the second level depedencies is much bigger:

py-webtest                      
py37-attrs                      
py37-comet                      
py37-country                    
py37-cryptography               
py37-dateutil                   
py37-docker                     
py37-gevent                     
py37-gitdb                      
py37-grpcio-tools               
py37-gunicorn                   
py37-iocapture                  
py37-jaraco.classes             
py37-jaraco.functools           
py37-moviepy                    
py37-myst-parser                
py37-nbval                      
py37-onnx                       
py37-portalocker                
py37-pytest-timeout             
py37-repoze.sphinx.autointerface  
py37-routes                     
py37-tensorboard                
py37-tensorboard1               
py37-tensorflow1                
py37-transaction                
py37-twisted                    
py37-wordcloud                  
py37-zbar                       
py37-zope-component             

comment:6 Changed 15 months ago by reneeotten (Renee Otten)

I’ll take a look. Ideally we should start removing the EOL Python 3.7 subports but considering we’re still struggling with finishing this for PY35/PY36 and even PY27 that might take a while.

comment:7 Changed 15 months ago by ryandesign (Ryan Carsten Schmidt)

Summary: py37-coverage: missed dependencypy37-coverage: ImportError: cannot import name 'Protocol' from 'typing'

comment:8 Changed 15 months ago by reneeotten (Renee Otten)

okay, I just looked. We already have special cases for PY27, PY35, and PY36 because there are still dependents. So there is no reason not to do the same for PY37 now as well and I've just committed that change.

Sure, in the ideal world we would finally manage to remove all Python packages for EOL Python versions, but that time is unfortunately not now...

comment:9 Changed 15 months ago by reneeotten (Renee Otten)

Resolution: fixed
Status: assignedclosed

In 24838aa9b389e98976a8adb2b8b5275fae01ca96/macports-ports (master):

py-coverage: pin to version 7.2.7 for PY37

Closes: #68071

Note: See TracTickets for help on using tickets.