-
Notifications
You must be signed in to change notification settings - Fork 666
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 typing information for contexts, token #4346
base: main
Are you sure you want to change the base?
Conversation
Dear maintainers, on the original PR #4164 I cannot see the details of the github action test failures, to me the code contribution by @hyoinandout looks good and mergeable. If there are incompatabilities with the python-contrib-instrumentations I am willing to look into it, but for this I'd need to see the github-action-results/failures ;) |
@@ -64,7 +64,7 @@ def test_attach(self): | |||
self.assertEqual("yyy", context.get_value("a")) | |||
|
|||
with self.assertLogs(level=ERROR): | |||
context.detach("some garbage") | |||
context.detach("some garbage") # type:ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the type: ignore
needed?
context.detach("some garbage") # type:ignore | |
context.detach("some garbage") # type: ignore[?] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
True thanks this was actually not necessary, slipped past me. I removed the type:ignore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The opentelemetry/context
directory needs to be included in the mypy setup.
Not related to this PR, but I already pointed out that this setup doesn't make sense. mypy needs to run once, and it should have the context of the local imports.
I've shared my thoughts here: open-telemetry/opentelemetry-python-contrib#3116 (comment)
I'm happy to push a PR switching the type checker used here, and I'm happy to help this project to have proper type hints. Otherwise, I think someone should try to make the mypy setup work properly.
I'll bring the above to the next Python SIG meeting.
Thanks for the review, as some other people before me I am implementing opentelemetry in code I am working on, and I have type-checking for this code setup which accounts for dependencies. There was a bug (on my side, wrongly using open-telemetry) that could have been avoided or would have been caught by From where I am sitting, merging this small PR would bring immediate improvements for everyone that runs a type-checker on their code and imports from opentelemetry-python. I am not sure what the procedure is, who to talk to and such, to get it in. @hyoinandout actually already opened a PR with these exact changes ( #4164 ), but I guess they could not get it merged. Any advice or support would be welcome from my side, as I am fairly sure other people will run into issues that could be prevented by proper typing here :--) |
Or, well, if any maintainer feels that realistically this PR wont be merged, then please let me know as well, to spare some work&time ;) |
The |
Hey @Kludex and others , I hope I am not stealing too much of your time thanks for the consideration :--) I read up on your pyright vs. mypy issue mentioned, and checked my PR here for this and your comment to include the From what I can see:
Summarizing, w.r.t. Thanks a lot, Cheers! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Sorry for being annoying. This looks great. Thanks! :) |
Description
Trying to get #4164 in.
Opening this 1:1 similar PR for now, with changes from upstream/main, to see how the tests look. Locally, all tests are green.
This is WIP for now.Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Ran the
tox
full test suite locally, all green. Waiting for maintainer approval for the github actions testsDoes This PR Require a Contrib Repo Change?
Checklist: