This works best inside of a VSCode Codespace.
-
(Optional) Set the environment variable
ADVENT_SESSION_COOKIE
or add it to to your adventofcode session cookie to automatically download your problem input. This can be find in the "Application > Storage > Cookies" section of the Chrome Developer Tools while visiting https://adventofcode.com . -
(Optional) Set the environment variable
ANTHROPIC_API_KEY
to your Anthropic API key, you can find one at https://console.anthropic.com . This will be used to automatically parse the problem's test data (NOT to answer the question). -
Generate the scaffolding for today's question
python -m python.run scaffold
-
If you didn't specify an ANTHROPIC_API_KEY, Paste the sample input and answer(s) into
examples/{year}/{day}.yaml
. For example:input: |- A Y B X C Z answers: - 15 - 12
Scaffolding will generate an empty solution file with 2 methods - part1
and part2
.
python/solutions/{year}/day{day}.py
"""
--- Day X: Problem Title ---
"""
def part1(text: str) -> int | None:
return None
def part2(text: str) -> int | None:
return None
Unit Tests will be automatically generated based on the examples specified in the above yaml. Simply run:
uv run pytest
Once you are satisfied with today's answer, generate your answer with:
uv python -m python.run solve