Simple CLI to catch sleep, view stats, and export data
Project description
zcatcher (sleep tracker)
A simple Python CLI to record sleep entries and view stats.
Installation
No external dependencies required. Ensure you have Python 3.8+.
Install from source (editable for development):
python -m pip install -e .
This installs the zcatcher console command.
Install with pipx (isolated):
pipx install .
If you already installed and pull new changes:
pipx reinstall zlog
Publish to PyPI
Build and check distributions:
python3 -m pip install build twine
python3 -m build
python3 -m twine check dist/*
Upload using a PyPI token (recommended):
export TWINE_USERNAME=__token__
export TWINE_PASSWORD="pypi-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
python3 -m twine upload dist/*
Alternatively, configure ~/.pypirc and omit env vars.
GitHub Actions (CI Publish)
This repo includes a workflow to publish on GitHub Release:
- Workflow:
.github/workflows/publish.yml - Trigger: publishing a GitHub Release or manual
Run workflow - Requires a repository secret:
PYPI_API_TOKEN
Steps to enable:
- Create a PyPI token with project scope (or scoped to an org).
- In your repo, add a secret:
Settings → Secrets and variables → Actions → New repository secret
- Name:
PYPI_API_TOKEN - Value: your token (e.g.,
pypi-XXXXXXXX...)
- Create and publish a GitHub Release for the version (e.g.,
v0.3.0).
- The workflow builds sdist/wheel and uploads to PyPI.
To use TestPyPI instead, edit the workflow step to set:
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
Usage
Record a new entry (interactive prompts):
zcatcher
View stats (all data):
zcatcher --stats
Limit stats to last N days (e.g., 7):
zcatcher --stats --days 7
Output all data as a table:
zcatcher --data
Output all data as JSON:
zcatcher --json
Output all data as CSV to stdout:
zcatcher --csv
Use a custom data file path:
zcatcher --file /path/to/my_sleep.jsonl --stats
Help
- Version:
zcatcher --versiondisplays the installed version. - Interactive entry:
zcatcherprompts for sleep time, sleep difficulty, wake time, wake difficulty, and wake date. - Stats:
zcatcher --statsshows averages; add--days Nto limit the window. - Table:
zcatcher --dataprints all records in a table (excludescreated_at). - JSON:
zcatcher --jsonprints a JSON array of all records. - CSV:
zcatcher --csvprints CSV with headers. - Custom data path:
zcatcher --file /path/to/file.jsonluses a specific file.
Data Storage
- Records are stored as JSON Lines in
~/.zcatcher/sleep_data.jsonlby default (or a custom path via--file). - Each record includes:
sleep_date,sleep_timewake_date,wake_timedifficulty_sleep(1-5),difficulty_wake(1-5)duration_hours(computed)created_at
Notes
- Times can be 24-hour
HH:MMorHHMM(colon optional). - Prompts now ask in order: sleep time, sleep difficulty, wake time, wake difficulty, then wake date (defaults to today if left blank).
- If the sleep time is later than the wake time (e.g.,
23:00->07:00), the sleep date is assumed to be the previous day.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zcatcher-0.4.0.tar.gz.
File metadata
- Download URL: zcatcher-0.4.0.tar.gz
- Upload date:
- Size: 18.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
618c2593142cd4b7c37c0dceed9f20fea781a4f152a00092fb2eb9bf35002b3b
|
|
| MD5 |
03bc1cbde6a0c6db37680f0bcdb8ca9c
|
|
| BLAKE2b-256 |
15f772de885f0f6821819c1c3c513a430c0c510e6b5641edeea48b7cb0882b10
|
File details
Details for the file zcatcher-0.4.0-py3-none-any.whl.
File metadata
- Download URL: zcatcher-0.4.0-py3-none-any.whl
- Upload date:
- Size: 19.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a2727bf34f92f61fe70d167432a10245c5f26844f65b9d2e9dcad8ecd9cf63a
|
|
| MD5 |
1da093ec167c6873e803f158306f3ebd
|
|
| BLAKE2b-256 |
ae6949b3bb41e431130ec670b70b4a420ab6cf193733f30c729a04f4e0bcc723
|