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

Add stubs for django-import-export #11709

Open
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

Viicos
Copy link
Contributor

@Viicos Viicos commented Apr 3, 2024

Was discussed in django-import-export/django-import-export#1783

Checklist:

  • formats
  • templatetags
  • __init__.pyi
  • admin.pyi
  • exceptions.pyi
  • fields.pyi
  • forms.pyi
  • instance_loaders.pyi
  • mixins.pyi
  • resources.pyi
  • results.pyi
  • signals.pyi
  • tmp_storages.pyi
  • utils.pyi
  • widgets.pyi

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

`render` and `clean` should be redefined on each subclass
as the return value can change. However, this is usually
not an API users will have to deal with, so not worth
the trouble

This comment has been minimized.

This comment has been minimized.

This comment has been minimized.

1 similar comment

This comment has been minimized.

@Viicos
Copy link
Contributor Author

Viicos commented Apr 14, 2024

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? 🤔

@Viicos Viicos marked this pull request as ready for review April 14, 2024 10:49
@Viicos Viicos changed the title Add base stubs for django-import-export Add stubs for django-import-export Apr 14, 2024

This comment has been minimized.

@srittau
Copy link
Collaborator

srittau commented Apr 14, 2024

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.

This comment has been minimized.

This comment has been minimized.

Copy link
Contributor

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

@Viicos
Copy link
Contributor Author

Viicos commented Apr 15, 2024

Interesting pytype error..

@srittau
Copy link
Collaborator

srittau commented Apr 15, 2024

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 added a commit to typeshed-internal/stub_uploader that referenced this pull request Apr 15, 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.

None yet

2 participants