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

py3: typing should not be installed in Python 3 #28499

Closed
videlec opened this issue Sep 15, 2019 · 14 comments
Closed

py3: typing should not be installed in Python 3 #28499

videlec opened this issue Sep 15, 2019 · 14 comments

Comments

@videlec
Copy link
Contributor

videlec commented Sep 15, 2019

typing is a standard Sage package but it is also included in Python 3.7 standard library. This module is not compatible with Python > 3.5. For example it breaks pytest

  File "/opt/sage/local/lib/python3.7/site-packages/_pytest/assertion/__init__.py", line 6, in <module>
    from _pytest.assertion import rewrite
  File "/opt/sage/local/lib/python3.7/site-packages/_pytest/assertion/rewrite.py", line 15, in <module>
    from typing import Dict
  File "/opt/sage/local/lib/python3.7/site-packages/typing.py", line 1356, in <module>
    class Callable(extra=collections_abc.Callable, metaclass=CallableMeta):
  File "/opt/sage/local/lib/python3.7/site-packages/typing.py", line 1004, in __new__
    self._abc_registry = extra._abc_registry
AttributeError: type object 'Callable' has no attribute '_abc_registry'
FAIL eantic_sage.py (exit status: 1)

We should disable the installation of typing when Sage is built with Python 3.

CC: @antonio-rojas @embray @kiwifb @timokau @infinity0 @isuruf @saraedum @slel @SnarkBoojum @tobihan

Component: packages: standard

Author: Vincent Delecroix

Branch/Commit: 68e941e

Reviewer: Julian Rüth

Issue created by migration from https://trac.sagemath.org/ticket/28499

@videlec videlec added this to the sage-8.9 milestone Sep 15, 2019
@videlec

This comment has been minimized.

@videlec
Copy link
Contributor Author

videlec commented Sep 15, 2019

Author: Vincent Delecroix

@videlec
Copy link
Contributor Author

videlec commented Sep 15, 2019

Branch: u/vdelecroix/28499

@videlec
Copy link
Contributor Author

videlec commented Sep 15, 2019

New commits:

68e941e28499: do not install typing with Python 3

@videlec
Copy link
Contributor Author

videlec commented Sep 15, 2019

Commit: 68e941e

@saraedum
Copy link
Member

comment:3

Not a very elegant fix but I think that's just the limitations of SPKGs. So, this looks good to me. I cannot test it because I have no Python 3 SageMath installed. If you're confident that this works, feel free to set this to positive review.

@saraedum
Copy link
Member

Reviewer: Julian Rüth

@saraedum
Copy link
Member

comment:4

CCing a usual suspect for testing Python 3 stuff :)

@saraedum
Copy link
Member

comment:5

Or wait for #28041 and GitLab CI will test it automatically.

@videlec
Copy link
Contributor Author

videlec commented Sep 15, 2019

comment:6

Works for me on Python 3.

@videlec videlec changed the title typing should not be installed in Python 3 py3: typing should not be installed in Python 3 Sep 15, 2019
@slel
Copy link
Member

slel commented Sep 16, 2019

comment:8

cc-ing packagers for various distros

@embray
Copy link
Contributor

embray commented Sep 18, 2019

comment:9

There is another way. With an spkg-configure.m4, in I believe the third argument to [https://github.com/sagemath/sagetrac-mirror/blob/develop/m4/sage_spkg_configure.m4 SAGE_SPKG_CONFIGURE` you can pass a check for whether the package is even required.

It's not well documented how to do this, but if you set sage_require_typing=no in this check then it won't require installation of the package (it will just be treated as a dummy package).

@fchapoton
Copy link
Contributor

comment:10

moving milestone to 9.0 (after release of 8.9)

@fchapoton fchapoton modified the milestones: sage-8.9, sage-9.0 Sep 30, 2019
@vbraun
Copy link
Member

vbraun commented Oct 5, 2019

Changed branch from u/vdelecroix/28499 to 68e941e

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

No branches or pull requests

6 participants