Skip to content

Conversation

@BvB93
Copy link
Member

@BvB93 BvB93 commented May 26, 2022

CC @EwoutH
Follow up on #21543, xref #21308

Adapt npt._GenericAlias to the various PEP 646-related changes introduced in types.GenericAlias, notably the introduction of three new attributes and/or methods:

  • __iter__
  • __unpacked__
  • __typing_unpacked_tuple_args__

Note that types.GenericAlias still seems to updated on a regular basis in the current 3.11 dev cycle (so more changes may or may not be necessary in the future), but this should be enough to get things running again for #21308.

@h-vetinari
Copy link
Contributor

h-vetinari commented May 26, 2022

Note that types.GenericAlias still seems to updated on a regular basis in the current 3.11 dev cycle (so more changes may or may not be necessary in the future)

There's a very high bar for changes after beta1, and I don't think anything of relevance will change anymore, unless discovered to be really badly broken.

Deliberate divergence w.r.t. CPython
@BvB93
Copy link
Member Author

BvB93 commented May 26, 2022

There's a very high bar for changes after beta1, and I don't think anything of relevance will change anymore, unless discovered to be really badly broken.

Then let's hope python/cpython#92335 will remain the last of it, as it just introduced a new types.GenericAlias attribute for 3.11b3.

@BvB93
Copy link
Member Author

BvB93 commented May 26, 2022

What's going on with the armv7_simd_test CI run? Does it have a separate requirements file?

_____________ ERROR collecting typing/tests/test_generic_alias.py ______________
ImportError while importing test module '/usr/local/lib/python3.8/dist-packages/numpy-1.24.0.dev0+51.g91819691c-py3.8-linux-armv7l.egg/numpy/typing/tests/test_generic_alias.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
/usr/local/lib/python3.8/dist-packages/numpy-1.24.0.dev0+51.g91819691c-py3.8-linux-armv7l.egg/numpy/typing/tests/test_generic_alias.py:13: in <module>
    from typing_extensions import Unpack
E   ModuleNotFoundError: No module named 'typing_extensions'

@h-vetinari
Copy link
Contributor

Then let's hope python/cpython#92335 will remain the last of it, as it just introduced a new types.GenericAlias attribute for 3.11b3.

Good point. The respective PR for 3.11 is not even merged yet though.

@mattip
Copy link
Member

mattip commented May 26, 2022

What's going on with the armv7_simd_test CI run? Does it have a separate requirements file?

I couldn't find typing_extensions explicitly in a requirements file. Is it pulled in via some other dependency?

@BvB93
Copy link
Member Author

BvB93 commented May 26, 2022

I couldn't find typing_extensions explicitly in a requirements file. Is it pulled in via some other dependency?

It's just been added in this PR via 4682699.

@charris
Copy link
Member

charris commented May 26, 2022

What's going on with the armv7_simd_test

Don't know, the error is new. I was going to rerun it. The test sets up its own docker run.

@mattip
Copy link
Member

mattip commented May 26, 2022

I think there should be a call to && python3 -m pip install test_requirements.txt inserted into the docker command here

docker run --rm --interactive -v $(pwd):/numpy the_build /bin/bash -c "
cd /numpy && python3 runtests.py -n -v -- -k test_simd
"

@BvB93
Copy link
Member Author

BvB93 commented May 26, 2022

I think there should be a call to && python3 -m pip install test_requirements.txt inserted into the docker command here

docker run --rm --interactive -v $(pwd):/numpy the_build /bin/bash -c "
cd /numpy && python3 runtests.py -n -v -- -k test_simd
"

Let me give it a shot.

@charris
Copy link
Member

charris commented May 26, 2022

Does this need a backport? We will be supporting Python 3.11 in NumPy 1.23 after the first Python rc.

@BvB93 BvB93 added the 09 - Backport-Candidate PRs tagged should be backported label May 26, 2022
@BvB93
Copy link
Member Author

BvB93 commented May 26, 2022

Does this need a backport? We will be supporting Python 3.11 in NumPy 1.23 after the first Python rc.

Good point, yes. Though maybe we should a bit until #21308 is merged with all the remaining py3.11 changes?

@charris charris added this to the 1.23.1 release milestone May 26, 2022
@charris
Copy link
Member

charris commented May 26, 2022

Though maybe we should a bit until #21308 is merged

OK, I marked both that PR and this for 1.23.1, there is no rush for 3.11.

@BvB93
Copy link
Member Author

BvB93 commented May 26, 2022

Well, the last CI job is still spitting out HTTP errors when installing openblas, but besides that everything is finally green.

@mattip
Copy link
Member

mattip commented May 27, 2022

LGTM. I reran the macOS job and it passed. Thanks @BvB93

@mattip mattip merged commit 18c3671 into numpy:main May 27, 2022
@BvB93 BvB93 deleted the alias branch May 27, 2022 10:47
@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jun 3, 2022
@charris charris removed this from the 1.23.1 release milestone Jun 3, 2022
@charris charris changed the title MAINT: Adapt the npt._GenericAlias backport to Python 3.11 types.GenericAlias changes MAINT: Adapt npt._GenericAlias to Python 3.11 types.GenericAlias changes Jun 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants