Skip to main content

Toolkit for advent of code

Project description

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)

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

aoc_kit-0.1.5.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

aoc_kit-0.1.5-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file aoc_kit-0.1.5.tar.gz.

File metadata

  • Download URL: aoc_kit-0.1.5.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.11.0 Linux/6.0.10-300.fc37.x86_64

File hashes

Hashes for aoc_kit-0.1.5.tar.gz
Algorithm Hash digest
SHA256 e37c5243d04410a8f3f755eda90b6cea8cc1231bcb8216838d3729819012040a
MD5 c5ef867b8be76dfb52f51f6fbad44847
BLAKE2b-256 db41aadaccfb32f68021ddd16b79d114b20f30ac028a94373815efb974505a06

See more details on using hashes here.

File details

Details for the file aoc_kit-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: aoc_kit-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.2.2 CPython/3.11.0 Linux/6.0.10-300.fc37.x86_64

File hashes

Hashes for aoc_kit-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d88f804c31903e059b41b10cfc3ff3c07d041bab3f91b301cccf0c676aacb36d
MD5 dff43dc7c98e6089dda1a43b527697cd
BLAKE2b-256 278fb54e6396d6857fc98a177a9a4708de245fae7fcb084e5741c2944d379148

See more details on using hashes here.

Supported by

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