A simple Python processor to log an incoming stream to the console.
Project description
log-processor-py
Usage
To use the Python TemplateProcessor in your RDF-Connect pipeline, you need to have a pipeline configuration that includes the rdfc:PyRunner (check out their documentation to find out how to install and configure it).
You can install the Python runner package using the following command:
uv add rdfc_log-processor
Next, you can add the Python TemplateProcessor to your pipeline configuration as follows:
@prefix rdfc: <https://w3id.org/rdf-connect#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
# Import the processor
<> owl:imports <./.venv/lib/python3.13/site-packages/rdfc_template_processor/processor.ttl>.
### Define the channels your processor needs
<channel> a rdfc:Writer, rdfc:Reader.
# Attach the processor to the pipeline under the PyRunner
# Add the `rdfc:processor <template>` statement under the `rdfc:consistsOf` statement of the `rdfc:PyRunner`
### Define and configure the processors
<send> a rdfc:SendProcessorPy;
rdfc:writer <channel>;
rdfc:msg "Hello, World!", "Good afternoon, World!",
"Good evening, World!", "Good night, World!".
<log> a rdfc:LogProcessorPy;
rdfc:reader <channel>;
rdfc:level "info";
rdfc:label "test".
Configuration
Parameters of rdfc:SendProcessorPy:
rdfc:writer: The channel to which the processor will write messages.rdfc:msg: The messages to be sent by the processor.
Parameters of rdfc:LogProcessorPy:
rdfc:reader: The channel from which the processor will read messages.rdfc:writer: The channel to which the processor will write log messages (optional).rdfc:level: The log level to use (e.g., "debug", "info", "warning", "error", "critical"). Defaults to "info".rdfc:label: A label for the log messages, which can be used to filter or categorize logs. Defaults to "log".rdfc:raw: If set totrue, the processor will log raw messages to stdout without any formatting instead of to the RDF-Connect logging system. Defaults tofalse.
Development
The Packaging Python Projects guide was used to set up this project.
As build backend, the default Hatchling is used, for which the pyproject.toml file is configured.
That file tells build frontend tools like pip which backend to use.
This project uses uv as package manager.
First, make sure you have Hatch installed:
pip install hatch
# OR
brew install hatch
# OR another method of your choice
Then, create a virtual environment and spawn a shell. This will automatically install the project dependencies defined in pyproject.toml:
hatch env create
hatch shell
You can build the project with:
hatch build
Lastly, you can publish the package to PyPI with:
hatch publish
Project Structure
log-processor-py/ # Root directory of the project
├── src/ # Source code directory
│ └── rdfc_log_processor/ # Package directory
│ ├── __init__.py # Package initialization, allows importing as a regular package
│ ├── processor.py # Contains the main logic for the Python processor
│ └── processor.ttl # RDF schema for the processor, used for metadata and configuration
├── tests/ # Directory for unit tests
├── pyproject.toml # Project metadata and build configuration
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 rdfc_log_processor-0.0.1.tar.gz.
File metadata
- Download URL: rdfc_log_processor-0.0.1.tar.gz
- Upload date:
- Size: 15.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb1d6ebaca499228f27ff0acedbe76d9a5e3893ac2a8880bde78c43797baaf71
|
|
| MD5 |
899803504d6bc94e782785d9ed396673
|
|
| BLAKE2b-256 |
2c2de5457ed29cb891345d245d1ebf9474669e03333ae2aa567840c1cc5b12e9
|
File details
Details for the file rdfc_log_processor-0.0.1-py3-none-any.whl.
File metadata
- Download URL: rdfc_log_processor-0.0.1-py3-none-any.whl
- Upload date:
- Size: 4.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa2aea495101a29a0ae5467c1a2c3c133c4345ceaebc443c68d264aac7d70d36
|
|
| MD5 |
c09e7f40567b5ab6c0dcb36707c0a934
|
|
| BLAKE2b-256 |
a933af57776e13ba7cc36d8ab522b1492c46e267d33f8e6a853d77adc8dc268a
|