Skip to content

Commit e394544

Browse files
authored
Move kafka.sasl -> kafka.net.sasl (#3056)
1 parent 2de1683 commit e394544

17 files changed

Lines changed: 34 additions & 27 deletions

File tree

CHANGES.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ This is a major release with significant changes to kafka-python internals to si
3636
* Remove kafka.client_async / kafka.conn legacy modules (#2918)
3737
* Drop version probes for pre-0.10/ApiVersionsRequest brokers
3838

39+
### SASL Module Rename
40+
* Rename kafka.sasl -> kafka.net.sasl
41+
3942
## Networking (kafka.net)
4043

4144
Complete refactor of the networking layer using a bespoke event-loop supporting async/await (but no asyncio yet). All three clients (Admin, Consumer, Producer) use a dedicated IO thread that drives a selector-based event loop. AdminClient/KafkaConsumer leverage a built-in io thread supplied by kafka.net, KafkaProducer continues to use its existing background Sender thread for now.

docs/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,10 @@ Old Networking Stack Removal
4848
* Remove kafka.client_async / kafka.conn legacy modules (#2918)
4949
* Drop version probes for pre-0.10/ApiVersionsRequest brokers
5050

51+
SASL Module Rename
52+
^^^^^^^^^^^^^^^^^^
53+
* Rename kafka.sasl -> kafka.net.sasl
54+
5155
Networking (kafka.net)
5256
----------------------
5357

kafka/admin/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class KafkaAdminClient(
174174
sasl mechanism handshake. Default: 'kafka'
175175
sasl_kerberos_domain_name (str): kerberos domain name to use in GSSAPI
176176
sasl mechanism handshake. Default: one of bootstrap servers
177-
sasl_oauth_token_provider (kafka.sasl.oauth.AbstractTokenProvider): OAuthBearer
177+
sasl_oauth_token_provider (kafka.net.sasl.oauth.AbstractTokenProvider): OAuthBearer
178178
token provider instance. Default: None
179179
proxy_url (str): URL to proxy socket connections through. Supports SOCKS5 only.
180180
Requires scheme:// (e.g., socks5://foo.bar/). Default: None

kafka/consumer/group.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ class KafkaConsumer:
283283
sasl mechanism handshake. Default: 'kafka'
284284
sasl_kerberos_domain_name (str): kerberos domain name to use in GSSAPI
285285
sasl mechanism handshake. Default: one of bootstrap servers
286-
sasl_oauth_token_provider (kafka.sasl.oauth.AbstractTokenProvider): OAuthBearer
286+
sasl_oauth_token_provider (kafka.net.sasl.oauth.AbstractTokenProvider): OAuthBearer
287287
token provider instance. Default: None
288288
proxy_url (str): URL to proxy socket connections through. Supports SOCKS5 only.
289289
Requires scheme:// (e.g., socks5://foo.bar/). Default: None

kafka/net/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@
88
import kafka.errors as Errors
99
from kafka.future import Future
1010
from kafka.net.metrics import KafkaConnectionMetrics
11+
from kafka.net.sasl import get_sasl_mechanism
1112
from kafka.protocol.metadata import ApiVersionsRequest
1213
from kafka.protocol.sasl import SaslAuthenticateRequest, SaslHandshakeRequest, SaslBytesRequest
1314
from kafka.protocol.broker_version_data import BrokerVersionData
1415
from kafka.protocol.parser import KafkaProtocol
15-
from kafka.sasl import get_sasl_mechanism
1616
from kafka.version import __version__
1717

1818

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import platform
22

3-
from kafka.sasl.gssapi import SaslMechanismGSSAPI
4-
from kafka.sasl.msk import SaslMechanismAwsMskIam
5-
from kafka.sasl.oauth import SaslMechanismOAuth
6-
from kafka.sasl.plain import SaslMechanismPlain
7-
from kafka.sasl.scram import SaslMechanismScram
8-
from kafka.sasl.sspi import SaslMechanismSSPI
3+
from .gssapi import SaslMechanismGSSAPI
4+
from .msk import SaslMechanismAwsMskIam
5+
from .oauth import SaslMechanismOAuth
6+
from .plain import SaslMechanismPlain
7+
from .scram import SaslMechanismScram
8+
from .sspi import SaslMechanismSSPI
99

1010

1111
SASL_MECHANISMS = {}
File renamed without changes.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
gssapi = None
1010
GSSError = None
1111

12-
from kafka.sasl.abc import SaslMechanism
12+
from .abc import SaslMechanism
1313

1414

1515
class SaslMechanismGSSAPI(SaslMechanism):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# no botocore available, will disable AWS_MSK_IAM mechanism
1414
BotoSession = None
1515

16+
from .abc import SaslMechanism
1617
from kafka.errors import KafkaConfigurationError
17-
from kafka.sasl.abc import SaslMechanism
1818

1919

2020
log = logging.getLogger(__name__)
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
from abc import ABC, abstractmethod
22
import logging
33

4+
from .abc import SaslMechanism
45
from kafka.errors import KafkaConfigurationError
5-
from kafka.sasl.abc import SaslMechanism
66

77

88
log = logging.getLogger(__name__)
@@ -14,7 +14,7 @@ def __init__(self, **config):
1414
if 'sasl_oauth_token_provider' not in config:
1515
raise KafkaConfigurationError('sasl_oauth_token_provider required for OAUTHBEARER sasl')
1616
if not isinstance(config['sasl_oauth_token_provider'], AbstractTokenProvider):
17-
raise KafkaConfigurationError('sasl_oauth_token_provider must implement kafka.sasl.oauth.AbstractTokenProvider')
17+
raise KafkaConfigurationError('sasl_oauth_token_provider must implement kafka.net.sasl.oauth.AbstractTokenProvider')
1818
self.token_provider = config['sasl_oauth_token_provider']
1919
self._error = None
2020
self._is_done = False

0 commit comments

Comments
 (0)