Skip to content

Commit

Permalink
chore: rich added to py deps; day 15 scaffolded
Browse files Browse the repository at this point in the history
  • Loading branch information
GriceTurrble committed Dec 15, 2024
1 parent 8766c0f commit 283f185
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 3 deletions.
Empty file added 2024/inputs/day15.txt
Empty file.
Empty file.
12 changes: 9 additions & 3 deletions 2024/python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ version = "2024.12.1"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = [ "click>=8.1.7", "httpx>=0.28.1", "toml>=0.10.2",]
dependencies = [
"click>=8.1.7",
"httpx>=0.28.1",
"rich>=13.9.4",
"toml>=0.10.2",
]
[[project.authors]]
name = "Galen Rice"
email = "[email protected]"

[dependency-groups]
dev = [ "pytest>=8.3.4",]
dev = ["pytest>=8.3.4"]

[build-system]
requires = [ "hatchling",]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project.scripts]
Expand All @@ -32,6 +37,7 @@ day11 = "grice_py_aoc_2024.day11.main:main"
day12 = "grice_py_aoc_2024.day12.main:main"
day13 = "grice_py_aoc_2024.day13.main:main"
day14 = "grice_py_aoc_2024.day14.main:main"
day15 = "grice_py_aoc_2024.day15.main:main"

[tool.pytest.ini_options]
addopts = "-ra -q"
Empty file.
37 changes: 37 additions & 0 deletions 2024/python/src/grice_py_aoc_2024/day15/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
from __future__ import annotations

import time
from pathlib import Path

DIR = Path(__file__).parent
FILE = DIR.parents[3] / "inputs" / f"{DIR.stem}.txt"


def part1(contents: str) -> int:
total = 0
# TODO part 1
return total


def part2(contents: str) -> int:
total = 0
# TODO part 2
return total


def main():
contents = FILE.read_text()

_start1 = time.perf_counter()
result1 = part1(contents=contents)
_delta1 = time.perf_counter() - _start1
print(f">> Part 1: {result1} ({_delta1:.6f}s)")

_start2 = time.perf_counter()
result2 = part2(contents=contents)
_delta2 = time.perf_counter() - _start2
print(f">> Part 2: {result2} ({_delta2:.6f}s)")


if __name__ == "__main__":
main()
26 changes: 26 additions & 0 deletions 2024/python/src/grice_py_aoc_2024/day15/test_day15.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
from __future__ import annotations

from pathlib import Path

import pytest

from .main import part1, part2

DIR = Path(__file__).parent
TEST_FILE = DIR.parents[3] / "inputs/tests" / f"test_{DIR.stem}.txt"
EXPECTED_PART_1 = 123 # TODO replace!
EXPECTED_PART_2 = 456 # TODO replace!


@pytest.mark.skip(reason=f"{DIR.stem} P1 incomplete")
def test_part1():
contents = TEST_FILE.read_text()
result = part1(contents=contents)
assert result == EXPECTED_PART_1


@pytest.mark.skip(reason=f"{DIR.stem} P2 incomplete")
def test_part2():
contents = TEST_FILE.read_text()
result = part2(contents=contents)
assert result == EXPECTED_PART_2
45 changes: 45 additions & 0 deletions 2024/python/uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 283f185

Please sign in to comment.