Skip to content

26.2

Latest

Choose a tag to compare

@github-actions github-actions released this 30 Nov 00:47
· 2 commits to main since this release
95b9a6e

Highlights

Upgrading: run adventofcode benchmark for the whole folder once to move an existing README table to the new format. Until then, benchmarking a single day asks you to do that instead of overwriting the table.

New

  • adventofcode login sets up your session cookie once for every year. It tells you where to find the cookie, checks it with adventofcode.com, and saves it to ~/.config/adventofcode/session. No more copying the cookie into each year's .env file. AOC_SESSION in the environment or .env still works and takes precedence, and adventofcode init offers to log in when no cookie is set up.
  • A redesigned benchmark table in the README: one row per day with its fastest solution, stars instead of ✅/⚠️, and links to each solution file. Days with more than one solution get an Other versions table that compares each version to the fastest ("23× slower") instead of striking it through. The legend covers every status icon, and a line says which Python and platform the times were measured on.
  • Benchmark results are saved to benchmarks.json, and the README table is rebuilt from it on every run. Benchmarking a single day updates only that day. The console shows how much each solution sped up or slowed down since the last run, and prints the errors of failing days.
  • adventofcode run tells you how long until a puzzle unlocks, instead of failing with an error from adventofcode.com.
  • An expired or mistyped session cookie gets a clear message telling you to run adventofcode login, instead of adventofcode.com's raw error.
  • Puzzle descriptions keep their formatting (#46). print_p1() and print_p2() show the highlighted parts in bold and code in color, and get_puzzle() takes format="markdown" or format="html" as well as the plain text it returned before.

Fixes

  • Part 2 is only submitted once part 1 is solved. Before, a part 2 answer submitted too early got a "wrong level" response that was cached forever, so that answer could never be submitted again.
  • "You gave an answer too recently" responses are no longer cached, so the answer is submitted again on the next run.
  • adventofcode init adds .cache* to .gitignore, and creates .gitignore if it's missing. .cache didn't match the .cache.db input cache that Python 3.11 and 3.12 create on macOS, so puzzle inputs could end up in git.
  • Benchmarking a single day no longer fails to find variant rows (like 03-alt.py), breaks the table's total row when there are variants, or adds a slower variant's time to the totals.
  • adventofcode benchmark ./2024 works again: the day scripts were run with a path relative to the wrong directory.
  • Benchmark times are no longer misread when the answer itself contains "ms".
  • File names with a variant suffix like 03-v2.py are no longer treated as day 32.
  • print_p2() says when part 2 isn't available yet instead of crashing, and doesn't cache that.
  • AoC() can be created without part_1/part_2 functions, and submit_p1(answer)/submit_p2(answer) submit the answer you pass in, as the README describes.
  • Answers of 0 are submitted instead of skipped.

Smaller changes

  • submit_p1() and submit_p2() return the outcome: "correct", "incorrect", "too_recent", and so on.
  • adventofcode run exits with a non-zero code when something goes wrong.
  • Importing adventofcode no longer creates a .cache file in the current directory; it's opened the first time an input or answer is cached. Set AOC_CACHE to keep it somewhere else. A cache created by another Python version gets a clear error instead of a dbm.error traceback.
  • Requests to adventofcode.com send a User-Agent that identifies the tool, as Advent of Code asks automated tools to do.

What's Changed

🧰 Maintenance

  • Bump the "monthly" group with 3 updates across multiple ecosystems by @dependabot[bot] in #73
  • Bump the "monthly" group with 3 updates across multiple ecosystems by @dependabot[bot] in #74

Other changes

Full Changelog: 26.1...26.2

Contributors

Thank you to everyone who contributed to this release: @anze3db