-
Notifications
You must be signed in to change notification settings - Fork 462
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
Remove compatibility utils for old Python #2645
Conversation
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.
Left some comments
Co-authored-by: Daniel Szoke <szokeasaurusrex@users.noreply.github.com>
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.
Thanks for addressing everything!
Looks good, I left a small nitpick you can consider changing before we merge
sentry_sdk/tracing.py
Outdated
@@ -14,7 +14,7 @@ | |||
from typing import Dict | |||
from typing import Iterator | |||
from typing import List | |||
from typing import Mapping | |||
from collections.abc import Mapping |
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.
Small nitpick (feel free to leave unchanged): Now that you changed this line to import from collections.abc
instead of from typing
, it is a bit weird that it is surrounded by typing
imports. Could you reorder this import to be above all the typing
imports?
On a related note, it would be nice if we could use some kind of automatic Python formatting tool to automatically enforce alphabetical ordering for imports. Something like this exists in Rust, and I find that it helps keep code more organized.
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.
There are multiple tools for this in Python, too, e.g. isort
. Would be very happy to have this automated at some point. Will change the order here manually.
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.
Fixed: 3110117
The goal of this PR is to remove Python 2.7 and 3.5 compatibility utils from
_compat.py
and replace them with their Python 3.6+ equivalents throughout the codebase.Note: This PR removes some import handling for imports that are different between py2 and py3, but not all -- this will be done in a separate PR.
General Notes
Thank you for contributing to
sentry-python
!Please add tests to validate your changes, and lint your code using
tox -e linters
.Running the test suite on your PR might require maintainer approval. Some tests (AWS Lambda) additionally require a maintainer to add a special label to run and will fail if the label is not present.
For maintainers
Sensitive test suites require maintainer review to ensure that tests do not compromise our secrets. This review must be repeated after any code revisions.
Before running sensitive test suites, please carefully check the PR. Then, apply the
Trigger: tests using secrets
label. The label will be removed after any code changes to enforce our policy requiring maintainers to review all code revisions before running sensitive tests.