Skip to main content

Shared time-series domain layer and Plotly renderer for air-Q MCP providers

Project description

airq-mcp-timeseries

PyPI Python License Tests Publish to PyPI pre-commit enabled

Shared time-series domain layer and Plotly renderer for air-Q MCP providers.

This project is not an MCP server. It is the shared package that consolidates time-series querying, normalization, resampling, summarization and plotting so that mcp-airq and mcp-airq-cloud can reuse the same business logic.

Features

  • shared query, series, summary and plotting data models
  • source-agnostic TimeSeriesProvider protocol
  • metric normalization and query validation
  • resampling and peak-preserving downsampling
  • renderer-independent plot model
  • Plotly rendering for HTML plus matplotlib-based PNG, SVG and WebP exports
  • CSV and Excel export for processed time-series data
  • async high-level orchestration with plot_history(), summarize_history() and export_history()

Installation

pip install airq-mcp-timeseries

This package now includes Pillow as a runtime dependency so WebP rendering works out of the box.

For development:

uv sync --frozen --extra dev
uv run pre-commit install

Usage

from datetime import datetime, timedelta

from airq_mcp_timeseries import HistoryQuery, PlotRequest, Selector, export_history, plot_history

request = PlotRequest(
    selector=Selector(devices=["Living Room"]),
    metric="co2",
    start=datetime.now().astimezone() - timedelta(hours=6),
    end=datetime.now().astimezone(),
)

result = await plot_history(provider, request)

# PlotRequest defaults to PNG for token-efficient binary artifact responses.

export = await export_history(
    provider,
    HistoryQuery(
        selector=request.selector,
        metric=request.metric,
        start=request.start,
        end=request.end,
    ),
    output_format="csv",
)

provider must implement the shared TimeSeriesProvider protocol.

Development

Run the full local validation stack:

uv run pre-commit run --all-files
uv run ruff check .
uv run ruff format --check .
uv run pyright
uv run pytest --exitfirst -n auto

Release Process

  1. Update version in pyproject.toml.
  2. Commit the change and create a matching Git tag such as v0.1.2.
  3. Publish a GitHub Release from that tag.

The publish workflow validates that the release tag matches pyproject.toml, builds the package and publishes it to PyPI.

License

Apache License 2.0. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

airq_mcp_timeseries-0.1.6.tar.gz (97.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

airq_mcp_timeseries-0.1.6-py3-none-any.whl (30.0 kB view details)

Uploaded Python 3

File details

Details for the file airq_mcp_timeseries-0.1.6.tar.gz.

File metadata

  • Download URL: airq_mcp_timeseries-0.1.6.tar.gz
  • Upload date:
  • Size: 97.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for airq_mcp_timeseries-0.1.6.tar.gz
Algorithm Hash digest
SHA256 44bd6d2fb8c56dac464dcd98fbb1c35ca685b6eff27dbf4c81fc8bdb67455e59
MD5 fc481999bbc908fc38b117a22f90ff03
BLAKE2b-256 fd8ea314a68055833df78acdbdc01d1d603a66656598953a4f6105b6f9ef1dd4

See more details on using hashes here.

Provenance

The following attestation bundles were made for airq_mcp_timeseries-0.1.6.tar.gz:

Publisher: publish.yml on CorantGmbH/airq-mcp-timeseries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file airq_mcp_timeseries-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for airq_mcp_timeseries-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 7f9e7398d40f53bf27064e161cae08845b008aa26556e3edbde9ec2fa3ea073c
MD5 78632e364dddc7c74461b0aad49c2111
BLAKE2b-256 e8e009f556ce5b7652efebf6ca21740c5c3431ad6b7d0d482ef24c3d395ad938

See more details on using hashes here.

Provenance

The following attestation bundles were made for airq_mcp_timeseries-0.1.6-py3-none-any.whl:

Publisher: publish.yml on CorantGmbH/airq-mcp-timeseries

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page