Skip to main content

A helper package for Advent of Code

Project description

aoc_helper

Code style: black

@salt-die's aoc_helper package, rewritten from the ground up

Automation

This project aims to be compliant with the Advent of Code Automation Guidelines. Here are the strategies it uses:

Installation

Install aoc_helper with pip!

pip install aoc_helper
# install the dependencies required for the Command Line Interface
pip install aoc_helper[cli]
# install the dependencies required for colour
pip install aoc_helper[fancy]
# install all additional dependencies
pip install aoc_helper[cli,fancy]
# or
pip install aoc_helper[full]

Configuration

When you first use any function that interfaces with Advent of Code, you will be prompted to enter your session token.

Your session token is stored as a HTTPOnly cookie. This means there is no way of extracting it with JavaScript, you either must use a browser extension such as EditThisCookie, or follow this guide

This token is stored in ~/.config/aoc_helper/token.txt (C:\Users\YOUR_USERNAME\.config\aoc_helper\token.txt on Windows, probably), and other aoc_helper data is stored in this folder (such as your input and submission caches).

If, for whatever reason, you feel the need to clear your caches, you can do so by deleting the relevant folders in aoc_helper's configuration folder.

Command Line Interface

aoc_helper has a command line interface, accessed by running python -m aoc_helper or aoc followed by the command line arguments. Its commands are detailed below:

fetch

aoc fetch <DAY> [--year <YEAR>]

Fetch your input for a given day.
YEAR is the current year by default.

Examples (written during 2020):

aoc fetch 2 # fetches input for 2020 day 2
aoc fetch 24 --year 2019 # fetches input for 2019 day 24

submit

aoc submit <DAY> <PART> <ANSWER> [--year <YEAR>]

Submits your answer for a given day and part.
YEAR is the current year by default.

Examples (written during 2020):

aoc submit 2 1 643 # submits 643 as the answer for 2020 day 2 part 1
aoc submit 24 1 12531574 --year 2019 # submits 12531574 as the answer for 2019 day 2 part 1

template

aoc template <DAYS> [--year YEAR]

Generates templates for your advent of code folder.
YEAR is the current year by default.

DAYS must be a comma-separated list of date ranges, which may be one of:

  • all, to generate a template for every day in the year
  • A single integer in the range [1, 25] to generate a single template
  • A pair of integers in the range [1, 25], separated with a hyphen, to generate template for each day in the range

Note that even if a day is included in the list of days more than once (including implicitly, within ranges or all), it will only be generated once.

Filenames are formatted as day_NUMBER.py where NUMBER is the 2-digit day number.

Examples (written during 2020):

aoc template all # generates day_01.py to day_25.py, with aoc_helper methods referencing 2020, in the current folder
aoc template 3 --year 2019 # generates day_03.py, with aoc_helper methods referencing 2019, in the current folder
aoc template 3-5 --year 2017 # generates day_03.py to day_05.py, with aoc_helper methods referencing 2017, in the current folder
aoc template 3-5,7,9,9-10 # generates files for days 3, 4, 5, 7, 9, and 10

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aoc_helper-1.14.0.tar.gz (36.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aoc_helper-1.14.0-py3-none-any.whl (36.7 kB view details)

Uploaded Python 3

File details

Details for the file aoc_helper-1.14.0.tar.gz.

File metadata

  • Download URL: aoc_helper-1.14.0.tar.gz
  • Upload date:
  • Size: 36.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for aoc_helper-1.14.0.tar.gz
Algorithm Hash digest
SHA256 cac165291c8057f07797341c6ff96b091dd4ffed3c7dae81a35e93a18d0ceba2
MD5 3dcf6c4786449be3f614e58309a6bf6b
BLAKE2b-256 491c26cee1f5c887f59c86ba03a33a9cd856941724a1a79f3cc2f4a89cd2b3a5

See more details on using hashes here.

File details

Details for the file aoc_helper-1.14.0-py3-none-any.whl.

File metadata

  • Download URL: aoc_helper-1.14.0-py3-none-any.whl
  • Upload date:
  • Size: 36.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

File hashes

Hashes for aoc_helper-1.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a1fc8094aee9907f767caecf205227dce1da89b3a7e31e6283e0449ae8eeede
MD5 1437984b50174e3b5ba89309e8ab53b9
BLAKE2b-256 51b3ad525f8fbb1764f61651f4b9ba528e88f91403265d6845200472769c9ed0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page