My solutions for Advent of Code 2025 using modern Python data science tools.
- marimo - Reactive Python notebooks (pure Python, git-friendly)
- polars - Fast DataFrame library
- jax - High-performance numerical computing
- rustworkx - Graph algorithms (Rust-backed)
- lark - Parsing toolkit
- more-itertools - Extended iteration tools
- advent-of-code-data - Puzzle data fetching
- Python 3.12+
- uv (recommended) or pip
# Clone the repo
git clone https://github.com/ballPointPenguin/aoc2025py.git
cd aoc2025py
# Install dependencies with uv
uv sync
# Or with pip
pip install -e .To fetch your personalized puzzle inputs, you need to set your AoC session token:
- Log into adventofcode.com
- Open browser DevTools → Application → Cookies
- Copy the value of the
sessioncookie - Set it as an environment variable:
export AOC_SESSION="your_session_token_here"Or create a .env file (already in .gitignore):
AOC_SESSION=your_session_token_here
uv run marimo edit days/day_01.pycp days/day_01.py days/day_02.py
# Edit the DAY variable and implement your solutionuv run python days/day_01.py.
├── pyproject.toml # Project config and dependencies
├── src/
│ └── aoc_utils/ # Shared utilities
│ ├── __init__.py
│ ├── fetching.py # AoC data fetching
│ ├── parsing.py # Input parsing helpers
│ └── grid.py # 2D grid utilities
├── days/
│ ├── day_01.py # Day 1 marimo notebook
│ ├── day_02.py # Day 2 marimo notebook
│ └── ...
└── tests/
└── ...
from aoc_utils import get_puzzle, get_input, get_examples
puzzle = get_puzzle(year=2025, day=1)
raw_input = puzzle.input_data
examples = puzzle.examplesfrom aoc_utils import parse_lines, parse_ints, parse_grid, parse_sections
lines = parse_lines(raw_input) # Split into lines
numbers = parse_ints(raw_input) # Extract all integers
grid = parse_grid(raw_input) # 2D character grid
sections = parse_sections(raw_input) # Split on blank linesfrom aoc_utils import Grid, Point
grid = Grid.from_string(raw_input)
start = grid.find('S')
for neighbor, value in grid.neighbors4(start):
print(f"{neighbor}: {value}")Ruff is included for linting and formatting. First install dev dependencies:
uv sync --group devThen run:
# Check for issues
uv run ruff check .
# Auto-fix issues
uv run ruff check --fix .
# Format code
uv run ruff format .- Edit the version specifiers in
pyproject.toml(e.g. bumppolars>=...,ruff>=...). - Regenerate the lockfile and install:
uv lock
uv syncTip: to upgrade without manually editing version specifiers, you can use:
uv lock --upgrade # upgrade everything within allowed constraints
uv lock --upgrade-package polars
uv syncIf uv was installed via the official installer (or pipx), update it with:
uv self updateIf you installed uv via Homebrew, use:
brew upgrade uvAny time pyproject.toml changes (dependencies, dependency groups, Python constraint), re-lock:
uv lockThen ensure your environment matches the lockfile:
uv sync- marimo notebooks auto-reload when you edit
src/aoc_utils/*.py - Use
polarsfor tabular data (much faster than pandas) - Use
rustworkxfor graph problems (BFS, DFS, shortest paths) - Use
larkfor complex parsing (grammars) - Use
jax.numpyfor numerical puzzles needing speed