Add stubs for `django-import-export`
Was discussed in https://github.com/django-import-export/django-import-export/issues/1783
Checklist:
- [x]
formats - [x]
templatetags - [x]
__init__.pyi - [x]
admin.pyi - [x]
exceptions.pyi - [x]
fields.pyi - [x]
forms.pyi - [x]
instance_loaders.pyi - [x]
mixins.pyi - [x]
resources.pyi - [x]
results.pyi - [x]
signals.pyi - [x]
tmp_storages.pyi - [x]
utils.pyi - [x]
widgets.pyi
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
I know there's a lot being added here, so I'd understand if this can't get merged.
I'm also wondering how to fix the issue when Django is being imported? :thinking:
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
The pyright tests are failing, since tablib has no stubs or type annotations yet. So instead of trying to import it, in typeshed we usually just type alias any imported items, like this:
from _typeshed import Incomplete
Dataset: TypeAlias = Incomplete # tablib.Dataset
The easiest way to work around the stubtest problem for now is to set skip = true in the [tool.stubtest] table of METADATA.toml. Please add a comment why this is a necessary.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Interesting pytype error..
Interesting
pytypeerror..
Considering that Library.simple_tag doesn't seem to change the signature, it's probably easiest to just leave it off.
We also need to add django-stubs to the stub uploader allowlist.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Any news on this one? I suppose I will just suppress mypy for this package then. Cheers for the good work already done for this!
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
There's a few remaining CI issues:
- pytype:
stubs/django-import-export/import_export/templatetags/import_export_tags.pyi (3.12): pytype.load_pytd.BadDependencyError: Can't find pyi for 'register', referenced from 'import_export.templatetags.import_export_tags'. This file uses an attribute of a global as a decorator, which is a rare pattern that pytype may not support. Consider removing the decorator and typing the function to whatever type results from the decorator. - pyright:
/home/runner/work/typeshed/typeshed/stubs/setuptools/setuptools/compat/py310.pyi:9:81 - error: Unnecessary "# pyright: ignore" rule: "reportMissingImports" (reportUnnecessaryTypeIgnoreComment). I understand this is because this PR introduces a dependency on django-stubs, which in turn pulls some other packages into the environment that make it so we don't need that ignore any more. Let's just remove the pyright ignore.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉
Once merged, I can tackle the update in a separate PR