Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
144 changes: 144 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
# ============================================
# CLAWMETER - Publish to PyPI
# ============================================
# Triggered on version tags (v*) or manual dispatch
# Builds and publishes to PyPI via trusted publishing
# ============================================

name: Publish

on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
target:
description: 'Publish target'
required: true
default: 'testpypi'
type: choice
options:
- testpypi
- pypi

env:
PYTHON_VERSION: "3.12"

jobs:
# ============================================
# BUILD
# ============================================
build:
name: Build Distribution
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for version detection

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Build package
run: python -m build

- name: Check package
run: twine check dist/*

- name: List artifacts
run: ls -la dist/

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist
path: dist/
retention-days: 30

# ============================================
# PUBLISH TO TEST PYPI
# ============================================
publish-testpypi:
name: Publish to TestPyPI
runs-on: ubuntu-latest
needs: build
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'testpypi')
environment:
name: testpypi
url: https://test.pypi.org/project/clawmeter/
permissions:
id-token: write # For trusted publishing

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

# ============================================
# PUBLISH TO PYPI
# ============================================
publish-pypi:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: build
if: |
(github.event_name == 'workflow_dispatch' && github.event.inputs.target == 'pypi') ||
(github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v'))
environment:
name: pypi
url: https://pypi.org/project/clawmeter/
permissions:
id-token: write # For trusted publishing

steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: dist
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

# ============================================
# POST-PUBLISH VERIFICATION
# ============================================
verify:
name: Verify Installation
runs-on: ubuntu-latest
needs: [publish-pypi]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
steps:
- name: Wait for PyPI propagation
run: sleep 60

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Install from PyPI
run: |
pip install clawmeter
clawmeter --version
clawmeter --help

- name: Verify import
run: python -c "import clawmeter; print(f'clawmeter {clawmeter.__version__}')"
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
# clawmeter
<p align="center">
<img src="assets/clawmeter.png" alt="clawmeter" width="200">
</p>

Monitor your LLM consumption from local and online services.
<h1 align="center">clawmeter</h1>

<p align="center">
<em>Monitor your LLM consumption from local and online services.</em>
</p>

<p align="center">
<a href="https://pypi.org/project/clawmeter/"><img src="https://img.shields.io/pypi/v/clawmeter.svg" alt="PyPI"></a>
<a href="https://pypi.org/project/clawmeter/"><img src="https://img.shields.io/pypi/pyversions/clawmeter.svg" alt="Python"></a>
<a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
</p>

Currently supports **Anthropic Claude** (subscription utilisation tracking), **xAI Grok** (spend monitoring, spending limits, prepaid balance), **OpenAI** (API spend and per-model usage via Admin API), and **Ollama** (local instance monitoring — loaded models, VRAM/RAM usage, multi-host support; cloud usage tracking as an alpha feature). Future versions will add local system metrics.

Expand Down
Binary file added assets/clawmeter.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docs/SPEC.md
Original file line number Diff line number Diff line change
Expand Up @@ -2498,7 +2498,10 @@ Tracked as [#24](https://github.com/danielithomas/clawmeter/issues/24).

Tracked as [#25](https://github.com/danielithomas/clawmeter/issues/25).

- [ ] Publish `clawmeter` package to PyPI
- [x] Add logo and PyPI/Python/licence badges to README.md
- [x] Create `.github/workflows/publish.yml` — tag-triggered build and publish via trusted publishing
- [ ] Configure PyPI trusted publisher (GitHub environment `pypi` + PyPI pending publisher)
- [ ] Tag `v0.7.4` to trigger first PyPI release
- [ ] Verify `uv tool install clawmeter` and `pip install clawmeter` work from PyPI

### v0.8.0 - Local System Metrics Provider
Expand Down
Loading