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

fix: Parse pydantic version with regex #218

Merged
merged 2 commits into from
Mar 17, 2025

Conversation

gselzer
Copy link
Contributor

@gselzer gselzer commented Mar 17, 2025

I was getting annoyed by some of the failures coming from here from the prerelease tests in pymmcore-widgets. This fix resolves the parsing errors with Pydantic prereleases.

Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.11.9/x64/bin/mmcore", line 5, in <module>
    from pymmcore_plus._cli import main
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/__init__.py", line 13, in <module>
    from .core import (
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/core/__init__.py", line 25, in <module>
    from ._adapter import DeviceAdapter
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/core/_adapter.py", line 6, in <module>
    from pymmcore_plus.core._device import Device
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/core/_device.py", line 6, in <module>
    from ._property import DeviceProperty
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/core/_property.py", line 7, in <module>
    from .events._device_signal_view import _DevicePropValueSignal
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/core/events/__init__.py", line 6, in <module>
    from ._psygnal import CMMCoreSignaler
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/core/events/_psygnal.py", line 3, in <module>
    from pymmcore_plus.mda import MDAEngine
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/mda/__init__.py", line 1, in <module>
    from ._engine import MDAEngine
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pymmcore_plus/mda/_engine.py", line 9, in <module>
    import useq
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/useq/__init__.py", line 6, in <module>
    from useq._actions import AcquireImage, Action, CustomAction, HardwareAutofocus
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/useq/_actions.py", line 7, in <module>
    from useq._base_model import FrozenModel
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/useq/_base_model.py", line 29, in <module>
    PYDANTIC_VERSION = tuple(int(x) for x in pydantic.__version__.split(".")[:3])
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/useq/_base_model.py", line 29, in <genexpr>
    PYDANTIC_VERSION = tuple(int(x) for x in pydantic.__version__.split(".")[:3])
                             ^^^^^^
ValueError: invalid literal for int() with base 10: '0b1'

Fixes parsing errors with Pydantic prereleases
@gselzer gselzer added the bug Something isn't working label Mar 17, 2025
@gselzer gselzer requested a review from tlambert03 March 17, 2025 14:25
@gselzer gselzer self-assigned this Mar 17, 2025
Copy link

codecov bot commented Mar 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.96%. Comparing base (fec18af) to head (dc2c5a4).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #218      +/-   ##
==========================================
- Coverage   94.28%   93.96%   -0.33%     
==========================================
  Files          22       22              
  Lines        1506     1507       +1     
==========================================
- Hits         1420     1416       -4     
- Misses         86       91       +5     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Member

@tlambert03 tlambert03 left a comment

Choose a reason for hiding this comment

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

Thanks!

@tlambert03 tlambert03 merged commit daae60a into pymmcore-plus:main Mar 17, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants