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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

(馃悶) include a py.typed in the distribution (pep 561) #4822

Open
KotlinIsland opened this issue Jul 17, 2023 · 3 comments 路 May be fixed by #4823
Open

(馃悶) include a py.typed in the distribution (pep 561) #4822

KotlinIsland opened this issue Jul 17, 2023 · 3 comments 路 May be fixed by #4823

Comments

@KotlinIsland
Copy link
Contributor

I am attempting to use some of the new code that includes type annotations, but unfortunately there is no py.typed file, so any type checker will ignore the annotations.

https://peps.python.org/pep-0561/

@KotlinIsland KotlinIsland linked a pull request Jul 17, 2023 that will close this issue
@pekkaklarck
Copy link
Member

Is it ok to add this file even though the whole project isn't typed? Can it be added only to a certain sub package? In that case we could add it when such a package is properly typed. For example, we have #4841 about typing the whole robot.api package.

Notice that typing the whole Robot code page in the near future isn't a realistic goal, but typing all public APIs is something we can try.

@KotlinIsland
Copy link
Contributor Author

Is it ok to add this file even though the whole project isn't typed?

With this file, mypy will see the modules/classes/functions. without, it will only complain.

Can it be added only to a certain sub package?

I'm pretty sure you can.

@pekkaklarck
Copy link
Member

My understanding of py.typed is that indicates that the module is properly typed. That's not true for the robot module and, very importantly, isn't even a goal in the foreseeable future. We have, however, an issue about properly typing the robot.api module and the plan is to add py.typed there once we are ready.

If you can point me to some authoritative documentation stating that adding py.typed is fine even if types are incomplete, we can add it. Adding it wouldn't make typing the whole code base a goal, though, and we'd preserve the right to remove the file if it causes problems or confusion.

I understand that some users would benefit from more detailed typing. I think the best solution would be such users creating stub files that can be distributed separately.

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 a pull request may close this issue.

2 participants