Metadata-Version: 2.4
Name: metricq
Version: 6.0.0
Summary: A highly-scalable, distributed metric data processing framework based on RabbitMQ
Home-page: https://github.com/metricq/metricq-python
Author: TU Dresden
License: BSD 3-clause "New" or "Revised License"
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aio-pika~=10.0
Requires-Dist: protobuf<7.37,>=7.36
Requires-Dist: Deprecated~=1.3.1
Requires-Dist: python-dateutil>=2.8.1,~=2.8
Requires-Dist: yarl
Requires-Dist: setuptools
Provides-Extra: examples
Requires-Dist: aiomonitor-ng; extra == "examples"
Requires-Dist: click; extra == "examples"
Requires-Dist: click-log; extra == "examples"
Provides-Extra: lint
Requires-Dist: black[jupyter]~=26.10.0; extra == "lint"
Requires-Dist: flake8; extra == "lint"
Requires-Dist: isort~=9.0; extra == "lint"
Requires-Dist: check-manifest; extra == "lint"
Requires-Dist: pre-commit; extra == "lint"
Provides-Extra: test
Requires-Dist: click; extra == "test"
Requires-Dist: click-log; extra == "test"
Requires-Dist: python-dotenv~=1.2.0; extra == "test"
Requires-Dist: pytest; extra == "test"
Requires-Dist: pytest-asyncio; extra == "test"
Requires-Dist: pytest-mock; extra == "test"
Provides-Extra: typing
Requires-Dist: mypy>=1.2.0; extra == "typing"
Requires-Dist: mypy-protobuf; extra == "typing"
Requires-Dist: types-Deprecated; extra == "typing"
Requires-Dist: types-setuptools; extra == "typing"
Requires-Dist: types-protobuf; extra == "typing"
Requires-Dist: types-python-dateutil; extra == "typing"
Requires-Dist: pandas-stubs~=3.1.0; extra == "typing"
Requires-Dist: uvloop; extra == "typing"
Requires-Dist: pandas~=3.1.0; extra == "typing"
Requires-Dist: aiomonitor-ng; extra == "typing"
Requires-Dist: click; extra == "typing"
Requires-Dist: click-log; extra == "typing"
Requires-Dist: click; extra == "typing"
Requires-Dist: click-log; extra == "typing"
Requires-Dist: python-dotenv~=1.2.0; extra == "typing"
Requires-Dist: pytest; extra == "typing"
Requires-Dist: pytest-asyncio; extra == "typing"
Requires-Dist: pytest-mock; extra == "typing"
Requires-Dist: click; extra == "typing"
Requires-Dist: click-log; extra == "typing"
Requires-Dist: python-dotenv~=1.2.0; extra == "typing"
Provides-Extra: docs
Requires-Dist: pandas~=3.1.0; extra == "docs"
Requires-Dist: sphinx~=9.2.0; extra == "docs"
Requires-Dist: sphinx_rtd_theme~=3.1.0; extra == "docs"
Requires-Dist: sphinx_autodoc_typehints~=3.17.0; extra == "docs"
Requires-Dist: sphinxcontrib-trio~=1.2.0; extra == "docs"
Requires-Dist: scanpydoc~=0.17.0; extra == "docs"
Provides-Extra: dev
Requires-Dist: click; extra == "dev"
Requires-Dist: click-log; extra == "dev"
Requires-Dist: python-dotenv~=1.2.0; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-mock; extra == "dev"
Requires-Dist: black[jupyter]~=26.10.0; extra == "dev"
Requires-Dist: flake8; extra == "dev"
Requires-Dist: isort~=9.0; extra == "dev"
Requires-Dist: check-manifest; extra == "dev"
Requires-Dist: pre-commit; extra == "dev"
Requires-Dist: aiomonitor-ng; extra == "dev"
Requires-Dist: click; extra == "dev"
Requires-Dist: click-log; extra == "dev"
Requires-Dist: mypy>=1.2.0; extra == "dev"
Requires-Dist: mypy-protobuf; extra == "dev"
Requires-Dist: types-Deprecated; extra == "dev"
Requires-Dist: types-setuptools; extra == "dev"
Requires-Dist: types-protobuf; extra == "dev"
Requires-Dist: types-python-dateutil; extra == "dev"
Requires-Dist: pandas-stubs~=3.1.0; extra == "dev"
Requires-Dist: uvloop; extra == "dev"
Requires-Dist: pandas~=3.1.0; extra == "dev"
Requires-Dist: aiomonitor-ng; extra == "dev"
Requires-Dist: click; extra == "dev"
Requires-Dist: click-log; extra == "dev"
Requires-Dist: click; extra == "dev"
Requires-Dist: click-log; extra == "dev"
Requires-Dist: python-dotenv~=1.2.0; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-mock; extra == "dev"
Requires-Dist: click; extra == "dev"
Requires-Dist: click-log; extra == "dev"
Requires-Dist: python-dotenv~=1.2.0; extra == "dev"
Requires-Dist: pandas~=3.1.0; extra == "dev"
Requires-Dist: sphinx~=9.2.0; extra == "dev"
Requires-Dist: sphinx_rtd_theme~=3.1.0; extra == "dev"
Requires-Dist: sphinx_autodoc_typehints~=3.17.0; extra == "dev"
Requires-Dist: sphinxcontrib-trio~=1.2.0; extra == "dev"
Requires-Dist: scanpydoc~=0.17.0; extra == "dev"
Requires-Dist: click; extra == "dev"
Requires-Dist: click-log; extra == "dev"
Requires-Dist: python-dotenv~=1.2.0; extra == "dev"
Requires-Dist: tox; extra == "dev"
Provides-Extra: pandas
Requires-Dist: pandas~=3.1.0; extra == "pandas"
Provides-Extra: cli
Requires-Dist: click; extra == "cli"
Requires-Dist: click-log; extra == "cli"
Requires-Dist: python-dotenv~=1.2.0; extra == "cli"
Dynamic: license-file
Dynamic: requires-dist

