https://github.com/gahjelle/template-aoc-python

Copier template for solving Advent of Code puzzles with Python

https://github.com/gahjelle/template-aoc-python

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.0%) to scientific vocabulary

Keywords

advent-of-code copier-template
Last synced: 5 months ago · JSON representation

Repository

Copier template for solving Advent of Code puzzles with Python

Basic Info
  • Host: GitHub
  • Owner: gahjelle
  • License: mit
  • Language: Jinja
  • Default Branch: main
  • Homepage:
  • Size: 14.6 KB
Statistics
  • Stars: 13
  • Watchers: 1
  • Forks: 12
  • Open Issues: 0
  • Releases: 0
Topics
advent-of-code copier-template
Created over 4 years ago · Last pushed about 1 year ago
Metadata Files
Readme License

README.md

Advent of Code Python Template for Copier

This template creates scaffolding for one day of Advent of Code. It includes tests and can download your personal input data if you have advent-of-code-data installed.

Note: You need at least version 6 of Copier to use this template.

Note: Version 8 of Copier changed how to work with subcommands. The commands below assume that you're running Copier v8.1.0 or higher.

Quick Start

The first time you use this template you should make sure that you have Copier installed and optionally advent-of-code-data as well. You can install these with pipx and pip:

console $ pipx install copier $ python -m pip install advent-of-code-data

Note that advent-of-code-data requires a small bit of setup where you find and specify your personal Advent of Code session ID. Once you have Copier on your system, you can create Advent of Code solution templates as follows:

console $ copier copy --trust gh:gahjelle/template-aoc-python advent_of_code/

The copy command will copy files from the template. The --trust flag is needed to run the script that downloads your personal data.

This will ask you about which year and day you want to template. You can also provide a puzzle name which will be used as part of the directory name and the comments within your files.

The files are copied into a subdirectory of the advent_of_code/ directory on your computer. You can change advent_of_code/ to any other name you want.

Scripting

You can also use Copier as part of a script. The documentation shows how to call Copier as part of a Python script.

On the command line, you can use -d to provide answers to questions instead of answering them interactively. On Bash (and possibly other shells), the following will set up all directories for the 2023 event inside of your aoc/ directory:

```console $ for day in {01..25}; do

copier copy --trust gh:gahjelle/template-aoc-python -d year=2023 -d day=$day -d puzzle_name="" -d puzzle_dir=$day aoc/

done ```

If you're using Powershell on Windows, you can use something like this instead:

for ($day = 1; $day -le 25; $day++) { $day_str = "{0:00}" -f $day copier copy --trust gh:gahjelle/template-aoc-python -d year=2023 -d day=$day_str -d puzzle_name="" -d puzzle_dir=$day_str aoc/ }

After running this, you'll have 25 subdirectories within aoc/2023/ with templates for solving each day of Advent of Code with Python.

Examples

See https://github.com/gahjelle/adventofcode/tree/main/python for examples using the template. My tutorial, Advent of Code: Solving Your Puzzles With Python, explains the reasoning behind the template and shows a few examples of using it to solve puzzles.

Credits

Thanks to Matt Gregory for helping to debug this recipe for Windows and creating the Powershell script to create a full year of templates.

And a huge thanks to Eric Wastl for creating the wonderful Advent of Code.

Owner

  • Name: Geir Arne Hjelle
  • Login: gahjelle
  • Kind: user
  • Location: Oslo, Norway
  • Company: @realpython

GitHub Events

Total
  • Watch event: 4
  • Push event: 2
  • Fork event: 2
Last Year
  • Watch event: 4
  • Push event: 2
  • Fork event: 2

Issues and Pull Requests

Last synced: 7 months ago

All Time
  • Total issues: 3
  • Total pull requests: 8
  • Average time to close issues: 8 months
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 3.33
  • Average comments per pull request: 0.25
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • psycho-baller (1)
  • gahjelle (1)
  • grovduck (1)
Pull Request Authors
  • gahjelle (4)
  • nuhman (1)
Top Labels
Issue Labels
Pull Request Labels