Copier template for solving Advent of Code puzzles with Python

Overview

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.

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:

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

Once you have Copier on your system, you can create Advent of Code solution templates as follows:

$ copier https://github.com/gahjelle/template-aoc-python advent_of_code

This will ask you about which year and day you want to template. The files are copied into a subdirectory of the advent_of_code directory on your computer.

You might also like...
Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run First add src to PYTHONPATH: export PYTHONPATH=${PWD} Then run: pyt

Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

Template to create a telegram bot in python

Template for Telegram Bot Template to create a telegram bot in python. How to Run Set your telegram bot token as environment variable TELEGRAM_BOT_TOK

Satoshi is a discord bot template in python using discord.py that allow you to track some live crypto prices with your own discord bot.

Satoshi ~ DiscordCryptoBot Satoshi is a simple python discord bot using discord.py that allow you to track your favorites cryptos prices with your own

Python Telegram Bot Template

Python Telegram Bot Template Concepts Customizable python-telegram-bot template implementing code refactoring to streamline development process: handl

Project template for using aws-cdk, Chalice and React in concert, including RDS Postgresql and AWS Cognito

What is This? This repository is an opinonated project template for using aws-cdk, Chalice and React in concert. Where aws-cdk and Chalice are in Pyth

A SageMaker Projects template to deploy a model from Model Registry, choosing your preferred method of deployment among async (Asynchronous Inference), batch (Batch Transform), realtime (Real-time Inference Endpoint). More to be added soon! CloudFormation template and CDK stack that contains a CustomResource with Lambda function to allow the setting of the targetAccountIds attribute of the EC2 Image Builder AMI distribution settings which is not currently supported (as of October 2021) in CloudFormation or CDK.
Comments
  • Invalid character in Windows template filenames

    Invalid character in Windows template filenames

    Great idea and really cool tutorial - thanks so much for this.

    When I try to use this template on Windows using copier, I'm getting the following error:

    C:\Users\gregorma\Desktop>copier gh:gahjelle/template-aoc-python foo2
    Traceback (most recent call last):
      File "C:\Python39\lib\runpy.py", line 197, in _run_module_as_main
        return _run_code(code, main_globals, None,
      File "C:\Python39\lib\runpy.py", line 87, in _run_code
        exec(code, run_globals)
      File "C:\Users\gregorma\.local\bin\copier.exe\__main__.py", line 7, in <module>
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\cli\application.py", line 629, in run
        inst, retcode = subapp.run(argv, exit=False)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\cli\application.py", line 624, in run
        retcode = inst.main(*tailargs)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\copier\cli.py", line 38, in _wrapper
        return method(*args, **kwargs)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\copier\cli.py", line 252, in main
        self.parent._copy(template_src, destination_path)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\copier\cli.py", line 173, in _copy
        return copy(
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\copier\main.py", line 133, in copy
        conf = make_config(**locals())
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\copier\config\factory.py", line 96, in make_config
        src_path = vcs.clone(repo, vcs_ref or "HEAD")
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\copier\vcs.py", line 92, in clone
        git("checkout", ref)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\commands\base.py", line 99, in __call__
        return self.run(args, **kwargs)[1]
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\commands\base.py", line 240, in run
        return p.run()
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\commands\base.py", line 201, in runner
        return run_proc(p, retcode, timeout)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\commands\processes.py", line 322, in run_proc
        return _check_process(proc, retcode, timeout, stdout, stderr)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\commands\processes.py", line 24, in _check_process
        proc.verify(retcode, timeout, stdout, stderr)
      File "C:\Users\gregorma\.local\pipx\venvs\copier\lib\site-packages\plumbum\machines\base.py", line 28, in verify
        raise ProcessExecutionError(
    plumbum.commands.processes.ProcessExecutionError: Unexpected exit code: 1
    Command line: | 'C:\Program Files\Git\cmd\git.exe' checkout HEAD
    Stderr:       | error: invalid path 'src/[[year]]/[[puzzle_dir]]/aoc[[year]][['%02d'|format(day)]].py.tmpl'
                  | error: invalid path 'src/[[year]]/[[puzzle_dir]]/test_aoc[[year]][['%02d'|format(day)]].py.tmpl'
    

    From what I can tell, it doesn't accept the pipe character as a valid character in a Windows filename (although I'm not totally sure of this). If I replace [['%02d'|format(day)]] with [[formatted_day]] and put an entry for [[formatted_day]] in the copier.yml file, it seems to work fine. Here's an example of that: https://github.com/grovduck/test-template.

    Please let me know if I'm doing something incorrectly - it's my first time using copier!

    opened by grovduck 9
  • Remove pipes in filenames again

    Remove pipes in filenames again

    The upgrade to Copier v6 reintroduced pipes in filenames. As reported in #1 , pipes in filenames don't work on Windows.

    This patch uses the %-style syntax instead of pipes.

    Fixes #1

    opened by gahjelle 0
  • unable to run script

    unable to run script

    I have downloaded the required softwares but when in trying to copy the template i get this error:

    rami@Ramis-MacBook-Pro ~ % copier gh:gahjelle/template-aoc-python advent_of_code/
    No git tags found in template; using HEAD as ref
    🎤 year (int)
       2022
    🎤 day (int)
       1
    🎤 puzzle_name
     
    🎤 puzzle_dir
       01
    
    Copying from template version 0.0.0.post12.dev0+f01620b
        create  .
        create  2022
        create  2022/01
        create  2022/01/example1.txt
        create  2022/01/example2.txt
        create  2022/01/aoc202201.py
        create  2022/01/test_aoc202201.py
        create  download_input.py
    
     > Running task 1 of 1: python ./download_input.py 2022 1
    /bin/sh: python: command not found
    Traceback (most recent call last):
      File "/Users/rami/Library/Python/3.9/bin/copier", line 8, in <module>
        sys.exit(CopierApp.run())
      File "/Users/rami/Library/Python/3.9/lib/python/site-packages/plumbum/cli/application.py", line 639, in run
        inst, retcode = subapp.run(argv, exit=False)
      File "/Users/rami/Library/Python/3.9/lib/python/site-packages/plumbum/cli/application.py", line 634, in run
        retcode = inst.main(*tailargs)
      File "/Users/rami/Library/Python/3.9/lib/python/site-packages/copier/cli.py", line 71, in _wrapper
        return method(*args, **kwargs)
      File "/Users/rami/Library/Python/3.9/lib/python/site-packages/copier/cli.py", line 294, in main
        self.parent._worker(
      File "/Users/rami/Library/Python/3.9/lib/python/site-packages/copier/main.py", line 632, in run_copy
        self._execute_tasks(self.template.tasks)
      File "/Users/rami/Library/Python/3.9/lib/python/site-packages/copier/main.py", line 214, in _execute_tasks
        subprocess.run(task_cmd, shell=use_shell, check=True, env=local.env)
      File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
        raise CalledProcessError(retcode, process.args,
    subprocess.CalledProcessError: Command 'python ./download_input.py 2022 1' returned non-zero exit status 127.
    
    opened by psycho-baller 1
Owner
Geir Arne Hjelle
Geir Arne Hjelle
Discord bot to display private leaderboards for Advent of Code.

Advent Of Code Discord Bot Discord bot for displaying Advent of Code private leardboards, as well as custom leaderboards where participants can set th

The Future Gadgets Lab 6 Nov 29, 2022
A GitHub Action that automatically reports your Advent of Code progress in a table in your README

Advent README Stars This action adds and maintains a stars report in your README based on your Advent of Code progress. Example Table 2021 Results Day

Kevin Duff 36 Dec 30, 2022
Discord.py-Bot-Template - Discord Bot Template with Python 3.x

Discord Bot Template with Python 3.x This is a template for creating a custom Di

Keagan Landfried 3 Jul 17, 2022
Pincer-bot-template - A template for a Discord bot created using the Pincer library

Pincer Discord Bot Template (Python) WARNING: Pincer is still in its alpha/plann

binds 2 Mar 17, 2022
OGE-2022-na-Python - Solving problems in python for the OGE 2022

OGE-2022-na-Python Решение задачек на питоне для ОГЭ 2022 Тут разобраны разные в

Slava 0 Oct 14, 2022
A Telegram Bot which will ask new Group Members to verify them by solving an emoji captcha.

Emoji-Captcha-Bot A Telegram Bot which will ask new Group Members to verify them by solving an emoji captcha. About API: Using api.abirhasan.wtf/captc

Abir Hasan 52 Dec 11, 2022
An hcaptcha-solving discord account generator; capable of randomizing names, profile pictures, and verifying phone numbers.

discord-account-generator An hcaptcha-solving discord account generator; capable of randomizing names, profile pictures, and verifying phone numbers.

Acier 61 Dec 10, 2022
A discord token creator that uses the service capmonster for captcha solving!

Discord Token Creator A discord token creator that uses the service capmonster for captcha solving! Report Bug · Request Feature Features Autojoin dis

dropout 41 Oct 25, 2021
Create Discord Accounts Semi-Automatically Without Captcha Solving API Key

Discord-Account-Generator Create Discord Accounts Semi-Automatically without captcha solving api key IMPORTANT: Your chromedriver version should be th

NotSakshyam 11 Mar 21, 2022
Roblox-Account-Gen - A simple account generator not using paid solving services

Roblox Account Generator Star this if it helped to spread awareness! No 2captcha

x 1 Feb 17, 2022