Python adapter for Kafka
Project description
NAAS-PYTHON-KAFKA
This is the Kafka adapter for Python: it allows you to easily connect Python services to Apache Kafka via Python.
The implementation is a wrapper around Confluent-Kafka-Python:
- AVRO schema's and messages: both key's and values should have a schema. as explained here.
- Kafka consumer and producer for the test-bed topics.
- Management
- Heartbeat (topic: system-heartbeat), so you know which clients are online. Each time the test-bed-adapter is executed, it starts a heartbeat process to notify the its activity to other clients.
Installation
You need to install Python 3+.
To run the examples you will need to install the dependencies specified on the file requirements.txt.
For that, run
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt # Or instead of `pip`, use `pip3`
from the project folder.
Examples and usage
url_producer: Creates a message with 4 URLs to RSS feeds on the topic ('system_rss_urls')rss_producer: Listens to url messages ('system_rss_urls') and produces RSS messages ('system_rss_urls')rss_consumer: Listens to RSS messages ('system_rss_urls') and prints them to console.
Uploading to PyPi
-
Ensure you have the necessary tools installed: Make sure you have
setuptoolsandwheelinstalled. You can install them usingpip:# Build the distribution files: In the root directory of your project, run the following command to build the distribution files (wheel and source distribution): pip install setuptools wheel
-
Build the distribution files: In the root directory of your project, run the following command to build the distribution files (wheel and source distribution):
# This command will generate the distribution files inside the dist directory. python setup.py sdist bdist_wheel
This command will generate the distribution files inside the dist directory.
-
Register an account on PyPI: If you haven't done so already, create an account on PyPI and verify your email address.
-
Install and configure
twine: Installtwine, a tool used to upload packages to PyPI, usingpip:# Upload the package to PyPI: Use twine to upload the distribution files to PyPI: pip install twine
-
Upload the package to PyPI: Use twine to upload the distribution files to PyPI:
# This command will prompt you to enter your PyPI username and password. Once provided, twine will upload the distribution files to PyPI. # Use $HOME/.pypirc if you want to use a different configuration file. twine upload --repository osint-python-test-bed-adapter dist/*
This command will prompt you to enter your PyPI username and password. Once provided, twine will upload the distribution files to PyPI.
-
Verify the package on PyPI: Visit your package page on PyPI to ensure that the package has been successfully uploaded and published.
Remember to update the version number in your
setup.pyfile for each new release to avoid conflicts.
In short:
# Install dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
# Create a new release after updating the setup.py package version number
rm -rf dist
python setup.py sdist bdist_wheel
twine upload --repository osint-python-test-bed-adapter dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file osint_python_test_bed_adapter-2.6.3.tar.gz.
File metadata
- Download URL: osint_python_test_bed_adapter-2.6.3.tar.gz
- Upload date:
- Size: 14.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbf4873bf360814ef71da49010c082a6a6fef7ce939903f9bd150d37dd590041
|
|
| MD5 |
f4f4d898c779f877ffdebe10a10878e9
|
|
| BLAKE2b-256 |
8bc39958e9b00e25da1c611b811503138dc97ffdd020c2c7edefbbd785e2b418
|
File details
Details for the file osint_python_test_bed_adapter-2.6.3-py3-none-any.whl.
File metadata
- Download URL: osint_python_test_bed_adapter-2.6.3-py3-none-any.whl
- Upload date:
- Size: 17.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
414ac1edb5acbc47a06c84e308e0e5223fff88cba2bd806d4987f96af8619834
|
|
| MD5 |
d1ef55e8d0222d209ba5a7be6210ad7e
|
|
| BLAKE2b-256 |
1de11b4b57b60948ae2fe279bf4b526921362d5b2ca5e7d067685fa47e6816b1
|