Skip to content

Commit 283f185

Browse files
committed
chore: rich added to py deps; day 15 scaffolded
1 parent 8766c0f commit 283f185

File tree

7 files changed

+117
-3
lines changed

7 files changed

+117
-3
lines changed

2024/inputs/day15.txt

Whitespace-only changes.

2024/inputs/tests/test_day15.txt

Whitespace-only changes.

2024/python/pyproject.toml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ version = "2024.12.1"
44
description = "Add your description here"
55
readme = "README.md"
66
requires-python = ">=3.13"
7-
dependencies = [ "click>=8.1.7", "httpx>=0.28.1", "toml>=0.10.2",]
7+
dependencies = [
8+
"click>=8.1.7",
9+
"httpx>=0.28.1",
10+
"rich>=13.9.4",
11+
"toml>=0.10.2",
12+
]
813
[[project.authors]]
914
name = "Galen Rice"
1015
1116

1217
[dependency-groups]
13-
dev = [ "pytest>=8.3.4",]
18+
dev = ["pytest>=8.3.4"]
1419

1520
[build-system]
16-
requires = [ "hatchling",]
21+
requires = ["hatchling"]
1722
build-backend = "hatchling.build"
1823

1924
[project.scripts]
@@ -32,6 +37,7 @@ day11 = "grice_py_aoc_2024.day11.main:main"
3237
day12 = "grice_py_aoc_2024.day12.main:main"
3338
day13 = "grice_py_aoc_2024.day13.main:main"
3439
day14 = "grice_py_aoc_2024.day14.main:main"
40+
day15 = "grice_py_aoc_2024.day15.main:main"
3541

3642
[tool.pytest.ini_options]
3743
addopts = "-ra -q"

2024/python/src/grice_py_aoc_2024/day15/__init__.py

Whitespace-only changes.
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
from __future__ import annotations
2+
3+
import time
4+
from pathlib import Path
5+
6+
DIR = Path(__file__).parent
7+
FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt"
8+
9+
10+
def part1(contents: str) -> int:
11+
total = 0
12+
# TODO part 1
13+
return total
14+
15+
16+
def part2(contents: str) -> int:
17+
total = 0
18+
# TODO part 2
19+
return total
20+
21+
22+
def main():
23+
contents = FILE.read_text()
24+
25+
_start1 = time.perf_counter()
26+
result1 = part1(contents=contents)
27+
_delta1 = time.perf_counter() - _start1
28+
print(f">> Part 1: {result1} ({_delta1:.6f}s)")
29+
30+
_start2 = time.perf_counter()
31+
result2 = part2(contents=contents)
32+
_delta2 = time.perf_counter() - _start2
33+
print(f">> Part 2: {result2} ({_delta2:.6f}s)")
34+
35+
36+
if __name__ == "__main__":
37+
main()
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
from __future__ import annotations
2+
3+
from pathlib import Path
4+
5+
import pytest
6+
7+
from .main import part1, part2
8+
9+
DIR = Path(__file__).parent
10+
TEST_FILE = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}.txt"
11+
EXPECTED_PART_1 = 123 # TODO replace!
12+
EXPECTED_PART_2 = 456 # TODO replace!
13+
14+
15+
@pytest.mark.skip(reason=f"{DIR.stem} P1 incomplete")
16+
def test_part1():
17+
contents = TEST_FILE.read_text()
18+
result = part1(contents=contents)
19+
assert result == EXPECTED_PART_1
20+
21+
22+
@pytest.mark.skip(reason=f"{DIR.stem} P2 incomplete")
23+
def test_part2():
24+
contents = TEST_FILE.read_text()
25+
result = part2(contents=contents)
26+
assert result == EXPECTED_PART_2

2024/python/uv.lock

Lines changed: 45 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)