Skip to content

Commit 0bcc18c

Browse files
committed
Update the README.md
1 parent eb50cfd commit 0bcc18c

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

README.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,18 @@
88
---
99

1010
Solutions for Advent of Code in Python
11+
## Installation
12+
13+
This project comes as a standalone python package with a CLI tool to help you with boilerplate code and basic tasks.
14+
Recommended way to use it is via pipx or uvx:
15+
16+
```sh
17+
pipx run --spec aoc-python-cli aoccli
18+
```
19+
or
20+
```sh
21+
uvx --from aoc-python-cli aoccli
22+
```
1123

1224
## Use this project as a template
1325

@@ -28,9 +40,32 @@ code and basic tasks like creating a directory for a new day, running tests, etc
2840
```sh
2941
aoc new-day <day>
3042
```
31-
It will create a `src/aoc/day_<day>` directory with a `__init__.py` and a `test_solution.py` python files.
43+
It will create a `aoc_solutions/<year>/day_<day>` directory with a `__init__.py` and a `test_solution.py` python files.
3244
It will also create text files for both test and real data in the `data/` directory.
3345

46+
You can specify custom data and solutions directories with `---data-directory` and `--directory` flags.
47+
```sh
48+
aoccli new-day --data-directory input_data -d advent_solutions 1
49+
```
50+
This command will create the following directory structure relatively to the current working directory:
51+
```
52+
input_data
53+
└── <current_year>
54+
├── 01_input.txt
55+
└── 01_test_input.txt
56+
aoc_solutions
57+
└── <current_year>
58+
└── day_05
59+
├── __init__.py
60+
└── test_solution.py
61+
```
62+
63+
> [!NOTE]
64+
> Alternatively you can provide a path to template directory `aoc new-day <day> -t /path/to/template/directory` that will be copied to the new day directory.
65+
> This can be useful if you already have a template for your solutions. However, by using this option you will
66+
> lose the ability to run, verify, and submit a challenge from the CLI tool.
67+
68+
3469
#### NEW! Downloading input data
3570

3671
Now this template uses [advent-of-code-data](https://github.com/wimglenn/advent-of-code-data) package to download
@@ -55,7 +90,7 @@ Day 0 - Part 1: 1
5590
Day 0 - Part 2: 55
5691
```
5792

58-
This command will run the solution for the given day using `data/00_input.txt` file and print the answers
93+
This command will run the solution for the given day using `data/<year>/00_input.txt` file and print the answers
5994
for both parts.
6095

6196
If you want to see the result only for the test data, you can use the `-t/--test-data` flag.
@@ -80,7 +115,8 @@ Day 0 - Part 2: 33
80115
You can verify your solution by running [pytest](https://github.com/pytest-dev/pytest) tests.
81116
There is a generic test case for each day that checks both parts of a solution against the correct answer.
82117
To use it you need to configure correct answers on the test class for a given day.
83-
118+
command will run the solution for the given day using `data/00_input.txt` file and print the answers
119+
for both parts.
84120
```python
85121
class TestChallenge(BaseTestChallenge):
86122
challenge_class = Challenge
@@ -113,7 +149,7 @@ If you don't like the idea of running tests manually, there is a pre-installed [
113149
package that will run tests for you after each change in the code.
114150

115151
```sh
116-
ptw src/aoc
152+
ptw aoc_solutions
117153
```
118154

119155
### Submitting solution

src/aoc/main.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
import typing
44
from datetime import datetime
55
from pathlib import Path
6-
from typing import Annotated, Literal
6+
from typing import Annotated, Literal, TypeGuard
77

88
import aocd
99
import pytest
1010
import typer
1111
from aocd import AocdError
1212
from aocd.exceptions import PuzzleLockedError
1313
from aocd.models import Puzzle
14-
from mypy.nodes import TypeGuard
1514

1615
from aoc.input_providers import SingleFileInputProvider, SmartFileInputProvider
1716

0 commit comments

Comments
 (0)