Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/cj81499/advent-of-code/llms.txt

Use this file to discover all available pages before exploring further.

The aoc-cj repository uses a modern, minimal Python toolchain: Python 3.13+ as the language runtime, uv for virtual-environment creation and dependency management, and pre-commit for automated code-quality hooks that run before every commit. Understanding these three tools is enough to get a fully working local environment in under two minutes.

Prerequisites

Before you begin, make sure the following are available on your machine:
  • Python 3.13 or newer — the project’s pyproject.toml sets requires-python = ">=3.13".
  • uv — Astral’s fast Python package and project manager. uv will automatically create and manage the virtual environment for you.
  • git — for cloning the repository and for pre-commit’s hook integration.

Installing uv

If you don’t already have uv, install it with the official installer script:
Install uv
curl -LsSf https://astral.sh/uv/install.sh | sh
Once installed, uv handles everything else — it creates .venv, pins the Python version, and resolves the lockfile without any extra commands from you. You never need to manually activate a virtual environment; uv run <command> always executes inside the correct environment.

Cloning & Syncing

1

Clone the repository

Clone
git clone https://github.com/cj81499/advent-of-code.git
cd advent-of-code
2

Install all dependencies

Sync dependencies
uv sync
uv sync installs the project itself along with every package listed under [dependency-groups] dev in pyproject.toml:
PackagePurpose
mypyStatic type checking
pytestTest runner
pytest-covCoverage reporting
pytest-watcherFile-watch re-runner
ruffFormatter and linter
pre-commitGit hook manager
tombiTOML formatter and linter
types-networkx, types-shapelyStub packages for type checking
uv sync is optional as a manual step — running uv run <any-command> will automatically sync the environment if it is out of date.
3

Configure the AoC session token

See the Configuring the AOC Session Token section below.
4

Install pre-commit hooks

Install hooks
uv run pre-commit install

Configuring the AOC Session Token

The aocd library (Advent of Code Data) fetches your personal puzzle inputs from the AoC website. It needs your browser session cookie to authenticate. Store it in:
~/.config/aocd/token
The easiest way to populate that file is to let aocd scrape the token directly from your browser’s cookie storage:
Scrape session token from browser
uv run --with browser-cookie3 aocd-token
This command runs temporarily with the browser-cookie3 package added (without permanently adding it to the project) and writes your session token to the expected location.
Without a valid session token, any test that fetches real puzzle input from the AoC servers will fail. Tests that rely only on the hard-coded EXAMPLE_INPUT strings inside the test files will continue to work regardless.

Pre-commit Hooks

Once uv run pre-commit install has been run, the following hooks execute automatically on every git commit:
HookSourceWhat it does
ruff-checkastral-sh/ruff-pre-commitLints Python files and auto-fixes safe issues (--fix)
ruff-formatastral-sh/ruff-pre-commitFormats Python files in-place
uv-lockastral-sh/uv-pre-commitEnsures uv.lock is up to date
end-of-file-fixerpre-commit/pre-commit-hooksAdds a trailing newline to every file
check-yamlpre-commit/pre-commit-hooksValidates YAML syntax
check-added-large-filespre-commit/pre-commit-hooksPrevents accidentally committing large files
markdownlint-cli2DavidAnson/markdownlint-cli2Lints Markdown files
The config also opts in to all git hook types (commit-msg, pre-push, post-checkout, etc.) via default_install_hook_types, so hooks can fire at the most appropriate point in the git lifecycle.
You can run all hooks against every file at any time — without making a commit — using:
Run all hooks manually
uv run pre-commit run --all-files

VS Code

The repository ships a .vscode/ directory with editor settings pre-configured for this project. If you open the repository root in VS Code, the workspace settings and recommended extensions will be picked up automatically.

Build docs developers (and LLMs) love