[py] Set up similar to rust
This commit is contained in:
parent
c9f4e45469
commit
04deaca668
3 changed files with 40 additions and 0 deletions
3
py/.gitignore
vendored
Normal file
3
py/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
__pycache__
|
||||
/.venv
|
||||
*.egg-info
|
||||
27
py/aoc/__init__.py
Normal file
27
py/aoc/__init__.py
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import sys
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
DAYS = {}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("files", type=Path, nargs="+")
|
||||
args = parser.parse_args()
|
||||
|
||||
first_day = True
|
||||
for file in args.files:
|
||||
if not first_day:
|
||||
print()
|
||||
first_day = False
|
||||
|
||||
day = DAYS.get(file.stem)
|
||||
if day is None:
|
||||
print(f"### Could not determine day: {file}", file=sys.stderr)
|
||||
continue
|
||||
|
||||
print(f"### Solving day {file.stem}")
|
||||
with open(file) as f:
|
||||
inputstr = f.read()
|
||||
day(inputstr)
|
||||
10
py/pyproject.toml
Normal file
10
py/pyproject.toml
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
[build-system]
|
||||
requires = ["setuptools"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[project]
|
||||
name = "aoc-py"
|
||||
version = "0.0.0"
|
||||
|
||||
[project.scripts]
|
||||
aoc-py = "aoc:main"
|
||||
Loading…
Add table
Add a link
Reference in a new issue