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

Can't import 2.1.0 #82

Closed
marban opened this issue Jun 11, 2021 · 6 comments
Closed

Can't import 2.1.0 #82

marban opened this issue Jun 11, 2021 · 6 comments

Comments

@marban
Copy link

marban commented Jun 11, 2021

Getting something like the below right after import:

/lib/python3.8/site-packages/titlecase/__init__.py", line 29, in <module>
    INLINE_PERIOD = regex.compile(r'[\p{Letter}][.][\p{Letter}]', regex.I)
  File "/root/.pyenv/versions/3.8.8/lib/python3.8/re.py", line 252, in compile
    return _compile(pattern, flags)
  File "/root/.pyenv/versions/3.8.8/lib/python3.8/re.py", line 304, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/root/.pyenv/versions/3.8.8/lib/python3.8/sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "/root/.pyenv/versions/3.8.8/lib/python3.8/sre_parse.py", line 948, in parse
    p = _parse_sub(source, state, flags & SRE_FLAG_VERBOSE, 0)
  File "/root/.pyenv/versions/3.8.8/lib/python3.8/sre_parse.py", line 443, in _parse_sub
    itemsappend(_parse(source, state, verbose, nested + 1,
  File "/root/.pyenv/versions/3.8.8/lib/python3.8/sre_parse.py", line 554, in _parse
    code1 = _class_escape(source, this)
  File "/root/.pyenv/versions/3.8.8/lib/python3.8/sre_parse.py", line 349, in _class_escape
    raise source.error('bad escape %s' % escape, len(escape))
re.error: bad escape \p at position 1

@fireundubh
Copy link

Unfortunately, titlecase now requires regex to be installed.

@ppannuto
Copy link
Owner

There was some work on this in #75, I thought regex was sufficiently made optional. If that's not the case, happy to take a PR that goes the rest of the way.

@sbue
Copy link

sbue commented Jun 13, 2021

Same here 👍

@fireundubh
Copy link

@ppannuto re doesn't support \p.

@brocksam
Copy link
Contributor

Hi all,

2.1.0 has unfortunately broken a number of my packages upstream so I am keen we get this sorted ASAP.

@fireundubh has hit the nail on the head with why attempting to use 're' in place of 'regex' has causes this issue. There is good reason why 'regex' exists in the first place as it provides significantly better support for regular expressions with Unicode than 're' does.

I have spent this afternoon trying to implement a fix to the problems introduced by PR #76 on my fork. I have attempted to allow both 're' and 'regex' to be used. However, getting 're' to work without \p is proving problematic and not the correct way approach this IMO.

I think:

  • 2.1.0 needs to be yanked from PyPI ASAP.
  • 2.2.0 release that ensures 'regex' is still a requirement and help downstream users with e.g. titlecase>=2.0.0 is required.
  • Addressing Allow use of stdlib "re" package as an alternative to regex #75 with PR Support re as an alternative to regex #76 has illustrated that the CI/test setup is fallible and needs addressing.
  • Adjusting the dependencies of 'titlecase' to inadvertently make it compatible with Apple silicon is the wrong was to address support for 'titlecase' on Apple silicon.
  • Apple silicon support should be provided by helping the 'regex' maintainers support Apple silicon.

I'm not apportioning blame here, just trying to help us get this fixed ASAP 🙂

@ppannuto
Copy link
Owner

I just pushed v2.2 to PyPI with the combined fixes from #84. Apologies again for the breakage and thank you for the quick fixes!!

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

No branches or pull requests

5 participants