A library for Advent of Code containing utilities to use while solving problems!
Project description
Advent of Code Module
A library for Advent of Code containing utilities to use while solving problems!
If any issues or bugs are discovered, please submit an issue and I'll fix it!
Automation notice for Advent of Code
This library follows the automation guidelines on the /r/adventofcode community wiki. Specifically:
- A maximum of 2 outbound calls will be made for each run of the
aoc-modsetup and submission features. - There will be a 2 minute timeout between setup and submission requests.
- Once puzzle input and instructions are retrieved for a given puzzle day, they will be stored locally and then not pulled again for that day.
- The
User Agentcontains a link to this repository and my GitHub username. I am the sole maintainer of this library.
Install and use the CLI aoc-mod
pip install aoc-mod
Run the aoc-mod script
To enable full functionality of this script, set an environment variable named SESSION_ID with your authenticated session ID from the browser (see getting and using the session ID).
# access the help menu
aoc-mod -h
# optional: set the session ID to enable full functionality
# on Linux:
export SESSION_ID=[session-id]
# on Windows:
set SESSION_ID=[session-id]
# get puzzle instructions and set up a Python file for solving for the current day
aoc-mod setup
# setup the project for a specific day
aoc-mod -y 2024 -d 2 setup
# submit a challenge (2024, day 2, part A)
aoc-mod -y 2024 -d 2 submit -a [answer] -p 1
Installation with Poetry for development
The build system has been updated to utilize poetry for installation, building, and dependency management. To install/build locally, install the poetry build system through pipx.
# install pipx
sudo apt install pipx
# install poetry
pipx install poetry
Once poetry is installed, the following commands can be used to install, build, and run unit tests locally.
# install the library
poetry install
# build a wheel
poetry build
# run the tests
poetry run pytest
Formatting and linting is also available through ruff.
# run a linter check
poetry run ruff check
# run a linter check and correct issues
poetry run ruff check --fix
# format the code
poetry run ruff format
Some vulnerability scanning is also available with bandit.
poetry run bandit -c pyproject.toml -r .
Documentation
The documentation is managed and built using Sphinx through the Poetry build system. To build the documentation and open it, run the following commands:
poetry run sphinx-build -M html docs/source/ docs/build/
firefox docs/build/html/index.html
Getting and Using the SESSION_ID
The SESSION_ID is necessary to perform advanced operations like getting puzzle input and
submitting puzzle answers. Without this variable, the only operations available are getting basic
puzzle instructions and setting up a solution template file.
| Feature | session-id |
no session-id |
|---|---|---|
| Get puzzle instructions | full support | partial support |
| Get puzzle input | full support | no support |
| Submit puzzle solutions | full support | no support |
| Setup puzzle solution folder | full support | full support |
In order to obtain this variable, authenticate with https://adventofcode.com and then press F12 in the browser and navigate to the Application or Storage Tabs, if they exist, and search the cookies for the session or sessionid value.
NOTE: The session id value is a unique key for your own authenticated session with Advent of Code. You should protect it like a password and never share it (i.e. never push a session id to GitHub or store in an insecure location).
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aoc_mod-0.2.4.tar.gz.
File metadata
- Download URL: aoc_mod-0.2.4.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
71ac3f101a44f337c70f0d2c7e0d28f7ed856781e503d845fc57c76a934839cd
|
|
| MD5 |
b0efe949ffdadd88243cb15462e8ed3a
|
|
| BLAKE2b-256 |
4363322ec3ffc802e6767b8fac44fc66c80011b46f8aad8c3b5445268315f820
|
Provenance
The following attestation bundles were made for aoc_mod-0.2.4.tar.gz:
Publisher:
build_wheel.yml on cosmos1255/aoc_mod
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aoc_mod-0.2.4.tar.gz -
Subject digest:
71ac3f101a44f337c70f0d2c7e0d28f7ed856781e503d845fc57c76a934839cd - Sigstore transparency entry: 703456310
- Sigstore integration time:
-
Permalink:
cosmos1255/aoc_mod@ffe2be7364d654488de0c2f36d5b896498432906 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cosmos1255
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheel.yml@ffe2be7364d654488de0c2f36d5b896498432906 -
Trigger Event:
push
-
Statement type:
File details
Details for the file aoc_mod-0.2.4-py3-none-any.whl.
File metadata
- Download URL: aoc_mod-0.2.4-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
253f557d9cc271dc53291fe54e0ea3772e5ccfe1e3a5f52c5a8a6dab7ee54ce1
|
|
| MD5 |
09996c1c008d0ac062a9ce13e0a5bfbd
|
|
| BLAKE2b-256 |
595ce5da90cf983102edc1c7029c1bc3e1f21fe73d3a724efdf28cb869ac0416
|
Provenance
The following attestation bundles were made for aoc_mod-0.2.4-py3-none-any.whl:
Publisher:
build_wheel.yml on cosmos1255/aoc_mod
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
aoc_mod-0.2.4-py3-none-any.whl -
Subject digest:
253f557d9cc271dc53291fe54e0ea3772e5ccfe1e3a5f52c5a8a6dab7ee54ce1 - Sigstore transparency entry: 703456368
- Sigstore integration time:
-
Permalink:
cosmos1255/aoc_mod@ffe2be7364d654488de0c2f36d5b896498432906 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/cosmos1255
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build_wheel.yml@ffe2be7364d654488de0c2f36d5b896498432906 -
Trigger Event:
push
-
Statement type: