Skip to content

Commit 574d568

Browse files
committed
work
1 parent fed1b80 commit 574d568

9 files changed

Lines changed: 761 additions & 101 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
test:
11+
name: build and test
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
python-version: ["3.11", "3.12", "3.13", "3.14"]
16+
os: [ubuntu-latest, macos-latest, windows-latest]
17+
runs-on: ${{ matrix.os }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
name: checkout
21+
22+
- uses: dtolnay/rust-toolchain@stable
23+
name: get rust
24+
25+
- uses: astral-sh/setup-uv@v7
26+
name: get uv
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
30+
- name: test
31+
run: uv run --frozen pytest

Cargo.lock

Lines changed: 56 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
[package]
22
name = "pyotheus"
3-
version = "0.1.0-dev"
3+
version = "0.0.1"
44
edition = "2024"
55

66
[lib]
77
name = "pyotheus"
88
crate-type = ["cdylib"]
99

1010
[dependencies]
11+
indexmap = "2.12.0"
1112
prometheus-client = "0.24.0"
12-
pyo3 = { version = "0.26.0", features = ["abi3-py311"] }
13+
pyo3 = { version = "0.27.0", features = ["abi3-py311", "indexmap"] }
1314
tracing = "0.1.41"
1415
tracing-subscriber = { version = "0.3.20", features = ["env-filter", "std", "valuable"] }

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
# pyotheus
22

3-
Rust Prometheus client library for Python.
3+
[![ci](https://github.com/douglasdavis/pyotheus/actions/workflows/ci.yml/badge.svg)](https://github.com/douglasdavis/pyotheus/actions/workflows/ci.yml)
4+
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/pyotheus)
5+
6+
Prometheus client library for Python, built with
7+
[PyO3](https://pyo3.rs) and the [`prometheus_client`](https://docs.rs/prometheus-client/latest/prometheus_client/) crate.

pyotheus.pyi

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
class Registry:
2+
def __init__(self) -> None: ...
3+
def __repr__(self) -> str: ...
4+
def __str__(self) -> str: ...
5+
def encode(self) -> bytes: ...
6+
7+
class Histogram:
8+
def __init__(
9+
self,
10+
name: str,
11+
documentation: str,
12+
buckets: list[float],
13+
registry: Registry | None = None,
14+
) -> None: ...
15+
def observe(
16+
self,
17+
labels: dict[str, str] | list[tuple[str, str]],
18+
value: float,
19+
) -> None: ...
20+
21+
class Counter:
22+
def __init__(
23+
self,
24+
name: str,
25+
documentation: str,
26+
registry: Registry | None = None,
27+
) -> None: ...
28+
def inc(
29+
self,
30+
lables: dict[str, str] | list[tuple[str, str]],
31+
) -> int: ...
32+
33+
class Gauge:
34+
def __init__(
35+
self,
36+
name: str,
37+
documentation: str,
38+
registry: Registry | None = None,
39+
) -> None: ...
40+
def set(
41+
self,
42+
lables: dict[str, str] | list[tuple[str, str]],
43+
value: int,
44+
) -> int: ...
45+
46+
def init_tracing(level: str) -> None: ...
47+
def encode_global_registry() -> bytes: ...

pyproject.toml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,33 @@ build-backend = "maturin"
44

55
[project]
66
name = "pyotheus"
7-
version = "0.1.0.dev0"
7+
version = "0.1.0.dev1"
88
requires-python = ">=3.11"
99
readme = "README.md"
1010
license = "MIT"
1111
license-files = ["LICENSE"]
1212
authors = [{ name = "Doug Davis", email = "ddavis@ddavis.io" }]
1313
maintainers = [{ name = "Doug Davis", email = "ddavis@ddavis.io" }]
1414
classifiers = [
15+
"License :: OSI Approved :: MIT License",
1516
"Programming Language :: Python :: Implementation :: CPython",
17+
"Programming Language :: Python :: 3.11",
18+
"Programming Language :: Python :: 3.12",
19+
"Programming Language :: Python :: 3.13",
20+
"Programming Language :: Python :: 3.14",
1621
"Programming Language :: Rust",
22+
"Topic :: System :: Monitoring",
1723
]
1824

19-
2025
[tool.maturin]
2126
features = ["pyo3/extension-module"]
2227

2328
[dependency-groups]
2429
dev = [
30+
"ipython>=9.6.0",
2531
"maturin>=1.9.6",
32+
"prometheus-client>=0.23.1",
2633
"pytest>=8.4.2",
34+
"ruff>=0.14.1",
35+
"ty>=0.0.1a23",
2736
]

0 commit comments

Comments
 (0)