Python template for Advent of Code event

Overview

Advent of Code Python Starter

A tamplate for Advent of Code write in Python.

Usage

The project use poetry for project manager. Clone this repository and run poetry install for install dependencies:

$ git clone https://github.com/ljgago/advent-of-code-python-starter aoc-python
$ cd aoc-python

# install dependencies
$ poetry install

# run tests from day01
$ poetry run pytest tests/test_day01.py

# run the day01
# poetry run python -m aoc.day01

Generate

You can generate all necesary files for use in the event with a simple command:

$ poetry run python -m aoc.gen day01

This command generate these files:

* creating /aoc/day01/resources/input.txt
* creating /aoc/day01/__main__.py
* creating /aoc/day01/part1.py
* creating /aoc/day01/part2.py
* creating /aoc/day01/README.md
* creating /tests/test_day01.py
  • /aoc/day01/resources/input.txt: you can insert here the input data.
  • /aoc/day01/__main__.py: is the main module.
  • /aoc/day01/part1.py: solution for part 1.
  • /aoc/day01/part2.py: solution for part 2.
  • /aoc/day01/README.md: you can write the challenge statement.
  • /tests/test_day01.py: is the module where you write the tests.

Config

You can configure the automatic input download from the Advent of Code session token.

For dowload the inputs from web, you needs to set the environment var AOC_SESSION. You can to get the session token from the cookie web browser.

Also can you set the AOC_YEAR to select a certain year. (It is not mandatory use the AOC_YEAR, aoc.gen can get the year automatically)

You can set an .env file with these variables.

Note: You can avoid the generation of the folder __pycache__ set this environment variable export PYTHONDONTWRITEBYTECODE=1 o pass the -B flag after python command.

Folder structure:

├── aoc
│   └── day01
│       ├── __main__.py
│       ├── part1.py
│       ├── part2.py
│       ├── README.md
│       └── resources
│           └── input.txt
└── tests
    ├── conftest.py
    └── test_day01.py

Happy coding!

MIT License

You might also like...
Jack Morgan's Advent of Code Solutions

Advent-of-Code Jack Morgan's Advent of Code Solutions Usage Run . initiate.sh year day To initiate a day. This sets up a template python file, and pul

A custom advent of code I am completing

advent-of-code-custom A custom advent of code I am doing in python. The link to the problems I am solving is here: https://github.com/seldoncode/Adven

Advent of Code 2021 challenges

Data analysis Document here the project: AoC21 Description: Project Description Data Source: Type of analysis: Please document the project the better

An Advent calendar of small programming puzzles for a variety of skill sets and skill levels.

Advent of Code 2021 The Advent of Code is an Advent calendar of small programming puzzles for a variety of skill sets and skill levels that can be sol

A Python script made for the Python Discord Pixels event.

Python Discord Pixels A Python script made for the Python Discord Pixels event. Usage Create an image.png RGBA image with your pattern. Transparent pi

A fast Python in-process signal/event dispatching system.

Blinker Blinker provides a fast dispatching system that allows any number of interested parties to subscribe to events, or "signals". Signal receivers

Automate your Microsoft Learn Student Ambassadors event certificate with Python

Microsoft Learn Student Ambassador Certificate Automation This repo simply use a template certificate docx file and generates certificates both docx a

A bot to use in a pump & dump event
A bot to use in a pump & dump event

A bot to use in a pump & dump event on Binance.com. Please note the bot is in heavy devleopment currently so be aware of errors. If you experience err

Web app for keeping track of buildings in danger of collapsing in the event of an earthquake

Bulina Roșie 🇷🇴 Un cutremur în București nu este o situație ipotetică. Este o certitudine că acest lucru se va întâmpla. În acest context, la mai bi

Comments
Owner
Leonardo Gago
Electronic Engineer && Software Development
Leonardo Gago
Solutions for the Advent of Code 2021 event.

About ?? This repository holds all of the solution code for the Advent of Code 2021 event. All solutions are done in Python 3.9.9 and done in non-real

robert yin 0 Mar 21, 2022
All solutions for the 2021 Advent of Code event.

Advent of Code 2021 Solutions All solutions for the 2021 Advent of Code event. Setup Create a file called .session. Go to adventofcode.com and copy th

Bruce Berrios 6 Dec 26, 2021
My solutions to Advent of Code 2021 (written in Python)

Advent of Code 2021 This repository contains my solutions for the 2021 edition of Advent of Code. Please do not expect perfectly polished solutions, m

Nils 2 May 29, 2022
Python solution of advent-of-code 2021

Advent of code 2021 Python solutions of Advent of Code 2021 written by Eric Bouteillon Requirements The solutions were developed and tested using Pyth

Eric Bouteillon 3 Oct 25, 2022
These are my solutions to Advent of Code problems.

Advent of Code These are my solutions to Advent of Code problems. If you want to join my leaderboard, the code is 540750-9589f56d. When I solve for sp

Sumner Evans 5 Dec 19, 2022
My solutions for Advent of Code 2021 🌟🎄

?? Advent of Code 2021 ?? My solutions for Advent of Code 2021. About · What is Advent of Code? · Contents · Usage · Table of puzzles (TODO: add final

Amanda P. Pinha 2 Dec 5, 2022
This repository contains each day of Advent of Code 2021 that I've done.

Advent of Code - 2021 I will use this repository as my Advent of Code1 (AoC) repo for the 2021 challenge. I'm changing how I am tackling the problems

Brett Chapin 2 Jan 12, 2022
My repository for the Advent of Code, starting from 2021

Advent of Code This is my repository for the Advent of Code (https://adventofcode.com/), starting from 2021. File Structure Inside each year folder, s

Yu-Ting 6 Dec 15, 2021
A collection of convenient parsers for Advent of Code problems.

Advent of Code Parsers A collection of convenient Python parsers for Advent of Code problems. Installation pip install aocp Quickstart You can import

Miguel Blanco Marcos 3 Dec 13, 2021
My attempt at this years Advent of Code!

Advent-of-code-2021 My attempt at this years Advent of Code! day 1: ** day 2: ** day 3: ** day 4: ** day 5: ** day 6: ** day 7: ** day 8: * day 9: day

null 1 Jul 6, 2022