Git Product home page Git Product logo

aoc_python_template's Introduction

Advent of code Python template

Python package template demonstrating TDD in Python package format for Advent of Code

Getting set up

  1. Please clone this repo or fork it to your own github account.
  2. Install pytest with your chosen python package manager.

How to use this template

Set up the test

  1. Put the test data as a .txt file in the test_data folder.
  2. Create a tests/test_day_{day}.py file and write your test.
  3. Create a day_{day}.py file and write your function.
  4. Run your test by running pytest tests in your terminal. It is normal and ok to fail the test at first!

Work on your solution

  1. Work on improving your function and run your test till your functon works.
  2. Once it passes the test, create your real data file in the real_data folder. Copy and paste your data from the aoc website.
  3. Run your function with the full data by uncommenting the lines.
  4. Put your answer into the AOC website - hopefully you've got your star! โญ

(optional) Fancy API way of getting the real data

  1. Get your Session cookie from the advent of code website! instructions here
  2. Rename the .envEXAMPLE file to .env
  3. Replace the cookiegoeshere text from the .env file with your Session cookie!
  4. Now, you should be able to pull the input data file directly from the AOC website without needing to copy and paste it into a .txt file.

Other optional stretch goals

Implement Continuous Integration using github actions so that your tests automatically run when you push to main!

aoc_python_template's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.