Skip to main content

CLI for the Hevy workout tracking API

Project description

hevy-cli

A typed, testable CLI for the Hevy workout tracking API.

CI codecov pre-commit.ci status PyPI Python Ruff License: MIT

Features

  • Full Hevy API coverage — workouts, routines, folders, exercises, history
  • Multiple output formats — table (rich), JSON, YAML (auto-selected by TTY)
  • Auto-pagination — fetch all results with --all
  • Flexible auth — env var, flag, or config file (XDG-compliant)
  • Typed end-to-end — pydantic v2 models, mypy --strict, pyright-friendly
  • Retry logic — exponential backoff on rate limits and server errors (tenacity)
  • Structured logging — structlog with JSON output in --debug
  • Tested — pytest + respx against the real API shapes

Installation

With uv (recommended)

uv tool install hevy-cli

With pip

pip install hevy-cli

From source

git clone https://github.com/marinsalinas/hevy-cli.git
cd hevy-cli
uv sync

Quick Start

1. Get your API key

Go to hevy.com/settings?developer (requires Hevy Pro).

2. Configure

# Option A: Environment variable
export HEVY_API_KEY="your-api-key"

# Option B: Config file
hevy config set auth.api_key "your-api-key"

# Option C: Per-command flag
hevy --api-key "your-api-key" workouts list

3. Use

# List recent workouts
hevy workouts list

# Get a specific workout
hevy workouts get abc123

# List all workouts (auto-paginate)
hevy workouts list --all

# Count total workouts
hevy workouts count

# JSON output for scripting
hevy workouts list --format json | jq '.[] | .title'

# Create a workout from file
hevy workouts create --file workout.json

# List exercise templates
hevy exercises list --page-size 50

# Get exercise history with date range
hevy exercises history D04AC939 --start 2024-01-01 --end 2024-12-31

# List routines
hevy routines list

# List routine folders
hevy folders list

# Create a routine folder
hevy folders create "Push Pull Legs"

# Show current config
hevy config show

Output Formats

# Rich table (default in terminal)
hevy workouts list

# JSON (default when piped)
hevy workouts list --format json

# YAML
hevy workouts list --format yaml

Configuration

Config is stored at ~/.config/hevy/config.toml (XDG compliant):

[auth]
api_key = "your-api-key"

[output]
format = "table"    # json | table | yaml
color = true

[api]
base_url = "https://api.hevy.com"
timeout = 30
max_retries = 3

Development

# Clone and setup
git clone https://github.com/marinsalinas/hevy-cli.git
cd hevy-cli
uv sync --dev

# Run tests
uv run pytest

# Run linter
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/

# Type checking
uv run mypy src/

# Run CLI in dev mode
uv run hevy --help

API Coverage

Resource list get create update count events history
Workouts
Routines
Folders
Exercises

Contributing

Contributions are welcome. See CONTRIBUTING.md for the dev setup, commit conventions, and pull-request flow. Start with issues labelled good first issue.

Architecture decisions and rationale are captured in ARCHITECTURE.md. Security issues should follow the private disclosure path in SECURITY.md — please do not file them as public issues.

Changelog

See CHANGELOG.md. This project follows Semantic Versioning; pre-1.0 minor releases may include breaking changes.

License

MIT — 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

hevy_cli-0.2.2.tar.gz (96.2 kB view details)

Uploaded Source

Built Distribution

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

hevy_cli-0.2.2-py3-none-any.whl (28.4 kB view details)

Uploaded Python 3

File details

Details for the file hevy_cli-0.2.2.tar.gz.

File metadata

  • Download URL: hevy_cli-0.2.2.tar.gz
  • Upload date:
  • Size: 96.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hevy_cli-0.2.2.tar.gz
Algorithm Hash digest
SHA256 1d871acc73a238722224696cd96ee8e1cde8f873e702e248e8d6a549bbc0b879
MD5 25b81e5797f82724919b1864d7154708
BLAKE2b-256 b0b593a6526430640823739b99e27b0dc1303c2ce6b3831b86fb8284aaf72ae6

See more details on using hashes here.

Provenance

The following attestation bundles were made for hevy_cli-0.2.2.tar.gz:

Publisher: release-please.yml on marinsalinas/hevy-cli

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

File details

Details for the file hevy_cli-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: hevy_cli-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 28.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for hevy_cli-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a0a7a57dbafabce0714d120be1cbcab1b8e699e2b45b637ec0ff62f8d400e7b
MD5 02519d9fccab3350a55f1ccdeee6dd32
BLAKE2b-256 7fb4d7a3e54766ad4a436fb47dfcd99393b494b6107583588349e934ee941c5e

See more details on using hashes here.

Provenance

The following attestation bundles were made for hevy_cli-0.2.2-py3-none-any.whl:

Publisher: release-please.yml on marinsalinas/hevy-cli

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