Skip to main content

Advent Of Code kit

Advent of what?

Advent of code is a coding competition during december. https://adventofcode.com/about.

Purpose

With this library it should be easy to get started.

Getting started

Create a folder for you aoc adventures:

mkdir aoc
cd aoc

Install the aoc-kit

  • Pipenv:
pipenv init
pipenv install aoc-kit
  • Poetry:
poetry init
poetry add aoc-kit
  • System wide
pip install --user aoc-kit

Create a .env file

Within your freshly created aoc folder you have to create a .env file with a contents like this. You can find the token in your browser. When you are logged in you can open the dev tools and find it in the cookies. It is the session cookie. Just replace the xxxxxx with your actual token.

.env

AOC_TOKEN=xxxxxx

Basic usage

Using the template to get started on a puzzle for a day

Simply run

poetry run aoc-new-day --year 2022 --day 1
# or
pipenv run aoc-new-day --year 2022 --day 1
# or if you have it installed systemwide
aoc-new-day --year 2022 --day 1

This will create a file structure like this

aoc/
  2022/
    01/
      main.py

You can implement you solution in main.py and run it with:

pipenv run python 2022/01/main.py
# or
poetry run python 2022/01/main.py
# or
python 2022/01/main.py

get_input function

The get_input will return the downloaded (on first call) puzzle input or return a locally saved puzzle input (on all later calls) of the given day and year.

from aockit import get_input

def process(data):
    return 'implement me'

data = get_input(2015, 1)
result = process(data)
print(result)

Metadata

Release files for aoc-kit 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aoc-kit 0.1.5
File Size Uploaded
aoc_kit-0.1.5.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for aoc-kit 0.1.5
File Interpreter ABI Platform
aoc_kit-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / aoc_kit-0.1.5.tar.gz

Download URL aoc_kit-0.1.5.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e37c5243d04410a8f3f755eda90b6cea8cc1231bcb8216838d3729819012040a
BLAKE2b-256 checksum
How to use checksums
db41aadaccfb32f68021ddd16b79d114b20f30ac028a94373815efb974505a06
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.11.0 Linux/6.0.10-300.fc37.x86_64

Release files / aoc_kit-0.1.5-py3-none-any.whl

Download URL aoc_kit-0.1.5-py3-none-any.whl
Size 6.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d88f804c31903e059b41b10cfc3ff3c07d041bab3f91b301cccf0c676aacb36d
BLAKE2b-256 checksum
How to use checksums
278fb54e6396d6857fc98a177a9a4708de245fae7fcb084e5741c2944d379148
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.2.2 CPython/3.11.0 Linux/6.0.10-300.fc37.x86_64

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page