Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/generate_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
# This latest python way can't find the librdkafka.h files
# - name: Set up Python
# uses: actions/setup-python@v4
Expand All @@ -22,7 +22,7 @@ jobs:
run: pip install .[all]
- name: Generate keyword documentation
run: python3 -m robot.libdoc -f html src/ConfluentKafkaLibrary docs/index.html
- uses: stefanzweifel/git-auto-commit-action@v5
- uses: stefanzweifel/git-auto-commit-action@v6
with:
file_pattern: docs/index.html
commit_message: Add keyword documentation
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5
- name: Set up Python
uses: actions/setup-python@v5
uses: actions/setup-python@v6
with:
python-version: '3.x'
- name: Install pypa/build
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

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

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`.
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`.

## Documentation

Expand Down
61 changes: 61 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "robotframework-confluentkafkalibrary"
dynamic = ["version"]
description = "Confluent Kafka library for Robot Framework"
readme = "README.md"
authors = [
{name = "Robert Karasek", email = "robo.karasek@gmail.com"},
]
license = "Apache-2.0"
license-files = ["LICEN[CS]E*"]
keywords = ["robotframework", "confluent", "kafka"]
classifiers = [
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Testing",
]
requires-python = ">=3.8"
dependencies = [
"robotframework >= 3.2.1",
"confluent-kafka == 2.9.0",
"requests >= 2.25.1",
]

[project.urls]
"Homepage" = "https://github.com/robooo/robotframework-ConfluentKafkaLibrary"

[project.optional-dependencies]
avro = [
"fastavro >= 1.3.2",
"avro >= 1.11.1",
]
json = [
"jsonschema >= 3.2.0",
"pyrsistent >= 0.20.0",
]
protobuf = [
"protobuf >= 4.22.0",
"googleapis-common-protos >= 1.66.0",
]
schemaregistry = [
"httpx>=0.26",
"cachetools >= 5.5.0",
"attrs >= 24.3.0",
"authlib >= 1.0.0",
]
all = [
"robotframework-confluentkafkalibrary[avro]",
"robotframework-confluentkafkalibrary[json]",
"robotframework-confluentkafkalibrary[protobuf]",
"robotframework-confluentkafkalibrary[schemaregistry]",
]

[tool.setuptools.packages.find]
where = ["src"]

[tool.setuptools.dynamic]
version = {attr = "ConfluentKafkaLibrary.version.VERSION"}
45 changes: 1 addition & 44 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,5 @@
#!/usr/bin/env python

from os.path import join, dirname
from setuptools import setup

filename=join(dirname(__file__), 'src', 'ConfluentKafkaLibrary', 'version.py')
exec(compile(open(filename).read(),filename, 'exec'))

DESCRIPTION = """
Confluent Kafka wrapped in Robot Framework.
"""[1:-1]

AVRO_REQUIRES = ['fastavro >= 1.3.2', 'avro >= 1.11.1']
JSON_REQUIRES = ['jsonschema >= 3.2.0', 'pyrsistent >= 0.20.0']
PROTO_REQUIRES = ['protobuf >= 4.22.0', 'googleapis-common-protos >= 1.66.0']
SCHEMA_REGISTRY_REQUIRES = ['httpx>=0.26', 'cachetools >= 5.5.0', 'attrs >= 24.3.0']
ALL = AVRO_REQUIRES + JSON_REQUIRES + PROTO_REQUIRES + SCHEMA_REGISTRY_REQUIRES
setup(name = 'robotframework-confluentkafkalibrary',
version = VERSION,
description = 'Confluent Kafka library for Robot Framework',
long_description = DESCRIPTION,
author = 'Robert Karasek',
author_email = '<robo.karasek@gmail.com>',
url = 'https://github.com/robooo/robotframework-ConfluentKafkaLibrary',
license = 'Apache License 2.0',
keywords = 'robotframework confluent kafka',
platforms = 'any',
classifiers = [
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Topic :: Software Development :: Testing"
],
install_requires = [
'robotframework >= 3.2.1',
'confluent-kafka == 2.8.0',
'requests >= 2.25.1',
],
extras_require={
'all': ALL,
'avro': AVRO_REQUIRES,
'json': JSON_REQUIRES,
'protobuf': PROTO_REQUIRES,
'schemaregistry': SCHEMA_REGISTRY_REQUIRES,
},
package_dir = {'' : 'src'},
packages = ['ConfluentKafkaLibrary'],
)
setup()
16 changes: 12 additions & 4 deletions src/ConfluentKafkaLibrary/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
try:
from confluent_kafka.schema_registry import SchemaRegistryClient
_SCHEMA_REGISTRY_CLIENT_AVAILABLE = True
except ImportError:
_SCHEMA_REGISTRY_IMPORT_ERROR = None
except ImportError as e:
_SCHEMA_REGISTRY_IMPORT_ERROR = e
_SCHEMA_REGISTRY_CLIENT_AVAILABLE = False
raise ImportError("SchemaRegistry requires additional dependencies to be installed. \
Please install with 'pip install robotframework-confluentkafkalibrary[schemaregistry]'")

from confluent_kafka.admin import AdminClient, NewTopic, NewPartitions, ConfigResource
from robot.libraries.BuiltIn import BuiltIn, RobotNotRunningError
Expand All @@ -21,7 +21,8 @@
try:
from .serialization import Serializer, Deserializer
IMPORTS += Serializer, Deserializer
except ImportError:
except ImportError as e:
print(e)
pass

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

def get_schema_registry_client(self, conf):
if not _SCHEMA_REGISTRY_CLIENT_AVAILABLE:
raise ImportError(
"SchemaRegistry requires additional dependencies to be installed or one of its transitive dependencies is missing. "
"Please install with 'pip install robotframework-confluentkafkalibrary[schemaregistry]'.\n"
"If the error persists, check for missing dependencies in your environment.\n"
f"ImportError: {_SCHEMA_REGISTRY_IMPORT_ERROR}"
)
return SchemaRegistryClient(conf)
2 changes: 1 addition & 1 deletion src/ConfluentKafkaLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = '2.8.0-3'
VERSION = '2.9.0.post1'