Skip to content

Commit 8b366be

Browse files
authored
Update confluent-kafka to 2.9.0 (#61)
* Update confluent-kafka to 2.9.0 * Fix stricter python 3.12 imports * Make Python package build PEP compliant
1 parent 8667cf2 commit 8b366be

File tree

7 files changed

+80
-54
lines changed

7 files changed

+80
-54
lines changed

.github/workflows/generate_docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
deploy:
1313
runs-on: ubuntu-latest
1414
steps:
15-
- uses: actions/checkout@v4
15+
- uses: actions/checkout@v5
1616
# This latest python way can't find the librdkafka.h files
1717
# - name: Set up Python
1818
# uses: actions/setup-python@v4
@@ -22,7 +22,7 @@ jobs:
2222
run: pip install .[all]
2323
- name: Generate keyword documentation
2424
run: python3 -m robot.libdoc -f html src/ConfluentKafkaLibrary docs/index.html
25-
- uses: stefanzweifel/git-auto-commit-action@v5
25+
- uses: stefanzweifel/git-auto-commit-action@v6
2626
with:
2727
file_pattern: docs/index.html
2828
commit_message: Add keyword documentation

.github/workflows/python-publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v4
16+
- uses: actions/checkout@v5
1717
- name: Set up Python
18-
uses: actions/setup-python@v5
18+
uses: actions/setup-python@v6
1919
with:
2020
python-version: '3.x'
2121
- name: Install pypa/build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
ConfluentKafkaLibrary library is a wrapper for the [confluent-kafka-python](https://github.com/confluentinc/confluent-kafka-python).
44

5-
ConfluentKafkaLibrary is compatible with the latest version of confluent-kafka-python, where the library versions have a 1:1 correspondence (e.g., ConfluentKafkaLibrary 1.3.0 corresponds to confluent-kafka-python 1.3.0). Bug fixes and updates are denoted by a trailing hyphen, such as `1.3.0-1`.
5+
ConfluentKafkaLibrary is compatible with the latest version of confluent-kafka-python, where the library versions have a 1:1 correspondence (e.g., ConfluentKafkaLibrary 2.9.0 corresponds to confluent-kafka-python 2.9.0). Bug fixes and updates are denoted by a post-release identifier, such as `2.9.0.post1`.
66

77
## Documentation
88

pyproject.toml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
[build-system]
2+
requires = ["setuptools>=61.0"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "robotframework-confluentkafkalibrary"
7+
dynamic = ["version"]
8+
description = "Confluent Kafka library for Robot Framework"
9+
readme = "README.md"
10+
authors = [
11+
{name = "Robert Karasek", email = "robo.karasek@gmail.com"},
12+
]
13+
license = "Apache-2.0"
14+
license-files = ["LICEN[CS]E*"]
15+
keywords = ["robotframework", "confluent", "kafka"]
16+
classifiers = [
17+
"Operating System :: OS Independent",
18+
"Programming Language :: Python",
19+
"Topic :: Software Development :: Testing",
20+
]
21+
requires-python = ">=3.8"
22+
dependencies = [
23+
"robotframework >= 3.2.1",
24+
"confluent-kafka == 2.9.0",
25+
"requests >= 2.25.1",
26+
]
27+
28+
[project.urls]
29+
"Homepage" = "https://github.com/robooo/robotframework-ConfluentKafkaLibrary"
30+
31+
[project.optional-dependencies]
32+
avro = [
33+
"fastavro >= 1.3.2",
34+
"avro >= 1.11.1",
35+
]
36+
json = [
37+
"jsonschema >= 3.2.0",
38+
"pyrsistent >= 0.20.0",
39+
]
40+
protobuf = [
41+
"protobuf >= 4.22.0",
42+
"googleapis-common-protos >= 1.66.0",
43+
]
44+
schemaregistry = [
45+
"httpx>=0.26",
46+
"cachetools >= 5.5.0",
47+
"attrs >= 24.3.0",
48+
"authlib >= 1.0.0",
49+
]
50+
all = [
51+
"robotframework-confluentkafkalibrary[avro]",
52+
"robotframework-confluentkafkalibrary[json]",
53+
"robotframework-confluentkafkalibrary[protobuf]",
54+
"robotframework-confluentkafkalibrary[schemaregistry]",
55+
]
56+
57+
[tool.setuptools.packages.find]
58+
where = ["src"]
59+
60+
[tool.setuptools.dynamic]
61+
version = {attr = "ConfluentKafkaLibrary.version.VERSION"}

setup.py

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,5 @@
11
#!/usr/bin/env python
22

3-
from os.path import join, dirname
43
from setuptools import setup
54

6-
filename=join(dirname(__file__), 'src', 'ConfluentKafkaLibrary', 'version.py')
7-
exec(compile(open(filename).read(),filename, 'exec'))
8-
9-
DESCRIPTION = """
10-
Confluent Kafka wrapped in Robot Framework.
11-
"""[1:-1]
12-
13-
AVRO_REQUIRES = ['fastavro >= 1.3.2', 'avro >= 1.11.1']
14-
JSON_REQUIRES = ['jsonschema >= 3.2.0', 'pyrsistent >= 0.20.0']
15-
PROTO_REQUIRES = ['protobuf >= 4.22.0', 'googleapis-common-protos >= 1.66.0']
16-
SCHEMA_REGISTRY_REQUIRES = ['httpx>=0.26', 'cachetools >= 5.5.0', 'attrs >= 24.3.0']
17-
ALL = AVRO_REQUIRES + JSON_REQUIRES + PROTO_REQUIRES + SCHEMA_REGISTRY_REQUIRES
18-
setup(name = 'robotframework-confluentkafkalibrary',
19-
version = VERSION,
20-
description = 'Confluent Kafka library for Robot Framework',
21-
long_description = DESCRIPTION,
22-
author = 'Robert Karasek',
23-
author_email = '<robo.karasek@gmail.com>',
24-
url = 'https://github.com/robooo/robotframework-ConfluentKafkaLibrary',
25-
license = 'Apache License 2.0',
26-
keywords = 'robotframework confluent kafka',
27-
platforms = 'any',
28-
classifiers = [
29-
"License :: OSI Approved :: Apache Software License",
30-
"Operating System :: OS Independent",
31-
"Programming Language :: Python",
32-
"Topic :: Software Development :: Testing"
33-
],
34-
install_requires = [
35-
'robotframework >= 3.2.1',
36-
'confluent-kafka == 2.8.0',
37-
'requests >= 2.25.1',
38-
],
39-
extras_require={
40-
'all': ALL,
41-
'avro': AVRO_REQUIRES,
42-
'json': JSON_REQUIRES,
43-
'protobuf': PROTO_REQUIRES,
44-
'schemaregistry': SCHEMA_REGISTRY_REQUIRES,
45-
},
46-
package_dir = {'' : 'src'},
47-
packages = ['ConfluentKafkaLibrary'],
48-
)
5+
setup()

src/ConfluentKafkaLibrary/__init__.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
try:
55
from confluent_kafka.schema_registry import SchemaRegistryClient
66
_SCHEMA_REGISTRY_CLIENT_AVAILABLE = True
7-
except ImportError:
7+
_SCHEMA_REGISTRY_IMPORT_ERROR = None
8+
except ImportError as e:
9+
_SCHEMA_REGISTRY_IMPORT_ERROR = e
810
_SCHEMA_REGISTRY_CLIENT_AVAILABLE = False
9-
raise ImportError("SchemaRegistry requires additional dependencies to be installed. \
10-
Please install with 'pip install robotframework-confluentkafkalibrary[schemaregistry]'")
1111

1212
from confluent_kafka.admin import AdminClient, NewTopic, NewPartitions, ConfigResource
1313
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
@@ -21,7 +21,8 @@
2121
try:
2222
from .serialization import Serializer, Deserializer
2323
IMPORTS += Serializer, Deserializer
24-
except ImportError:
24+
except ImportError as e:
25+
print(e)
2526
pass
2627

2728
#class ConfluentKafkaLibrary(KafkaConsumer, KafkaProducer, Serializer, Deserializer):
@@ -140,4 +141,11 @@ def config_resource(self, restype, name, **kwargs):
140141
return ConfigResource(restype=restype, name=name, **kwargs)
141142

142143
def get_schema_registry_client(self, conf):
144+
if not _SCHEMA_REGISTRY_CLIENT_AVAILABLE:
145+
raise ImportError(
146+
"SchemaRegistry requires additional dependencies to be installed or one of its transitive dependencies is missing. "
147+
"Please install with 'pip install robotframework-confluentkafkalibrary[schemaregistry]'.\n"
148+
"If the error persists, check for missing dependencies in your environment.\n"
149+
f"ImportError: {_SCHEMA_REGISTRY_IMPORT_ERROR}"
150+
)
143151
return SchemaRegistryClient(conf)
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
VERSION = '2.8.0-3'
1+
VERSION = '2.9.0.post1'

0 commit comments

Comments
 (0)