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

Update and standardize Python versions #1569

Merged
merged 7 commits into from
Oct 5, 2021
Merged

Conversation

mdickinson
Copy link
Member

This PR updates the CI workflows (other than the PyPI upload workflow - see #1567 for that) to standardize the Python versions:

  • Where the Python version matters (that is, primarily for testing), include Python 3.10 in the test matrix
  • Where the Python version isn't important (docs and style checks), standardize on Python 3.8 as the development version to use; this matches the current target for EDM.

@mdickinson
Copy link
Member Author

From actions/setup-python#249, it looks as though we may actually be able to use plain old 3.10 now. I'll let the CI for the above run to completion, then try updating.

@mdickinson
Copy link
Member Author

That's exciting: we've got an actual test failure (segfault) on 3.10:

======================================================================
ERROR: test_create_editor (traits.tests.test_enum.TestGui)
----------------------------------------------------------------------
TypeError: 'PySide2.QtCore.Qt.AlignmentFlag' object cannot be interpreted as an integer

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traits/tests/test_enum.py", line 353, in test_create_editor
    with UITester().create_ui(obj):
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traitsui/testing/tester/ui_tester.py", line 65, in __init__
    self._registries.extend(get_default_registries())
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traitsui/testing/tester/_ui_tester_registry/default_registry.py", line 38, in get_default_registries
    module = importlib.import_module(
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traitsui/testing/tester/_ui_tester_registry/qt4/default_registry.py", line 12, in <module>
    from traitsui.testing.tester._ui_tester_registry.qt4._traitsui import (
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traitsui/testing/tester/_ui_tester_registry/qt4/_traitsui/boolean_editor.py", line 16, in <module>
    from traitsui.qt4.boolean_editor import ReadonlyEditor, SimpleEditor
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traitsui/qt4/boolean_editor.py", line 34, in <module>
    from .text_editor import SimpleEditor as TextEditor
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traitsui/qt4/text_editor.py", line 34, in <module>
    from .editor_factory import ReadonlyEditor as BaseReadonlyEditor
  File "/opt/hostedtoolcache/Python/3.10.0-rc.2/x64/lib/python3.10/site-packages/traitsui/qt4/editor_factory.py", line 92, in <module>
    class ReadonlyEditor(Editor):
SystemError: _PyEval_EvalFrameDefault returned a result with an exception set

This smells like a bug in ctraits.c. (It could also be a problem in Python 3.10.0, but that seems much less likely.) Either way, it deserves investigation before Traits 6.3 is released.

rahulporuri
rahulporuri previously approved these changes Oct 5, 2021
Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with one small comment

@@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
python-version: [3.6, 3.9, 3.10-dev]
python-version: [3.6, 3.8, 3.10.0-rc.2]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we're running the full testsuite with all supported pythons - which is why we can just ignore 3.7 and 3.9 here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point; we should update this too, I think. (To include all Python versions.)

@rahulporuri rahulporuri self-requested a review October 5, 2021 10:30
@rahulporuri rahulporuri dismissed their stale review October 5, 2021 10:30

Dismissing because of the CI failure on Python 3.10 rc

@mdickinson
Copy link
Member Author

The python version of 3.10 was being interpreted as a (floating-point) number, equal to 3.1. The fix is to add quotes to make it clear it's a string. Since it's fundamentally wrong to treat versions as numbers rather than strings, I've added those quotes to all python versions.

@mdickinson mdickinson marked this pull request as draft October 5, 2021 11:15
@mdickinson
Copy link
Member Author

Converting to draft while we work through the various failures.

@mdickinson
Copy link
Member Author

@rahulporuri Okay, I think this is looking okay now. Apologies for the false starts.

@mdickinson mdickinson marked this pull request as ready for review October 5, 2021 11:22
@mdickinson mdickinson marked this pull request as draft October 5, 2021 11:23
@mdickinson
Copy link
Member Author

Sigh. Spoke too soon. There's still a macOS failure.

@mdickinson
Copy link
Member Author

There's still a macOS failure.

This has to do with a bad NumPy build on Python 3.10. It's not clear why NumPy is being built at all - that is, why we're not simply using the wheel. I'll investigate.

@mdickinson
Copy link
Member Author

It's not clear why NumPy is being built at all

NumPy 1.22 supports Python 3.10, but isn't released yet. NumPy 1.21 has preliminary support and test wheels for Linux, but doesn't officially support 3.10. We should just exclude NumPy from the test requirements on Python 3.10 for now.

@mdickinson
Copy link
Member Author

Now this is ready for review.

@mdickinson mdickinson marked this pull request as ready for review October 5, 2021 11:59
Copy link
Contributor

@rahulporuri rahulporuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mdickinson mdickinson merged commit 5afdaf1 into main Oct 5, 2021
@mdickinson mdickinson deleted the update-workflows-for-310 branch October 5, 2021 12:28
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 this pull request may close these issues.

2 participants