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 mypy checks #184

Merged
merged 6 commits into from
Oct 29, 2024
Merged

Fix mypy checks #184

merged 6 commits into from
Oct 29, 2024

Conversation

browniebroke
Copy link
Contributor

@browniebroke browniebroke commented Dec 13, 2023

I think that the mypy tests are broken (See #183), so fixing them here before.

@codecov-commenter
Copy link

codecov-commenter commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6b24fae) 98.23% compared to head (dcdd232) 98.23%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #184   +/-   ##
=======================================
  Coverage   98.23%   98.23%           
=======================================
  Files           3        3           
  Lines         227      227           
=======================================
  Hits          223      223           
  Misses          4        4           
Flag Coverage Δ
unittests 98.23% <ø> (ø)

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.

error: "type[UFMChild]" has no attribute "objects"  [attr-defined]

It's a Django model, this attribute exists...
@browniebroke
Copy link
Contributor Author

Looks like the failures are for older version of Django (3.1):

py311-dj31-drf314-mypy: commands[0]> mypy example
  /home/runner/work/drf-writable-nested/drf-writable-nested/.tox/py311-dj31-drf314-mypy/lib/python3.11/site-packages/django/utils/encoding.py:266: DeprecationWarning: 'locale.getdefaultlocale' is deprecated and slated for removal in Python 3.15. Use setlocale(), getencoding() and getlocale() instead.
    encoding = locale.getdefaultlocale()[1] or 'ascii'
  /home/runner/work/drf-writable-nested/drf-writable-nested/.tox/py311-dj31-drf314-mypy/lib/python3.11/site-packages/django-stubs/contrib/sites/models.pyi:13: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
  https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
  If this issue continues with mypy master, please report a bug at [https://github.com/python/mypy/issues](https://github.com/python/mypy/issues?q=is%3Aissue+is%3Aopen+sort%3Aupdated-desc)
  version: 1.7.1
  /home/runner/work/drf-writable-nested/drf-writable-nested/.tox/py311-dj31-drf314-mypy/lib/python3.11/site-packages/django-stubs/contrib/sites/models.pyi:13: : note: please use --show-traceback to print a traceback when reporting a bug
  py311-dj31-drf314-mypy: exit 2 (1.35 seconds) /home/runner/work/drf-writable-nested/drf-writable-nested> mypy example pid=2330
py311-dj31-drf314-mypy: FAIL ✖ in 8.22 seconds

The latest versions of django-stubs and djangorestframework-stubs are for a specific version of Django and DRF, so I feel like we shouldn't type check for older versions... Thoughts?

@browniebroke
Copy link
Contributor Author

browniebroke commented Dec 13, 2023

Alternatively, drop support for Django <3.2, which has been long unsupported:

image

@browniebroke
Copy link
Contributor Author

browniebroke commented Dec 13, 2023

Tests are now passing, but it fails to upload to codecov... It seems unrelated to my change, but if someone can help resolving this, that would be appreciated. Thanks

@browniebroke browniebroke marked this pull request as ready for review December 13, 2023 10:37
@ruscoder ruscoder merged commit 24da9c0 into beda-software:master Oct 29, 2024
0 of 5 checks passed
@browniebroke browniebroke deleted the fix-mypy branch October 29, 2024 06:59
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