typeshed icon indicating copy to clipboard operation
typeshed copied to clipboard

Add stubs for `django-import-export`

Open Viicos opened this issue 1 year ago • 17 comments

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

Viicos avatar Apr 03 '24 17:04 Viicos

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 03 '24 17:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 04 '24 19:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 04 '24 19:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 04 '24 19:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 06 '24 11:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 14 '24 09:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 14 '24 10:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 14 '24 10:04 github-actions[bot]

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:

Viicos avatar Apr 14 '24 10:04 Viicos

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 14 '24 10:04 github-actions[bot]

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.

srittau avatar Apr 14 '24 11:04 srittau

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 15 '24 07:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 15 '24 07:04 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Apr 15 '24 07:04 github-actions[bot]

Interesting pytype error..

Viicos avatar Apr 15 '24 07:04 Viicos

Interesting pytype error..

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.

srittau avatar Apr 15 '24 08:04 srittau

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Oct 03 '24 04:10 github-actions[bot]

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!

batiste avatar Nov 25 '24 10:11 batiste

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Nov 25 '24 11:11 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Nov 25 '24 16:11 github-actions[bot]

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Nov 25 '24 17:11 github-actions[bot]

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.

JelleZijlstra avatar Dec 28 '24 04:12 JelleZijlstra

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

github-actions[bot] avatar Dec 28 '24 09:12 github-actions[bot]

Once merged, I can tackle the update in a separate PR

Viicos avatar Dec 28 '24 09:12 Viicos