Skip to main content

Advent of Code helper CLI and library

Project description

Advent-of-code-py

Advent of Code helper CLI and library for python projects.

Note: Currently it is still in beta stage which may have lots of bug please report out bug if you find any

Status & Info:

Travis Build Status Code style License
Travis Build Status Code style License: MIT

Usage

Installation

To install out advent-of-code-py run out following command which install out advent-of-code-py cli and advent_of_code_py library.

pip install advent-of-code-py

OR

poetry add advent-of-code-py

Usage

Initially for advent-of-code-py to work out it need session value or session ID which you can obtain out by viewing out cookie while visiting advent of code server. After collecting session cookie value you need to add those value in config using advent-of-code-py CLI

advent-of-code-py config add <session-name> <session-value>

Now you can import out library by using

import advent_of_code_py

After importing a library you can now use out either two decorator solve or submit decorator for a function of puzzle

For example:-

@advent_of_code_py.submit(2018,3,1,session="<session-name>")
def puzzle_2018_3_1(input):
    # do some calculation
    return final_output

Now after decorating out function now you can call out function

puzzle_2018_3_1()

After calling out function final_output value will be submitted out to Advent of Code server for 2018 year day 3 problem then returns out whether submitted answer was correct or not. If session value is not provided then solution will be submitted to all session value set out.

You can also use out advent-of-code-py builtin Initializer and runner to create out appropriate CLI tool for problem so problem can be run easily To set advent-of-code-py puzzle as CLI

@advent_of_code_py.adventrunner()
def main_cli():
    initializer = advent_of_code_py.Initializer()
    initializer.add("<function_alias>"="<function>")
    # for example to run above function you can write out
    initializer.add("2018-3-1"=puzzle_2018_3_1)  
    # add other function
    return initializer

Now you can set out main_cli as entry points and it will create out CLI with appropriate name and function which was added. So for example to run out function puzzle_2018_3_1() you have to run out command as entry-point-name run 2018-3-1 which will run appropriate function as well as submit as desired.

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

advent-of-code-py-0.1.1.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

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

advent_of_code_py-0.1.1-py3-none-any.whl (11.4 kB view details)

Uploaded Python 3

File details

Details for the file advent-of-code-py-0.1.1.tar.gz.

File metadata

  • Download URL: advent-of-code-py-0.1.1.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1040-gcp

File hashes

Hashes for advent-of-code-py-0.1.1.tar.gz
Algorithm Hash digest
SHA256 4fc792178a9f4d29da04b0b71dc043eaf2f6012e5df7a386816b2672a9f15b99
MD5 c4dc6e474ef258863d62050efd8bf6e9
BLAKE2b-256 1cfc1cacb63056775091d57b314cf30e229c213f6f686880c1826fe909b55b4c

See more details on using hashes here.

File details

Details for the file advent_of_code_py-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: advent_of_code_py-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.17 CPython/3.7.1 Linux/4.15.0-1040-gcp

File hashes

Hashes for advent_of_code_py-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5bba9abb8f6c366759f1cc5d0a729062e50256ef1c62e035bcdbc739f8215bef
MD5 e2e7a75ff9226e87bb505d673f12ad3f
BLAKE2b-256 a08a449d3a20ee8c787c03acf68cbb620073e801ee2f57aaacb61d9cd26782a0

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