Skip to content

OverkillGuy/aoc-runner

Repository files navigation

Advent of Code runner

A Python plugin-based runner for my Advent of Code solutions.

Requires Python 3.13.

Usage

Install the command

Install the module first:

make install
# or
uv sync

Then inside the virtual environment, launch the command:

# Run single command inside virtualenv
uv run aoc

# or
# Load the virtualenv first
source .venv/bin/activate
# Then launch the command, staying in virtualenv
aoc

Run the solutions

The solutions are exposed as Python plugins (Entrypoints) under name advent-of-code.solutions, with names following the spec <year>-<day>-<part>, like 2024-01-2 = second part of day 1 2024.

To discover all plugins available in your venv, use:

aoc discover

Which can return:

Found 2 solutions:
- 2025-01-1
- 2025-01-2

Once you've identified a solution you want to run, use

# aoc run RUN_SPEC INPUT_FILEPATH
aoc run 2025-01-2 data/input01.txt

Development

Python setup

This repository uses Python3.13, using uv as package manager to define a Python package inside src/aoc_runner/.

uv will create virtual environments if needed, fetch dependencies, and install them for development.

For ease of development, a Makefile is provided, use it like this:

make  # equivalent to "make all" = install lint docs test build
# run only specific tasks:
make install
make lint
make test
# Combine tasks:
make install test

Once installed, the module's code can now be reached through running Python in uv:

$ uv run python
>>> from aoc_runner import main
>>> main("blabla")

This codebase uses pre-commit to run linting tools like flake8. Use pre-commit install to install git pre-commit hooks to force running these checks before any code can be committed, use make lint to run these manually. Testing is provided by pytest separately in make test.

Documentation

Documentation is generated via Sphinx, using the cool myst_parser plugin to support Markdown files like this one.

Other Sphinx plugins provide extra documentation features, like the recent sphinx-autodoc2 to generate API reference without headaches, and with myst-markdown support in docstrings too!

To build the documentation, run

# Requires the project dependencies provided by "make install"
make docs
# Generates docs/build/html/

To browse the web version of the documentation you just built, run:

make docs-serve

And remember that make supports multiple targets, so you can generate the documentation and serve it:

make docs docs-serve

Templated repository

This repository was created by the copier template available at python-template, using version v2.0.0a24.

About

A Python plugin-based runner for my Advent of Code solutions

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors