Context and rules for AI agents working in this repository. Humans should start with README.md.
- Name: bikes — a production-shaped MLOps package that predicts the number of bikes available.
- Description: reference implementation for the MLOps Coding Course, generated from cookiecutter-mlops-package.
- Language: Python 3.14+ (
pyproject.toml), managed withuv. - Stack: MLflow (tracking, registry, projects, evaluation), scikit-learn, pandas, Pydantic + Pandera validation, OmegaConf YAML configs, loguru.
All work goes through mise (see mise.toml); git hooks (lefthook.yml) and CI call the same tasks.
- Install:
mise run install— sync the virtualenv (uv sync) and install git hooks. - Format:
mise run format—ruff(import sort + format) anddprint(JSON/Markdown/TOML/YAML). - Check:
mise run check—rufflint,tytypes,pip-auditdeps,dprint/validate-pyproject/uv lockformat,gitleakssecrets,trivyconfig. - Test:
mise run test—pytestwith coverage (fails under 80%). - Build:
mise run build—uv build(wheel + sdist);mise run build:imagebuilds the Docker image. - Docs:
mise run docs—pdocAPI reference intodocs/. - MLflow jobs:
mise run projectruns every job;mise run project:run <name>runs one (confs/<name>.yaml).
A change is complete only when, locally, mise run format is clean, mise run check reports no findings, and mise run test is green with new/changed behavior covered by a test. Fix root causes — never weaken an assertion, add a skip/xfail, loosen a type, or suppress a lint error to force a green result.
- Errors with context: raise specific exceptions and chain with
raise ... from err; never use a bareexceptor silently swallow errors. - Config over hardcoding: jobs and objects are Pydantic models parsed from OmegaConf YAML in
confs/; validate and fail fast. Dataframes are validated at boundaries with Pandera schemas (core/schemas.py). - Typing: modern annotations (
list[str],X | Y); keepty checkclean.import typing as Tis the project convention. - Logging:
loguruviaLoggerService; no bare prints in library code. - MLflow: the file store (
./mlruns) is opted in viaMLFLOW_ALLOW_FILE_STOREfor local development; prefer a database backend in production. Models are logged withname=and referenced bymodels:/name@aliasormodels:/name/version. - Commits: Conventional Commits (
feat:,fix:,refactor:,chore:); no attribution in commit messages. Releases usegit-cliff(see the release process).
src/bikes/— package:core/(metrics, models, schemas),io/(configs, datasets, registries, services),jobs/(tuning, training, promotion, inference, evaluations, explanations),utils/(searchers, signers, splitters), plussettings.py,scripts.py,__main__.py.confs/— one OmegaConf YAML per MLflow job;tests/—pytestsuite mirroringsrc/with fixtures inconftest.py.pyproject.toml— dependencies andruff/ty/pytestconfig;mise.toml— tasks and pinned tools;lefthook.yml— git hooks;dprint.jsonc/trivy.yaml/cliff.toml— formatter, scanner, changelog config.Dockerfile/docker-compose.yml/MLproject/python_env.yaml— container image, local MLflow server, and MLflow Projects reproducible runs.