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: annoying mypy error is annoying #26581

Closed
wants to merge 11 commits into from
Closed

fix: annoying mypy error is annoying #26581

wants to merge 11 commits into from

Conversation

pauldambra
Copy link
Member

@pauldambra pauldambra commented Dec 2, 2024

lately I get an error when running mypy

i'm not the only one: https://posthog.slack.com/archives/C0113360FFV/p1733155706603479

AssertionError: Cannot find component 'trace' for 'opentelemetry.trace'

on updating to latest mypy I then get

OverflowError: int too big to convert

We can fix this by not writing to a mypy cache. Since that's what's failing

This is a workaround not a fix 🙈


Regardless of how I try to ignore it the last output we see in verbose mode is something like

LOG:  Cached module mimesis.providers.payment has same interface
LOG:  Writing mimesis.providers.internet /Users/paul/github/posthog/env/lib/python3.11/site-packages/mimesis/providers/internet.py mimesis/providers/internet.meta.json mimesis/providers/internet.data.json
LOG:  Build finished in 8.507 seconds with 7108 modules, and 0 errors
OverflowError: int too big to convert

if I delete the py.typed file in the mimesis package then we no longer get the error but things like

[mypy-mimesis.providers.*]
ignore_errors = True

in the mypy.ini didn't change anything

presumably mimesis has a very large number in it (or something that resolve to one) and when mypy tries to cache it the json serializer can't cope 🤷

i tried updating to mimesis v18 which didn't affect anything - and is a 13 major version jump so I didn't include it here

it isn't clear to me if this is a bug in mypy or mimesis or the overlap between them (or indeed something else 🙈)

@pauldambra pauldambra requested review from Twixes and a team December 2, 2024 20:23
Copy link
Contributor

github-actions bot commented Dec 2, 2024

Size Change: 0 B

Total Size: 1.11 MB

ℹ️ View Unchanged
Filename Size
frontend/dist/toolbar.js 1.11 MB

compressed-size-action

@pauldambra
Copy link
Member Author

downgrading to

mypy~=1.7.1
django-stubs==4.2.7

means no more errors running mypy
but hundreds more violations reported

Copy link
Contributor

@ioannisj ioannisj left a comment

Choose a reason for hiding this comment

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

Low context but makes sense

@pauldambra
Copy link
Member Author

ok, this is silly. mypy results are apparently bouncing but 🤷

going to binary search in commits using uv pip install -r requirements.txt -r requirements-dev.txt && rm -rf .mypy_cache && mypy -p posthog | mypy-baseline filter && mypy -p posthog | mypy-baseline filter see if i can narrow down when things went wrong

Copy link
Collaborator

Choose a reason for hiding this comment

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

Where did this go? 🤯

Copy link
Member Author

Choose a reason for hiding this comment

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

i really like mypy, this is all very straight-forward and enjoyable

Copy link
Member Author

Choose a reason for hiding this comment

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

completely tore down my environment, and still get this result 🤷

Copy link
Member Author

Choose a reason for hiding this comment

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

i don't get the error today, but i've installed so many different versions of mypy and associated deps that i don't trust my machine

@pauldambra pauldambra closed this Dec 3, 2024
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.

3 participants