-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: Update codebase to use newer django syntax #1656
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: Update codebase to use newer django syntax #1656
Conversation
@@ -12,7 +12,7 @@ | |||
class Command(BaseCommand): | |||
help = "Removes all python bytecode compiled files from the project." | |||
|
|||
requires_system_checks = False | |||
requires_system_checks = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in newer version of django, this value should be list/tuple of Tags
or __all__
. You can check the documentation here.
For mypy
linting to work well with backward comptability, I think one of the solution would be to do something of the form:
from typing import List, Tuple, Union
from django.core.checks import Tags
requires_system_checks: Union[bool, List[Tags], Tuple[Tags], str]
Instead of making this change everywhere in the codebase, I think it would be better to create some sort of BaseCommand
and let all commands inherit from it.
Would it be acceptable? Any suggestions are welcome.
6c8bd1b
to
c40a59a
Compare
c40a59a
to
bbb2503
Compare
I have had to make some changes to workaround As of now, it seems that The issue can be demonstrated by the example below: from typing import List
class A:
a: List[int]
class B:
a = [] # <- mypy tends to complain about this I have created an issue there as well python/mypy#10375, but am yet to receive a response. So, for the time being, I think we can use the |
ab79938
to
dcde75e
Compare
- all commands of django_extensions now inherit from a base command `_BaseDjangoExtensionsCommand`. - this helps in defining constant at a single place. - handle django41 deprecation warnings. - update some test code to use upgraded version of django code.
dcde75e
to
9de6e26
Compare
Looks like a big change and the codebase has changed a lot since it was first proposed. I'm closing this. Thank you. |
_BaseDjangoExtensionsCommand
._
is prefixed intentionally to indicate theclass
as an internal API.)