-
Notifications
You must be signed in to change notification settings - Fork 656
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
Typing fixes #768, upgrade mypy to 0.770 #769
Conversation
Had to also make some small changes to the actual implementation of `Configuration()`
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.
Nice! Thanks for the cleanup.
Was wondering if anyone had any input specifically on the |
for some reason `scripts/eachdist.py lint` is not in sync with `tox lint` and it messes up CI
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, thanks for refactoring this!
* feat: separate context propagation
Closes #768. Removes 8 type ignores across api.
type: ignore
inopentelemetry-api/src/opentelemetry/configuration/__init__.py
cls._{key}
and a property descriptor was added atcls.{key}
to access it (read-only). I switched this to just store each value in a dict and instead allow access by overriding__getattr__()
, which is a little simpler and easier to add typing to directly on the method declaration.getattr()
, just callConfiguration().get()
which is typed._load_trace_provider()
/_load_meter_provider()
to keep all the casting in the utilsopentelemetry-api/src/opentelemetry/__init__.pyi
(that'spyi
)opentelemetry
directory is a namespace package and shouldn't have an__init__.py
. However, mypy was seeing everything inopentelemetry-api/src/opentelemetry/metrics/__init__.py
as if it was the packagemetrics
and notopentelemetry.metrics
.__init__.pyi
lets mypy knowopentelemetry
is a package without losing the namespace package behavior.Note, tox has a bug where it doesn't detect that the requirements file was updated. To get the new mypy version, force tox to recreate its venvs:
tox --recreate