Skip to content

Commit 0db0907

Browse files
authored
Merge pull request #165 from GriceTurrble/feat/2024-scaffold-day8
Feat/2024-scaffold-day8
2 parents 4a78bd9 + fb59d1b commit 0db0907

File tree

11 files changed

+108
-16
lines changed

11 files changed

+108
-16
lines changed

2024/Justfile renamed to 2024/2024.just

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,8 @@ mod py 'python/py.just'
66
# Show these help docs
77
help:
88
@just --list --unsorted --justfile {{ source_file() }}
9+
10+
11+
# Add new day for solutions in all configured languages
12+
new-day DAY:
13+
@just y2024::py::new-day {{DAY}}

2024/inputs/day08.txt

Whitespace-only changes.

2024/inputs/tests/test_day08.txt

Whitespace-only changes.

2024/python/py.just

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
help:
55
@just --list --unsorted --justfile {{ source_file() }}
66

7-
# Generate files for a new day
7+
8+
# Add new day for Python solutions
89
new-day DAY:
910
uv run cli create-day {{DAY}}

2024/python/pyproject.toml

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

1712
[dependency-groups]
18-
dev = ["pytest>=8.3.4"]
13+
dev = [ "pytest>=8.3.4",]
1914

2015
[build-system]
21-
requires = ["hatchling"]
16+
requires = [ "hatchling",]
2217
build-backend = "hatchling.build"
2318

2419
[project.scripts]
@@ -30,6 +25,7 @@ day04 = "grice_py_aoc_2024.day04.main:main"
3025
day05 = "grice_py_aoc_2024.day05.main:main"
3126
day06 = "grice_py_aoc_2024.day06.main:main"
3227
day07 = "grice_py_aoc_2024.day07.main:main"
28+
day08 = "grice_py_aoc_2024.day08.main:main"
3329

3430
[tool.pytest.ini_options]
35-
addopts = "--verbose"
31+
addopts = "-ra -q"

2024/python/src/grice_py_aoc_2024/day06/test_day06.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,17 @@
88

99
DIR = Path(__file__).parent
1010
TEST_FILE = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}.txt"
11-
EXPECTED_PART_1 = "Now it's done!"
12-
EXPECTED_PART_2 = "Now it's done!"
11+
EXPECTED_PART_1 = "REPLACE ME!"
12+
EXPECTED_PART_2 = "REPLACE ME!"
1313

1414

15-
@pytest.mark.skip("Skipped day 6")
1615
def test_part1():
1716
contents = TEST_FILE.read_text()
1817
result = part1(contents)
1918
assert result == EXPECTED_PART_1
2019

2120

22-
@pytest.mark.skip("Skipped day 6")
21+
@pytest.mark.xfail(reason=f"{DIR.stem} P1 incomplete")
2322
def test_part2():
2423
contents = TEST_FILE.read_text()
2524
result = part2(contents)

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

Whitespace-only changes.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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):
11+
return "Not done yet!"
12+
13+
14+
def part2(contents: str):
15+
return "Not done yet!"
16+
17+
18+
def main():
19+
contents = FILE.read_text()
20+
21+
_start1 = time.perf_counter()
22+
result1 = part1(contents)
23+
_delta1 = time.perf_counter() - _start1
24+
print(f">> Part 1: {result1} ({_delta1:.6f}s)")
25+
26+
_start2 = time.perf_counter()
27+
result2 = part2(contents)
28+
_delta2 = time.perf_counter() - _start2
29+
print(f">> Part 2: {result2} ({_delta2:.6f}s)")
30+
31+
32+
if __name__ == "__main__":
33+
main()
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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 = "REPLACE ME!"
12+
EXPECTED_PART_2 = "REPLACE ME!"
13+
14+
15+
def test_part1():
16+
contents = TEST_FILE.read_text()
17+
result = part1(contents)
18+
assert result == EXPECTED_PART_1
19+
20+
21+
@pytest.mark.xfail(reason=f"{DIR.stem} P1 incomplete")
22+
def test_part2():
23+
contents = TEST_FILE.read_text()
24+
result = part2(contents)
25+
assert result == EXPECTED_PART_2

2024/python/src/grice_py_aoc_2024/templates/test_day.py-tpl

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@ from __future__ import annotations
22

33
from pathlib import Path
44

5+
import pytest
6+
57
from .main import part1, part2
68

79
DIR = Path(__file__).parent
810
TEST_FILE = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}.txt"
9-
EXPECTED_PART_1 = "Now it's done!"
10-
EXPECTED_PART_2 = "Now it's done!"
11+
EXPECTED_PART_1 = "REPLACE ME!"
12+
EXPECTED_PART_2 = "REPLACE ME!"
1113

1214

1315
def test_part1():
@@ -16,6 +18,7 @@ def test_part1():
1618
assert result == EXPECTED_PART_1
1719

1820

21+
@pytest.mark.xfail(reason=f"{DIR.stem} P1 incomplete")
1922
def test_part2():
2023
contents = TEST_FILE.read_text()
2124
result = part2(contents)

0 commit comments

Comments
 (0)