![BSD 3-clause](https://img.shields.io/badge/license-BSD%203--clause-blue.svg)
![Python package](https://github.com/metricq/metricq-python/workflows/Python%20package/badge.svg)
![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)
[![PyPI](https://img.shields.io/pypi/v/metricq)](https://pypi.org/project/metricq/)
![PyPI - Wheel](https://img.shields.io/pypi/wheel/metricq)
[![Documentation](https://img.shields.io/badge/docs-here-informational.svg)](https://metricq.github.io/metricq-python/)

# metricq - python libraries

This is a python implementation of the MetricQ protocol.
It allows you to write Sources and Sinks to easily send and receive data over
the MetricQ infrastructure.

## Installation

Install the package from PyPI:

```sh
$ pip install metricq
```

## Examples

The [`examples`](/tree/master/examples/) directory contains some basic
examples.
To play around with them, check out a copy of this repository and (in your
favourite venv) install their dependencies:

```sh
$ pip install -e '.[examples]'
```

A simple Source is implemented in `metricq_source.py`, as is a Sink in `metricq_sink.py`.
We will use the former to produce data for a metric called `test.py.dummy`, which we
will then receive and print with the latter.

Assuming a MetricQ instance is reachable at `localhost`, configure a
client<sup>(consult the documentation of your favourite config provider on how
to do that)</sup> named `source-py-dummy` to produce values with a frequency of
0.5Hz (i.e. every 2 seconds) :

```json
{
    "rate": 0.5
}
```

To start the Source, run:

```sh
$ ./examples/metricq_source.py --server 'amqp://localhost/' --token 'source-py-dummy'
```

This should now send values for the metric `test.py.dummy` in 2-second intervals.
To see (in detail) what's going on, add `-v DEBUG` to the arguments above.

On the other side, run

```sh
$ ./examples/metricq_sink.py --server 'amqp://localhost/' --metrics 'test.py.dummy'
```

and you should see new values for the metric `test.py.dummy` appear every 2 seconds.

## Tools and utility scripts

The repository [metricq/metricq-tools](https://github.com/metricq/metricq-tools)
contains a collection of tools and utility scripts to monitor and administrate
a MetricQ network.
Install them from [PyPI](https://pypi.org/project/metricq-tools/):

```
$ pip install metricq-tools
```

## Development setup

Clone the repository, and in a virtual environment run

```sh
$ pip install -e '.[dev]'
```

This will install all tools necessary for testing and linting.
To test code manually, run `pytest`.
Format code using `black` and `isort`, or lint with `flake8`.
To make sure a source distribution (`sdist`) contains the correct files, run `check-manifest`.
Tools are configured in `setup.cfg` respectively `pyproject.toml`.

To test code in a fresh environment, run the `tox` test harness:

```sh
$ tox
```

This runs the same step as our CI does.
If `tox` passes locally there's high chances that CI steps will pass too.

We recommend to install our [pre-commit](https://pre-commit.com) hooks:

```sh
$ pre-commit install
```

This way commits that fail tests or do not comply with our code style are rejected right away.
