1
1
# advent-of-code
2
2
3
+ ## Running
4
+
3
5
To run the problem for a day, run the Python module like
4
6
5
7
``` sh
6
- python -m y2020.problem01
8
+ poetry run python -m y2020.problem01
7
9
```
8
10
11
+ The solution code generally has no dependencies outside of the standard library
12
+ but for tests, formatting etc I'm using [ poetry] ( https://python-poetry.org/ ) to
13
+ manage dependencies.
14
+
15
+ ## Setting up new problem
16
+
9
17
To generate code for a new problem/day from a template, run:
10
18
11
19
``` sh
@@ -14,8 +22,10 @@ To generate code for a new problem/day from a template, run:
14
22
15
23
This will create files in a directory named ` y$YEAR/$DAY ` .
16
24
25
+ ## Tests
26
+
17
27
Run the tests (yes I wrote tests) with ` tox ` or ` pytest ` or to run them for just
18
- one problem, ` pytest <year>/<directory> ` .
28
+ one problem, ` poetry run pytest <year>/<directory>` .
19
29
20
30
Install the pre-commit hooks to keep the code nicely formatted via
21
31
[ pre-commit] ( https://pre-commit.com/ ) with ` pre-commit install ` .
@@ -26,9 +36,3 @@ To benchmark one of the modules with `timeit`, can run something like:
26
36
python -m timeit -s ' import y2021.problem15; inp = open("y2021/problem15/input").read(-1).strip()' ' y2021.problem15.part1(inp)'
27
37
1 loop, best of 5: 938 msec per loop
28
38
```
29
-
30
- The ` requirements.txt ` file is generated with pip-compile from [ pip-tools] ( https://pip-tools.readthedocs.io/en/latest/ ) . To re-compile:
31
-
32
- ```
33
- pip-compile --no-emit-index-url > requirements.txt
34
- ```
0 commit comments