Python Advent of Code package
Project description
PyAOC
Python Advent of Code package
Author
- Aurélien TRONCY
Description
PyAOC is a Python package that helps you to optimize your Advent of Code solutions. It will take care of folder architecture, input files, benchmarking and more.
List of basic features
Create a day folder
PyAOC can create a folder for a specific day.
To do so, run the following command:
pyaoc --create-day {day_number}
Where {day_number} is the number of the day you want to create.
It will follow the following architecture:
day{day_number}/
├── benchmark/
│ └── benchmark.txt
├── inputs/
│ ├── input.txt
│ └── sample.txt
├── part1.py
└── part2.py
Benchmark file will be used to store the benchmark results of your code. Inputs folder will contain the input.txt file which is the input file given by Advent of Code. You have to paste the content of the input file yourself if you don't configure PyAOC for the advanced features. The sample.txt file is a sample input file that you can use to test your code. Part1.py and part2.py are the files where you will write your code.
For example, a part1 file for day 1 will look like this:
# Description: Day 1 Part 1 of Advent of Code
def solution(textfile: str) -> int:
return 0
textfile is the text content of the input file. You have to write your code in the solution function. The solution function must return an integer. You can create as many functions as you want in the file. You can also create as many files as you want in the day folder.
If the folder already exists, PyAOC will ask you to add the --force flag to overwrite the folder. If you add the --force flag, the content of the folder will be deleted and replaced by the default content.
Run your code
PyAOC can run your code on the input file for a specific day.
To do so, you have to be on the parent folder of the day folder you want to run. Then, run the following command:
pyaoc --run-day {day_number}
Where {day_number} is the number of the day you want to run.
PyAOC will run the part1.py and part2.py files and print the result of each part.
You can also run only one part of the day by adding the --part flag:
pyaoc --run-day {day_number} --part {part_number}
Where {part_number} is the number of the part you want to run.
You can also run the current day folder by using the --run-current flag:
pyaoc --run-current
Time your code
PyAOC can time your code on the input file for a specific day.
To do so, you have to be on the parent folder of the day folder you want to time. Then, run the following command:
pyaoc --run {day_number} --time
Where {day_number} is the number of the day you want to time.
You can combine the --time flag with the --part flag to time only one part of the day:
pyaoc --run {day_number} --time --part {part_number}
Where {part_number} is the number of the part you want to time.
Benchmark
PyAOC can benchmark your code on the input file for a specific day.
To do so, you have to be on the parent folder of the day folder you want to time. Then, run the following command:
pyaoc --benchmark {day_number} {iterations}
Where {day_number} is the number of the day you want to time and {iterations} the number of iterations you want.
Override year
By default, the year parameter is set to the current year if you are in december and the last year otherwise. This is to match the last possible Advent Of Code.
If you want to override the default value you have to add the --year option
pyaoc --year {year}
Where {year} is the number of the year you want.
This is usefull for option like autosubmit, autodownload of the input, ...
For the moment you have to use this option in each command.
Generate README
PyAOC can auto-generate the readme of your project.
To do so, you have to be on the parent folder of all the days folders. Then run the following command:
pyaoc --readme
It will auto-generate the README with benchmark.
Print Version
To print the version of PyAOC, run the following command:
pyaoc --version
Print Help
To print the help of PyAOC, run the following command:
pyaoc --help
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pyaoc-0.0.1.tar.gz
.
File metadata
- Download URL: pyaoc-0.0.1.tar.gz
- Upload date:
- Size: 20.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 08ac4aa7fa892ddf8b23c439ba5d4e2ee6e6443588fac609ce18f16c7d6c143b |
|
MD5 | 6d326b03e99ca0a181a900d4fc15de35 |
|
BLAKE2b-256 | 5e9989d0bd8a6fb84e889806f94874d3c562373376c678a1cdc3432b928e46dd |
File details
Details for the file pyaoc-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: pyaoc-0.0.1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 181c1d968c9616a7e10c191c87812939cb4344e473eefc379ef1fb67487e4702 |
|
MD5 | 84ff4c62fabecda78a849e4c349ec6c6 |
|
BLAKE2b-256 | 3bced0db1ae9a694a16815653c6f591f59b2b982dc6f816a9ed47204c2800c7f |