From 29d2cd94d258e6df49a565e935318b5ed168d008 Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Mon, 2 Sep 2024 11:28:30 +1200 Subject: [PATCH 1/3] Switch to uv export for requirements generation. --- .github/workflows/ci.yml | 5 ++-- .requirements/3.12-Linux.txt | 2 -- .requirements/3.12-Windows.txt | 2 -- .requirements/3.12-macOS.txt | 2 -- Makefile | 5 ---- doc/philosophy/introspection.md | 6 +---- pyproject.toml | 6 ++++- requirements.txt | 23 ++++++++++++++++++ uv.lock | 43 ++++++++++++++++++++++++++++++--- 9 files changed, 71 insertions(+), 23 deletions(-) delete mode 100644 .requirements/3.12-Linux.txt delete mode 100644 .requirements/3.12-Windows.txt delete mode 100644 .requirements/3.12-macOS.txt delete mode 100644 Makefile create mode 100644 requirements.txt diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 820afc3f..21ce8cd2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,8 @@ jobs: - name: Setup dependencies run: | - uv pip install --system --break-system-packages -r ./.requirements/${{ matrix.python-version }}-${{ runner.os }}.txt - uv pip install --system --break-system-packages pytest pytest-md pytest-emoji + uv export --resolution ${{ matrix.python-version }} > requirements.txt + uv pip install --system --break-system-packages -r requirements.txt - name: Run pytest uses: pavelzw/pytest-action@510c5e90c360a185039bea56ce8b3e7e51a16507 # v2.2.0 @@ -32,3 +32,4 @@ jobs: matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: [3.12] + resolution: [highest, lowest-direct] diff --git a/.requirements/3.12-Linux.txt b/.requirements/3.12-Linux.txt deleted file mode 100644 index 21d8888f..00000000 --- a/.requirements/3.12-Linux.txt +++ /dev/null @@ -1,2 +0,0 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-Linux.txt diff --git a/.requirements/3.12-Windows.txt b/.requirements/3.12-Windows.txt deleted file mode 100644 index b913d37d..00000000 --- a/.requirements/3.12-Windows.txt +++ /dev/null @@ -1,2 +0,0 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-Windows.txt diff --git a/.requirements/3.12-macOS.txt b/.requirements/3.12-macOS.txt deleted file mode 100644 index bbf5adb8..00000000 --- a/.requirements/3.12-macOS.txt +++ /dev/null @@ -1,2 +0,0 @@ -# This file was autogenerated by uv via the following command: -# uv pip compile pyproject.toml --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macOS.txt diff --git a/Makefile b/Makefile deleted file mode 100644 index e411a935..00000000 --- a/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -.PHONY requirements: -requirements: - uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform linux --output-file .requirements/3.12-Linux.txt - uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform macos --output-file .requirements/3.12-macOS.txt - uv pip compile "pyproject.toml" --quiet --generate-hashes --python-version 3.12 --python-platform windows --output-file .requirements/3.12-Windows.txt \ No newline at end of file diff --git a/doc/philosophy/introspection.md b/doc/philosophy/introspection.md index 0ba391bb..efcabb60 100644 --- a/doc/philosophy/introspection.md +++ b/doc/philosophy/introspection.md @@ -26,11 +26,8 @@ necessarily listed chronologically): - Created a develop branch. - Set up sensible rulesets for branches. - Created a template for GitHub issues that are development tasks. -- Created a Makefile. -- Created a `make requirements` command to make platform-specific requirements files. - Ran `uv init --name usethis`. - Ran `uv python pin 3.12.4`. -- Created a `.requirements` directory with Python version and OS specific files. ## Add GitHub Actions CI @@ -64,8 +61,7 @@ on: - Created a tests folder. - Added a trivial test module `test_nothing.py`. - Add a trivial test `test_pass` to the test module. -- Add step to CI to install pytest -- Add step to CI to install pytest-md and pytest-emoji (used by Action). +- Add pytest, pytest-md and pytest-emoji as dev deependencies. - Confirm pytest is working with `pytest tests` in the CLI. - Add to set up pytest in CI, using the correct CLI args to pytest. diff --git a/pyproject.toml b/pyproject.toml index 4428059d..bdd2b0bc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,4 +11,8 @@ requires = ["hatchling"] build-backend = "hatchling.build" [tool.uv] -dev-dependencies = ["pytest>=8.3.2"] +dev-dependencies = [ + "pytest>=8.3.2", + "pytest-md>=0.2.0", + "pytest-emoji>=0.2.0", +] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 00000000..05566a12 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,23 @@ +# This file was autogenerated via `uv export`. +-e . +colorama==0.4.6 ; sys_platform == 'win32' \ + --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ + --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 +iniconfig==2.0.0 \ + --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ + --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 +packaging==24.1 \ + --hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \ + --hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 +pluggy==1.5.0 \ + --hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \ + --hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669 +pytest==8.3.2 \ + --hash=sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce \ + --hash=sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5 +pytest-emoji==0.2.0 \ + --hash=sha256:e1bd4790d87649c2d09c272c88bdfc4d37c1cc7c7a46583087d7c510944571e8 \ + --hash=sha256:6e34ed21970fa4b80a56ad11417456bd873eb066c02315fe9df0fafe6d4d4436 +pytest-md==0.2.0 \ + --hash=sha256:3b248d5b360ea5198e05b4f49c7442234812809a63137ec6cdd3643a40cf0112 \ + --hash=sha256:4c4cd16fea6d1485e87ee254558712c804a96d2aa9674b780e7eb8fb6526e1d1 diff --git a/uv.lock b/uv.lock index 4187c477..74a71a4e 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,8 @@ version = 1 -requires-python = ">=3.11" +requires-python = ">=3.12" + +[options] +resolution-mode = "lowest-direct" [[package]] name = "colorama" @@ -53,14 +56,46 @@ wheels = [ ] [[package]] -name = "usethis" -version = "0.1.0" -source = { editable = "." } +name = "pytest-emoji" +version = "0.2.0" +source = { registry = "https://pypi.org/simple" } +dependencies = [ + { name = "pytest" }, +] +sdist = { url = "https://files.pythonhosted.org/packages/88/4d/d489f939f0717a034cea7955d36bc2a7a5ba1b263871e63ad8cb16d47555/pytest-emoji-0.2.0.tar.gz", hash = "sha256:e1bd4790d87649c2d09c272c88bdfc4d37c1cc7c7a46583087d7c510944571e8", size = 6171 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f7/51/80af966c0aded877da7577d21c4601ca98c6f603c6e6073ddea071af01ec/pytest_emoji-0.2.0-py3-none-any.whl", hash = "sha256:6e34ed21970fa4b80a56ad11417456bd873eb066c02315fe9df0fafe6d4d4436", size = 5664 }, +] + +[[package]] +name = "pytest-md" +version = "0.2.0" +source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pytest" }, ] +sdist = { url = "https://files.pythonhosted.org/packages/0e/55/1d4248f08a97255abb23b05d8ba07586333194fadb17beda96b707aebecd/pytest-md-0.2.0.tar.gz", hash = "sha256:3b248d5b360ea5198e05b4f49c7442234812809a63137ec6cdd3643a40cf0112", size = 5985 } +wheels = [ + { url = "https://files.pythonhosted.org/packages/80/71/23d03f57c18116c6770141478e33b3500c4e92500cf4b49a396e9226733f/pytest_md-0.2.0-py3-none-any.whl", hash = "sha256:4c4cd16fea6d1485e87ee254558712c804a96d2aa9674b780e7eb8fb6526e1d1", size = 6117 }, +] + +[[package]] +name = "usethis" +version = "0.1.0" +source = { editable = "." } [package.dev-dependencies] dev = [ { name = "pytest" }, + { name = "pytest-emoji" }, + { name = "pytest-md" }, +] + +[package.metadata] + +[package.metadata.requires-dev] +dev = [ + { name = "pytest", specifier = ">=8.3.2" }, + { name = "pytest-emoji", specifier = ">=0.2.0" }, + { name = "pytest-md", specifier = ">=0.2.0" }, ] From 71cfbf402abe239ebc899a8a2bfed8e1b48116ca Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Mon, 2 Sep 2024 11:29:48 +1200 Subject: [PATCH 2/3] Remove requirements file --- requirements.txt | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 05566a12..00000000 --- a/requirements.txt +++ /dev/null @@ -1,23 +0,0 @@ -# This file was autogenerated via `uv export`. --e . -colorama==0.4.6 ; sys_platform == 'win32' \ - --hash=sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44 \ - --hash=sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6 -iniconfig==2.0.0 \ - --hash=sha256:2d91e135bf72d31a410b17c16da610a82cb55f6b0477d1a902134b24a455b8b3 \ - --hash=sha256:b6a85871a79d2e3b22d2d1b94ac2824226a63c6b741c88f7ae975f18b6778374 -packaging==24.1 \ - --hash=sha256:026ed72c8ed3fcce5bf8950572258698927fd1dbda10a5e981cdf0ac37f4f002 \ - --hash=sha256:5b8f2217dbdbd2f7f384c41c628544e6d52f2d0f53c6d0c3ea61aa5d1d7ff124 -pluggy==1.5.0 \ - --hash=sha256:2cffa88e94fdc978c4c574f15f9e59b7f4201d439195c3715ca9e2486f1d0cf1 \ - --hash=sha256:44e1ad92c8ca002de6377e165f3e0f1be63266ab4d554740532335b9d75ea669 -pytest==8.3.2 \ - --hash=sha256:c132345d12ce551242c87269de812483f5bcc87cdbb4722e48487ba194f9fdce \ - --hash=sha256:4ba08f9ae7dcf84ded419494d229b48d0903ea6407b030eaec46df5e6a73bba5 -pytest-emoji==0.2.0 \ - --hash=sha256:e1bd4790d87649c2d09c272c88bdfc4d37c1cc7c7a46583087d7c510944571e8 \ - --hash=sha256:6e34ed21970fa4b80a56ad11417456bd873eb066c02315fe9df0fafe6d4d4436 -pytest-md==0.2.0 \ - --hash=sha256:3b248d5b360ea5198e05b4f49c7442234812809a63137ec6cdd3643a40cf0112 \ - --hash=sha256:4c4cd16fea6d1485e87ee254558712c804a96d2aa9674b780e7eb8fb6526e1d1 From 3d74a562d0cdfa5a1154b70ba332124e3d1bbc7d Mon Sep 17 00:00:00 2001 From: Nathan McDougall Date: Mon, 2 Sep 2024 11:31:11 +1200 Subject: [PATCH 3/3] Use correct matrix variable in CI --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 21ce8cd2..41ce2611 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - name: Setup dependencies run: | - uv export --resolution ${{ matrix.python-version }} > requirements.txt + uv export --resolution ${{ matrix.resolution }} > requirements.txt uv pip install --system --break-system-packages -r requirements.txt - name: Run pytest