My record of current and past attempts at Advent of Code in Python. (I usually peter out around the second week as they take more time and I'm spending more time with family.)
Click the button above to launch into Codespaces, or clone the repo and open in VScode. VScode will recognize the presence of devcontainer configuration and prompt you reopen the repository inside the container after building the Docker Image.
Before installing dependencies please make sure you have an accessible distribution of python 3.11 available and installed poetry. To create a new virtual environment and install all dependencies run
$ poetry install
The solutions for each day will be in its own sub package of the top level aoc
package with one module for each part. All input data will be in the data
directory labeled by day. The tests
directory contains one module for each day with tests for both parts. The solution for each part can be printed by runing the include command line interface aoc
with each day and part as subcommands. For example to get the solution to Day 1, Part 1, run
$ poetry run aoc day1 part1 data/day1.txt
To get more information on how to use the CLI just append --help
to the command for example:
$ poetry run aoc --help
Each day has its own tests using the provided example input data. To run the tests for all days run pytest
from the root directory.
To run tests for a single day run pytest tests/test_day1.py
Documentation is provided via mkdocs-material
and mkdocstrings
and are generated from the source code, and host on github pages.