diff --git a/.github/workflows/generate_docs.yml b/.github/workflows/generate_docs.yml index 9eccb17..aed33f2 100644 --- a/.github/workflows/generate_docs.yml +++ b/.github/workflows/generate_docs.yml @@ -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 @@ -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 diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index ccd56d6..15001d2 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -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 diff --git a/README.md b/README.md index 4045dd6..2b9a565 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6795b80 --- /dev/null +++ b/pyproject.toml @@ -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"} \ No newline at end of file diff --git a/setup.py b/setup.py index 59378d1..beda28e 100644 --- a/setup.py +++ b/setup.py @@ -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 = '', - 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() diff --git a/src/ConfluentKafkaLibrary/__init__.py b/src/ConfluentKafkaLibrary/__init__.py index 29b2662..e2628d9 100644 --- a/src/ConfluentKafkaLibrary/__init__.py +++ b/src/ConfluentKafkaLibrary/__init__.py @@ -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 @@ -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): @@ -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) diff --git a/src/ConfluentKafkaLibrary/version.py b/src/ConfluentKafkaLibrary/version.py index 867bff5..e813113 100644 --- a/src/ConfluentKafkaLibrary/version.py +++ b/src/ConfluentKafkaLibrary/version.py @@ -1 +1 @@ -VERSION = '2.8.0-3' +VERSION = '2.9.0.post1'