-
-
Notifications
You must be signed in to change notification settings - Fork 62
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
"django_components.component" does not explicitly export attribute "register" #458
Comments
@thacoon How would we fix this, and are you open to writing a PR? |
Looking at this thread, I guess a temporary workaround could be to either:
What would be a proper fix? @thacoon can you share your mypy config? |
@JuroOravec my latest configuration is:
|
I think the problem this mypy error is trying to point us at, is that we rely on the component module importing A simple way to explicitly define the public API is specifying all, and list all the symbols we export. Isn't that the simplest solution here? |
@EmilStenstrom So we want to define |
@thacoon I wasn't able to get the same error in my project, but it might be because there I'm on django_components 0.66 and mypy 1.7.0. What versions are you on? Could you possibly test the solution below to check if it solves the issue? In your python packages folder, navigate to from django_components.component_registry import AlreadyRegistered, ComponentRegistry, NotRegistered, register # NOQA to from django_components.component_registry import (
AlreadyRegistered as AlreadyRegistered,
ComponentRegistry as ComponentRegistry,
NotRegistered as NotRegistered,
register as register,
) And then run mypy. |
I can confirm that this works with:
|
@mikucz Excellent! Mind writing up a PR as well? Should be a good first contribution, don't you think? :) |
@EmilStenstrom PR as requested: #499 :) |
@mikucz Thanks again for the contribution! This has now been release as part of https://github.com/EmilStenstrom/django-components/releases/tag/0.75 |
I have a component like this
When running mypy I get the following error:
error: Module "django_components.component" does not explicitly export attribute "register" [attr-defined]
The text was updated successfully, but these errors were encountered: