Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

timm.models: explicitly export attributes #2442

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

adamjstewart
Copy link
Contributor

@adamjstewart adamjstewart commented Feb 21, 2025

Same as #2399 but for timm.models. I didn't bother with any other __init__.py or star imports because I'm not currently using them.

@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

@rwightman
Copy link
Collaborator

rwightman commented Feb 21, 2025

@adamjstewart question, the from .model import * that rely on the __all__ within each model module, they don't trigger any mypy complaints?

@rwightman rwightman merged commit 92682d8 into huggingface:main Feb 21, 2025
22 checks passed
@adamjstewart adamjstewart deleted the types/timm.models branch February 22, 2025 01:11
@adamjstewart
Copy link
Contributor Author

Star imports in general don't work with any static type checkers or style tools. In this case, it looks like mypy ignores star imports because it can't know whether or not something is defined. The following doesn't raise any complaints in mypy:

from timm.models import ResNet

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants