A repo where I maintain all my Advent of Code solutions over the years... mostly in Go and Python.
This project includes a Textual TUI to easily browse and run solutions.
This project uses uv for Python package and virtual environment management.
- Python 3.11+
- uv
-
Clone the repository:
git clone https://github.com/veenified/adventofcode.git cd adventofcode -
Create a virtual environment:
uv venv
-
Activate the virtual environment:
source .venv/bin/activate -
Install dependencies:
uv pip sync pyproject.toml
To launch the Textual TUI, simply run:
python main.pyFrom the TUI, you can navigate the years and days to run any available solution.
To run the TUI with debug mode enabled, use the --debug flag:
python main.py --debugDebug mode provides:
-
Debug Log Panel: A dedicated debug log panel at the bottom of the screen that displays troubleshooting information, including:
- App initialization status
- File selection events
- ContentSwitcher state changes
- Worker thread execution flow
- Error messages and stack traces
-
Copy Debug Log Command: Press
dto copy the entire debug log to your clipboard for easy sharing or analysis. The "Copy Debug Log" command will appear in the footer after you pressdfor the first time.
Debug mode is useful for troubleshooting issues with script execution, understanding the application flow, or diagnosing problems with the spinner or content switching.
You can also run any day's solution directly from the command line.
To do so, you must set the PYTHONPATH to include the project's root directory.
PYTHONPATH=. python <year>/<day_file>.pyFor example:
PYTHONPATH=. python 2015/day01.pyTo automatically download your puzzle input, you must set the AOC_USER_ID environment variable.
-
Find your Session ID:
- Log in to the Advent of Code website.
- Open your browser's developer tools.
- Go to the "Cookies" or "Application" -> "Storage" section.
- Find the cookie named
sessionfor theadventofcode.comdomain. - Copy the value of this cookie.
-
Set the Environment Variable:
-
For the current terminal session:
export AOC_USER_ID='your_session_id_here'
(On Windows PowerShell, use
$env:AOC_USER_ID='your_session_id_here') -
To set it permanently: Add the
exportcommand to your shell's startup file (e.g.,~/.zshrc,~/.bashrc,~/.profile).
-
Once the environment variable is set, the scripts will be able to download your puzzle input automatically.