TheDocumentation 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.
aoc_cj package lives under src/aoc_cj/ and follows a simple, consistent layout: one subpackage per Advent of Code year (e.g. aoc2015/ through aoc2025/), one module per day inside each year subpackage, and a shared util/ subpackage of reusable helpers. A top-level __init__.py exposes a single solve() dispatcher function that is registered as the adventofcode.user entry point consumed by the aocd test runner.
Directory Layout
The full source tree looks like this:y{year}d{day:02d}_test.py:
The
py.typed marker file tells type checkers (mypy, pyright, etc.) that
aoc_cj ships its own inline type annotations. The project runs mypy in
strict mode, so all public functions are fully typed.Per-Day Module Convention
Every day module inside a year subpackage follows the same interface:part_1(txt: str) -> int | str | None— returns the solution for Part 1, orNoneif not yet implemented.part_2(txt: str) -> int | str | None— returns the solution for Part 2, orNoneif not yet implemented.- Optional helpers — a
parse()function (or similar) that is used internally by both parts. if __name__ == '__main__':block — reads live puzzle input fromaocd.dataand prints both answers.
The solve() Dispatcher
The solve() function in src/aoc_cj/__init__.py is the central entry point for the whole package. It dynamically imports the correct day module and calls part_1 / part_2 via the internal _solve_part() helper:
pyproject.toml under the adventofcode.user group:
aocd’s test runner discovers when it looks up solutions for the cj81499 user. Calling solve(2024, 1, puzzle_input) resolves to importing aoc_cj.aoc2024.day01 and running both part functions.
If the day module does not exist,
solve() raises NotImplementedError
rather than returning (None, None). If a part function exists but raises
NotImplementedError itself (an unfinished stub), _solve_part() catches it
and returns None gracefully.Answer Type
Answer type alias. The three possibilities are:
| Return value | Meaning |
|---|---|
int | Numeric puzzle answer (most common) |
str | String puzzle answer |
None | Part is not yet implemented, or the function raised NotImplementedError |
_solve_part() enforces this at runtime with an assertion, so returning an unexpected type (e.g. a list or float) will cause an AssertionError rather than silently producing a wrong answer.
Logging
aoc_cj configures Python’s standard logging module at import time to write all messages at DEBUG level and above to a rotating log file:
solve() emits an INFO-level log entry recording the year, day, and both answers (even if an exception was raised — the finally block always fires). Unhandled exceptions are additionally logged at ERROR level via logging.exception(), giving a full traceback in the log file.