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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Self type in _BaseKafkaQueueConsumerFactory.new() #894

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

salomon-smekecohen
Copy link
Contributor

@salomon-smekecohen salomon-smekecohen commented Apr 29, 2024

Closes #797

💸 TL;DR

Correct a typing annotation

🧪 Testing Steps / Validation

Lint pass in ci

✅ Checks

  • CI tests (if present) are passing
  • Adheres to code style for repo
  • Contributor License Agreement (CLA) completed if not a Reddit employee

Before:

Screenshot 2024-04-29 at 2 17 04 PM

After:

Screenshot 2024-04-29 at 2 16 18 PM

@@ -38,6 +38,7 @@ requests = ">=2.21.0,<3.0"
sentry-sdk = { version = ">=1.35.0,<2.0", optional = true }
sqlalchemy = { version = ">=1.4.49,<2", optional = true }
thrift-unofficial = ">=0.19.0,<1.0"
typing-extensions = "^4.11.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already a dependency, just an indirect one. Moved to direct since I import from it.

@@ -19,6 +19,7 @@
from prometheus_client import Counter
from prometheus_client import Gauge
from prometheus_client import Histogram
from typing_extensions import Self
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it's worth doing

try:
    from typing import Self  # Python >= 3.11
except ImportError:
    from typing_extensions import Self

and then doing this in pyproject.toml:

typing-extensions = {version = "^4.11.0", python = "<3.11"}

?

@salomon-smekecohen
Copy link
Contributor Author

salomon-smekecohen commented Apr 29, 2024 via email

@chriskuehl chriskuehl merged commit 16e3934 into reddit:develop Apr 29, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

Typing annotation issues in frameworks/queue_consumers/kafka.py:_BaseKafkaQueueConsumerFactory::new
3 participants