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

Move re-flag in _translate_glob to front to build with Python 3.11 #340

Merged
merged 1 commit into from
Oct 26, 2022

Conversation

dhomeier
Copy link
Contributor

Overview

Building with Python 3.11 currently fails at

File "/Users/derek/git/pywwt/setupbase.py", line 613, in _compile_pattern
    return re.compile(res, flags=flags).match
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/lib/python3.11/re/__init__.py", line 227, in compile
    return _compile(pattern, flags)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/lib/python3.11/re/__init__.py", line 294, in _compile
    p = _compiler.compile(pattern, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/lib/python3.11/re/_compiler.py", line 743, in compile
    p = _parser.parse(p, flags)
        ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/lib/python3.11/re/_parser.py", line 980, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/lib/python3.11/re/_parser.py", line 455, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/lib/python3.11/re/_parser.py", line 841, in _parse
    raise source.error('global flags not at the start '
re.error: global flags not at the start of the expression at position 34

i.e. at the pattern "{res}\Z(?ms)' putting the (?ms) modifier at the end, which has been disallowed in
https://docs.python.org/3.11/library/re.html#regular-expression-syntax

Moving the flag to the front allows to build and pip-install. I have only tested this back to Python 3.9.

Checklist

  • Changed code has some test coverage (or justify why not)
  • Changes in functionality documented (or justify why not)

@codecov
Copy link

codecov bot commented Oct 26, 2022

Codecov Report

Merging #340 (6ebc5aa) into master (8cf07c2) will not change coverage.
The diff coverage is n/a.

❗ Current head 6ebc5aa differs from pull request most recent head eb1bacf. Consider uploading reports for the commit eb1bacf to get more accurate results

@@           Coverage Diff           @@
##           master     #340   +/-   ##
=======================================
  Coverage   55.68%   55.68%           
=======================================
  Files          23       23           
  Lines        2753     2753           
=======================================
  Hits         1533     1533           
  Misses       1220     1220           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@dhomeier
Copy link
Contributor Author

As there is no py311 job here, I have pulled this for a test in glue-viz/glue-wwt#91 .

@pkgw
Copy link
Contributor

pkgw commented Oct 26, 2022

Thanks! Note that setupbase.py was copied out of Jupyter at some point.

@pkgw pkgw merged commit 3aba4ce into WorldWideTelescope:master Oct 26, 2022
@pkgw
Copy link
Contributor

pkgw commented Oct 26, 2022

Oh, I forgot to mention: pywwt releases are now deposited on Zenodo, and our policy has been that anyone with a contribution in the repo history has the right to be added to the associated author list. Would you like to be added as an author? If so, you can put in a PR to add yourself to the ci/zenodo.json5 file. Or you can provide me with preferred name spelling, affiliation, and ORCiD, and I can do that myself.

@dhomeier
Copy link
Contributor Author

They seem to have moved to a PEP 508-style install since. But at least I've learned some things about re.flags!

@dhomeier dhomeier deleted the fix-re-py311 branch October 26, 2022 18:17
@dhomeier dhomeier mentioned this pull request Oct 26, 2022
1 task
@dhomeier
Copy link
Contributor Author

Oh, thanks; I've just put it in a PR!

@pkgw
Copy link
Contributor

pkgw commented Oct 26, 2022

Thanks! This fix has been released in pywwt 0.16.2.

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