Skip to content

fix: poetry run pytest raises SyntaxError: invalid escape sequence \S#454

Closed
waketzheng wants to merge 12 commits intoTheKevJames:masterfrom
waketzheng:master
Closed

fix: poetry run pytest raises SyntaxError: invalid escape sequence \S#454
waketzheng wants to merge 12 commits intoTheKevJames:masterfrom
waketzheng:master

Conversation

@waketzheng
Copy link

@waketzheng waketzheng commented May 24, 2024

Fixes #465

Checklist

  • poetry run pytest
  • pre-commit run --all-files
  • tox

Motivation and Context

As the docopt project has been not maintained for many years, shall we to use another one to replace it:
docopt/docopt#507 (comment)
https://github.com/jazzband/docopt-ng

  • Drop support for Python3.8
  • Pass mypy check
  • pre-commit autoupdate
  • Remove coverage v5 from tox test list

@waketzheng waketzheng requested a review from TheKevJames as a code owner May 24, 2024 10:00
@waketzheng waketzheng changed the title chore(deps): use docopt-ng instead fix: poetry run pytest raises SyntaxError: invalid escape sequence \S Jun 8, 2024
@waketzheng
Copy link
Author

@TheKevJames thanks for this useful and easy to use package~

Can this PR be accepted?

@jpmckinney
Copy link

+1 The test failures are only because CI isn't configured to allow third-party PRs to push results to Coveralls.

docopt is not maintained and has deprecated code that will eventually cause SyntaxError in all cases (it currently causes SyntaxWarnings, that are upgraded to errors if run with PYTHONWARNINGS=error or similar).

https://docs.python.org/3/whatsnew/3.12.html

A backslash-character pair that is not a valid escape sequence now generates a SyntaxWarning, instead of DeprecationWarning. For example, re.compile("\d+.\d+") now emits a SyntaxWarning ("\d" is an invalid escape sequence, use raw strings for regular expression: re.compile(r"\d+.\d+")). In a future Python version, SyntaxError will eventually be raised, instead of SyntaxWarning. (Contributed by Victor Stinner in gh-98401.)

@waketzheng
Copy link
Author

@TheKevJames Cloud you take a look at this PR?

@TheKevJames
Copy link
Owner

Thanks for the contribution, and sorry I;ve been so absent from this repo!

I've just gone ahead and migrated to typer, as I'm not really a fan of the docopt approach anyway, so the underlying issue here should be solved with the next release.

As for the various other changes you made -- uv, ruff, httpx, etc, etc -- please feel free to suggest them as individual improvements; if there's a good reason to adopt any of them, I'd certainly consider it! But please keep those changes separate so they're easier to independently review. Thanks!

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.

poetry run pytest raises SyntaxError: invalid escape sequence \S

3 participants