-
Notifications
You must be signed in to change notification settings - Fork 650
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 type hints to opentelemetry-sdk and run as a part of tests #1608
Comments
Related to #773 |
I've looked into this a few times and there were really annoying issues with namespace packages and finding the code. Mypy 0.8xx (#1575) has made huge improvements there and I think it should be much cleaner now. Like you mentioned, there is a lot of untyped code and code with types that was added as a best effort without running mypy. I think we will need a really relaxed config or start with only a few SDK files and slowly work up. It would be awesome if we could get a nicer pattern for tox/mypy/setuptools so any new packages we scaffold will be fully checked from the start |
I recently updated mypy to 0.812 version (#1705). Finding code inside packages is much easier right now, so I can take care of running mypy tests for |
This issue was marked stale due to lack of activity. It will be closed in 30 days. |
@dmolenda-sumo |
Yes, I do. I've been a little busy recently, but I hope to finish this task soon |
This issue was marked stale due to lack of activity. It will be closed in 30 days. |
@dmolenda-sumo |
It seems like Mypy is expecting there to be an I've experimented with adding an empty It seems like you would just need to add it to this location and everything would be fine: |
Actually, there appear to be quite a few And I think I'm beginning to see that there might be a problem with the fact that the main module name 'opentelemetry' is used in multiple installation packages, when it probably would have made more sense to have a separate root module name for each package (i.e. 'opentelemetryapi' for -api, 'opentelemetrysdk' for -sdk, etc.) |
Hi @srikanthccv, thank you for directing me to that information. So is it expected that anyone pulling opentelemetry into their project will need to run mypy with this I noticed that the tox.ini file uses this argument that you pointed out with the mypy command during the automated tests: Line 174 in 95aeecc
|
Yes |
Thank you so much @srikanthccv, I added that to my configuration and now mypy is able to resolve all of the imports from opentelemetry-python! |
I"m happy to do a bit of work on this but to be honest I've found working with the opentelemetry repos very hard. I have plenty of experience working with complex setups but I keep finding issues with these repos, like linting seemingly not running properly in CI or errors simply following the |
This is one area we all agree that the current experience is really poor. I suspect, that even within the core team, we have found different ways of working around the problems. I want to see this improved. I spent some time in the past to replace our tooling in the hope of a better experience #3260 but that didn't materialize. I will be happy to get on a call but let me throw away my current setup and start fresh to see what are the common issues folks run into and help fix them. |
@adriangb @srikanthccv were you able to realize that call? @adriangb do you need further help? |
We did have a call, during it we found that formatting / linting wasn’t working at all (or wasn’t working for the sdk package, I don’t remember the exact details, maybe @srikanthccv does) so it was very productive! That said this issues should remain open since the original request hasn’t been addressed. I personally would like to work on it but have not had time lately. |
Part of open-telemetry#1608 Addressing running mypy on opentelemetry-sdk iteratively so we don't have to make one big change addressing all mypy issues at once.
Part of open-telemetry#1608 Addressing running mypy on opentelemetry-sdk iteratively so we don't have to make one big change addressing all mypy issues at once.
Part of open-telemetry#1608 Addressing running mypy on opentelemetry-sdk iteratively so we don't have to make one big change addressing all mypy issues at once.
Part of open-telemetry#1608 Addressing running mypy on opentelemetry-sdk iteratively so we don't have to make one big change addressing all mypy issues at once.
Part of open-telemetry#1608 Addressing running mypy on opentelemetry-sdk iteratively so we don't have to make one big change addressing all mypy issues at once.
Is there a work happening on this? I recently just learned about opentelemetry and got very excited about it, but the type support is abysmal. It makes working with the code really unemployable, especially since the library seems extremely complex. |
Much of
opentelemetry-sdk
code doesn't have type hints. It would be great to add mypy type hints and run the tests similar toopentelemetry-api
.The text was updated successfully, but these errors were encountered: