From ee5eb931a926dfb75dfce455b3bea73b196d77a6 Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Fri, 22 Nov 2024 10:28:10 +0100 Subject: [PATCH] Better project setup, now with a structure UV likes --- 2024/pyproject.toml | 4 +++ 2024/{ => src}/aoc/__init__.py | 0 2024/{ => src}/aoc/__main__.py | 2 +- 2024/{ => src}/aoc/days/__init__.py | 0 2024/{ => src}/aoc/days/day1.py | 0 2024/tests/test_harness.py | 6 ++++ 2024/uv.lock | 46 ++++++++++++++++++++++++++++- 7 files changed, 56 insertions(+), 2 deletions(-) rename 2024/{ => src}/aoc/__init__.py (100%) rename 2024/{ => src}/aoc/__main__.py (97%) rename 2024/{ => src}/aoc/days/__init__.py (100%) rename 2024/{ => src}/aoc/days/day1.py (100%) create mode 100644 2024/tests/test_harness.py diff --git a/2024/pyproject.toml b/2024/pyproject.toml index a0cc789..f3333f8 100644 --- a/2024/pyproject.toml +++ b/2024/pyproject.toml @@ -12,9 +12,13 @@ dependencies = [ [dependency-groups] dev = [ "mypy>=1.13.0", + "pytest>=8.3.3", "ruff>=0.7.3", ] +[tool.uv] +package = true + [tool.ruff.lint] select = ["F", "E", "I"] diff --git a/2024/aoc/__init__.py b/2024/src/aoc/__init__.py similarity index 100% rename from 2024/aoc/__init__.py rename to 2024/src/aoc/__init__.py diff --git a/2024/aoc/__main__.py b/2024/src/aoc/__main__.py similarity index 97% rename from 2024/aoc/__main__.py rename to 2024/src/aoc/__main__.py index c968a50..c5a72d3 100644 --- a/2024/aoc/__main__.py +++ b/2024/src/aoc/__main__.py @@ -3,7 +3,7 @@ import time import click -from . import days +from aoc import days @click.command() diff --git a/2024/aoc/days/__init__.py b/2024/src/aoc/days/__init__.py similarity index 100% rename from 2024/aoc/days/__init__.py rename to 2024/src/aoc/days/__init__.py diff --git a/2024/aoc/days/day1.py b/2024/src/aoc/days/day1.py similarity index 100% rename from 2024/aoc/days/day1.py rename to 2024/src/aoc/days/day1.py diff --git a/2024/tests/test_harness.py b/2024/tests/test_harness.py new file mode 100644 index 0000000..36fafb7 --- /dev/null +++ b/2024/tests/test_harness.py @@ -0,0 +1,6 @@ +from aoc import days + + +def test_harness_works() -> None: + runner = days.get_runner(1) + assert runner is not None diff --git a/2024/uv.lock b/2024/uv.lock index a1999ef..3c62d22 100644 --- a/2024/uv.lock +++ b/2024/uv.lock @@ -4,7 +4,7 @@ requires-python = ">=3.12" [[package]] name = "aoc-2024" version = "0.1.0" -source = { virtual = "." } +source = { editable = "." } dependencies = [ { name = "click" }, { name = "numpy" }, @@ -13,6 +13,7 @@ dependencies = [ [package.dev-dependencies] dev = [ { name = "mypy" }, + { name = "pytest" }, { name = "ruff" }, ] @@ -25,6 +26,7 @@ requires-dist = [ [package.metadata.requires-dev] dev = [ { name = "mypy", specifier = ">=1.13.0" }, + { name = "pytest", specifier = ">=8.3.3" }, { name = "ruff", specifier = ">=0.7.3" }, ] @@ -49,6 +51,15 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/d1/d6/3965ed04c63042e047cb6a3e6ed1a63a35087b6a609aa3a15ed8ac56c221/colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6", size = 25335 }, ] +[[package]] +name = "iniconfig" +version = "2.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d7/4b/cbd8e699e64a6f16ca3a8220661b5f83792b3017d0f79807cb8708d33913/iniconfig-2.0.0.tar.gz", hash = "sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3", size = 4646 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/ef/a6/62565a6e1cf69e10f5727360368e451d4b7f58beeac6173dc9db836a5b46/iniconfig-2.0.0-py3-none-any.whl", hash = "sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374", size = 5892 }, +] + [[package]] name = "mypy" version = "1.13.0" @@ -117,6 +128,39 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/48/6f/129e3c17e3befe7fefdeaa6890f4c4df3f3cf0831aa053802c3862da67aa/numpy-2.1.2-cp313-cp313t-musllinux_1_2_aarch64.whl", hash = "sha256:ef444c57d664d35cac4e18c298c47d7b504c66b17c2ea91312e979fcfbdfb08a", size = 14066202 }, ] +[[package]] +name = "packaging" +version = "24.2" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/d0/63/68dbb6eb2de9cb10ee4c9c14a0148804425e13c4fb20d61cce69f53106da/packaging-24.2.tar.gz", hash = "sha256:c228a6dc5e932d346bc5739379109d49e8853dd8223571c7c5b55260edc0b97f", size = 163950 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/ef/eb23f262cca3c0c4eb7ab1933c3b1f03d021f2c48f54763065b6f0e321be/packaging-24.2-py3-none-any.whl", hash = "sha256:09abb1bccd265c01f4a3aa3f7a7db064b36514d2cba19a2f694fe6150451a759", size = 65451 }, +] + +[[package]] +name = "pluggy" +version = "1.5.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/96/2d/02d4312c973c6050a18b314a5ad0b3210edb65a906f868e31c111dede4a6/pluggy-1.5.0.tar.gz", hash = "sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1", size = 67955 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/88/5f/e351af9a41f866ac3f1fac4ca0613908d9a41741cfcf2228f4ad853b697d/pluggy-1.5.0-py3-none-any.whl", hash = "sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669", size = 20556 }, +] + +[[package]] +name = "pytest" +version = "8.3.3" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "colorama", marker = "sys_platform == 'win32'" }, + { name = "iniconfig" }, + { name = "packaging" }, + { name = "pluggy" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/8b/6c/62bbd536103af674e227c41a8f3dcd022d591f6eed5facb5a0f31ee33bbc/pytest-8.3.3.tar.gz", hash = "sha256:70b98107bd648308a7952b06e6ca9a50bc660be218d53c257cc1fc94fda10181", size = 1442487 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/6b/77/7440a06a8ead44c7757a64362dd22df5760f9b12dc5f11b6188cd2fc27a0/pytest-8.3.3-py3-none-any.whl", hash = "sha256:a6853c7375b2663155079443d2e45de913a911a11d669df02a50814944db57b2", size = 342341 }, +] + [[package]] name = "ruff" version = "0.7.3"