Repository navigation
Contributing
Bug reports, feature requests and pull requests are all welcome.
The repository's own rules, in Czech, are in
notes/repo_rules.md.
git clone https://github.com/jsem-nerad/strava-cz-python.git
cd strava-cz-python
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev,cli]"Python 3.10 or newer. The dev extra brings pytest, respx, ruff, mypy and keyring.
The documentation you are reading is a separate git repository. Clone it next to the
code — wiki/ is in .gitignore, so it will not be committed to the main repository:
git clone git@github.com:jsem-nerad/strava-cz-python.wiki.git wikigit checkout main
git pull origin main
git checkout -b feature/what-you-are-addingThen, before opening a pull request:
pytest
ruff check src tests examples
ruff format src tests examples
mypyRecord what you changed in CHANGELOG.md under [unreleased], push the branch and open
a pull request. CI runs the same four commands on Python 3.10 through 3.14.
src/strava_cz/
├── __init__.py public API
├── client.py StravaCZ - HTTP, login, error mapping
├── menu.py Menu - fetching, filtering, ordering
├── models.py Meal, Day, User, MealType, Restriction, OrderResult
├── parser.py raw API response -> Day/Meal objects
└── exceptions.py the exception hierarchy
tests/
├── conftest.py fixtures, and the guard that blocks real network access
├── fixtures/ recorded API responses
├── test_parser.py
├── test_client.py
├── test_menu.py
├── test_ordering.py
└── test_regressions.py
Tests must never touch the network. An autouse fixture in conftest.py makes any
attempt to open a socket fail with an explanation. This is not optional politeness: an
earlier version of the suite sent real requests to app.strava.cz on every CI run, against
a school canteen's server.
Tests use recorded responses from tests/fixtures/, routed through
respx:
def test_something(api, strava, menu_payload):
api.post("https://app.strava.cz/api/objednavky").mock(
return_value=httpx.Response(200, json=menu_payload)
)
strava.menu.fetch()
assert len(strava.menu.get_days()) == 20Useful fixtures:
| fixture | what it gives you |
|---|---|
api |
a respx router with warm-up and logout already stubbed |
strava |
a logged-in client, no menu fetched |
menu |
a logged-in client with the recorded menu fetched |
menu_payload |
the raw recorded 31-day menu |
To test against a canteen that behaves differently, record its response:
export STRAVA_USERNAME="your.username"
export STRAVA_PASSWORD="YourPassword"
export STRAVA_CANTEEN="3753"
python examples/capture_api.py objednavky > tests/fixtures/menu_yours.jsonThe script blanks out personal fields, but read the file before committing it — menu data is not usually sensitive, but check anyway.
tests/test_regressions.py pins behaviour that used to be wrong, each test named for the
bug it prevents. When you fix something, add a test there saying what the old behaviour
was, so nobody reintroduces it.
- Ruff handles formatting and linting; 100-column lines.
- Full type annotations —
mypyruns in strict mode and the package shipspy.typed. - Google-style docstrings on everything public.
- Comments explain why, not what.
Open items:
- Login rate limiting
- A debug/log mode
- An async client
- An app that orders lunches by itself from the user's preferences, which is what the MCP server is the first step towards
Also genuinely useful: recordings from canteens whose menus differ from the ones already
in tests/fixtures/, especially any that serve breakfast or dinner, or that let you order
soup separately. See API Internals for what is still unexplained.
Include:
- what you did and what happened instead
- the library version (
strava_cz.__version__) and your Python version - the full traceback
- if the menu looks wrong, the relevant part of
strava.menu.raw_dataand anything instrava.menu.parse_warnings
Never paste your password or a sid into an issue.