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

MAINT: Ignore svgutils regex warning #170

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jhlegarreta
Copy link
Collaborator

Ignore svgutils regex warning: the package is at its most recent release (0.3.4), and last commit was 3 years ago.

Fixes:

 .tox/py312-latest/lib/python3.12/site-packages/svgutils/compose.py:379
    /lib/python3.12/site-packages/svgutils/compose.py:379:
 SyntaxWarning: invalid escape sequence '\.'
      m = re.match("([0-9]+\.?[0-9]*)([a-z]+)", measure)

raised for example in:
https://github.com/nipreps/nireports/actions/runs/13355051658/job/37296638147?pr=169#step:14:337

Copy link

codecov bot commented Feb 16, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.38%. Comparing base (7320552) to head (0b0b2c8).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #170      +/-   ##
==========================================
+ Coverage   66.04%   66.38%   +0.33%     
==========================================
  Files          25       25              
  Lines        2677     2677              
  Branches      421      421              
==========================================
+ Hits         1768     1777       +9     
+ Misses        793      788       -5     
+ Partials      116      112       -4     
Flag Coverage Δ
unittests 61.33% <ø> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jhlegarreta
Copy link
Collaborator Author

@jhlegarreta jhlegarreta marked this pull request as draft February 16, 2025 13:15
pyproject.toml Outdated
filterwarnings = ["ignore::DeprecationWarning"]
filterwarnings = [
"ignore::DeprecationWarning",
"ignore:.*invalid escape sequence.*:SyntaxWarning:svgutils.compose",
Copy link
Member

Choose a reason for hiding this comment

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

So far, I've only been able to suppress it with:

Suggested change
"ignore:.*invalid escape sequence.*:SyntaxWarning:svgutils.compose",
"ignore::SyntaxWarning",

An alternative could be to add python -c 'import svgutils.compose' as a pre-command, so that the file is already compiled. Then other SyntaxWarnings could be promoted to errors while ignoring this specific one.

commands_pre =
  python -c "import svgutils.compose"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍 Took the second approach. Not sure why the spellcheck and style checks are unhappy even if I added svgutils explicitly as a dependency.

Copy link
Collaborator Author

@jhlegarreta jhlegarreta Feb 17, 2025

Choose a reason for hiding this comment

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

After having fixed the spellcheck and style environments in 0c0fa8c, the thing is that the import itself raises the warning, so we have only relocated the issue to another place (even if for the purposes of pytest, it would be OK).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Have tried all possibilities that I could com up with and no solution worked other than the one in 0b0b2c8
https://github.com/nipreps/nireports/actions/runs/13370993742/job/37339233487?pr=170#step:14:333
https://github.com/nipreps/nireports/actions/runs/13370993742/job/37339233086?pr=170#step:14:331

I am not fond of it as it is too broad, but 0c0fa8c was not satisfactory enough either (#170 (comment)) so I would vote for merging this as is and hoping that no regexes that we may potentially add in the code will raise this @effigies.

@jhlegarreta jhlegarreta force-pushed the FilterSvgUtilsWarning branch 4 times, most recently from 5309edc to 0c0fa8c Compare February 17, 2025 12:04
@jhlegarreta jhlegarreta marked this pull request as ready for review February 17, 2025 12:12
@jhlegarreta jhlegarreta marked this pull request as draft February 17, 2025 12:13
@jhlegarreta jhlegarreta force-pushed the FilterSvgUtilsWarning branch 4 times, most recently from 6b89bc8 to 0259eeb Compare February 17, 2025 12:58
Ignore `svgutils` regex warning: the package is at its most recent
release (0.3.4), and last commit was 3 years ago.

Fixes:
```
 .tox/py312-latest/lib/python3.12/site-packages/svgutils/compose.py:379
    /lib/python3.12/site-packages/svgutils/compose.py:379:
 SyntaxWarning: invalid escape sequence '\.'
      m = re.match("([0-9]+\.?[0-9]*)([a-z]+)", measure)
```

raised for example in:
https://github.com/nipreps/nireports/actions/runs/13355051658/job/37296638147?pr=169#step:14:337

Co-authored-by: Chris Markiewicz <[email protected]>
@jhlegarreta jhlegarreta force-pushed the FilterSvgUtilsWarning branch from 0259eeb to 0b0b2c8 Compare February 17, 2025 13:07
@jhlegarreta jhlegarreta marked this pull request as ready for review February 17, 2025 13:20
@effigies
Copy link
Member

This feels extremely brittle. svgutils is small and unmaintained. What if we just vendor a fixed copy?

@jhlegarreta
Copy link
Collaborator Author

This feels extremely brittle. svgutils is small and unmaintained. What if we just vendor a fixed copy?

Looks good to me Chris. TBH, I was not able to locate the faulty statement

m = re.match("([0-9]+\.?[0-9]*)([a-z]+)", measure)

in svgutils/compose.py:379, so I am curious to know how you went about it in PR #172.

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