diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index bc9c253..e67497d 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -24,9 +24,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/configure-pages@v6 - + - uses: actions/checkout@v6 - + - name: Install uv uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0 with: @@ -40,10 +40,10 @@ jobs: run: uv sync --locked --all-extras --dev - run: uv run zensical build --clean - + - uses: actions/upload-pages-artifact@v5 with: path: site - + - uses: actions/deploy-pages@v5 id: deployment diff --git a/.github/workflows/python-release.yaml b/.github/workflows/python-release.yaml index 5b69441..c90d228 100644 --- a/.github/workflows/python-release.yaml +++ b/.github/workflows/python-release.yaml @@ -27,7 +27,7 @@ jobs: - name: Build run: uv build - + # Check that basic features work and we didn't miss to include crucial files - name: Smoke test (wheel) run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py diff --git a/.github/workflows/python-test.yaml b/.github/workflows/python-test.yaml index 812103f..6e31df2 100644 --- a/.github/workflows/python-test.yaml +++ b/.github/workflows/python-test.yaml @@ -41,7 +41,7 @@ jobs: - name: Test with pytest run: uv run pytest -vv --cov-report term-missing --cov-report xml --cov isku - + - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v6 with: @@ -66,7 +66,7 @@ jobs: - name: Build run: uv build - + # Check that basic features work and we didn't miss to include crucial files - name: Smoke test (wheel) run: uv run --isolated --no-project --with dist/*.whl tests/smoke_test.py diff --git a/.gitignore b/.gitignore index b3ec7d5..5d24ff1 100644 --- a/.gitignore +++ b/.gitignore @@ -197,9 +197,9 @@ cython_debug/ .abstra/ # Visual Studio Code -# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore +# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore # that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore -# and can be added to the global gitignore or merged into this file. However, if you prefer, +# and can be added to the global gitignore or merged into this file. However, if you prefer, # you could uncomment the following to ignore the entire vscode folder # .vscode/ # Temporary file for partial code execution diff --git a/CHANGELOG.md b/CHANGELOG.md index b57663b..3aca504 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,10 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Documentation in docs/ hosted at brews.github.io/isku. - Test and test-coverage badges to README. +- Add pre-commit hooks (via prek) to help developers with format. ### Changed - Improved README. +- Improved CONTRIBUTING. - Add project URLs to package metadata. ## [0.1.0] - 2026-05-06 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1543d18..743377c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,7 +31,7 @@ Anything tagged with "enhancement" and "help wanted" is open to whoever wants to isku could always use more documentation, whether as part of the official docs, in docstrings, or even on the web in blog posts, articles, and such. -PRs with small corrections to spelling, format or clarity are welcome. The project has designed its documentation to make this process easier for non-technical users to contribute to documentation. +PRs with small corrections to spelling, format or clarity are welcome. The project has designed its documentation to make this process easier for non-technical users to contribute to documentation. ### Submit Feedback @@ -70,10 +70,10 @@ Then, install and activate the environment with: uv sync ``` -4. Install pre-commit to run linters/formatters at commit time: +4. Install prek to run linters/formatters at commit time: ```bash -uv run pre-commit install +uv run prek install --prepare-hooks ``` 5. Create a branch for local development: @@ -86,21 +86,18 @@ Now you can make your changes locally. 6. Don't forget to add test cases for your added functionality to the `tests` directory. -7. When you're done making changes, check that your changes pass the formatting tests. +7. When you're done making changes, check that your changes pass the lint tests. ```bash just lint ``` -Now, validate that all unit tests are passing: +Now, validate that automated tests are passing: ```bash just test ``` -This requires you to have multiple versions of python installed. -This step is also triggered in the CI/CD pipeline, so you could also choose to skip this step locally. - 9. Commit your changes and push your branch to GitHub: ```bash diff --git a/docs/faq.md b/docs/faq.md index 0a92536..575ca95 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -1,5 +1,4 @@ # FAQ -!!! warning +!!! warning :lucide-construction: This page is under construction. - diff --git a/docs/index.md b/docs/index.md index 3e35f5e..d0c21b3 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # Get Started -!!! warning +!!! warning :lucide-construction: This page is under construction. @@ -51,4 +51,3 @@ using `pip` or with a project in `uv`, do ```shell uv add git+https://github.com/brews/isku ``` - diff --git a/docs/support.md b/docs/support.md index 2dad2a8..9a73a2e 100644 --- a/docs/support.md +++ b/docs/support.md @@ -1,7 +1,6 @@ # Support -!!! warning +!!! warning :lucide-construction: This page is under construction. `isku` is open-source software made available under the terms of either the MIT License or the Apache License 2.0, at your option. - diff --git a/docs/user_guide.md b/docs/user_guide.md index a884f55..0a06a9d 100644 --- a/docs/user_guide.md +++ b/docs/user_guide.md @@ -1,6 +1,6 @@ # User Guide -!!! warning +!!! warning :lucide-construction: This page is under construction. ### Projecting models @@ -117,4 +117,3 @@ transformed = isku.extract_regions( regions=my_regions, ) ``` - diff --git a/prek.toml b/prek.toml new file mode 100644 index 0000000..708a17a --- /dev/null +++ b/prek.toml @@ -0,0 +1,21 @@ +[[repos]] +repo = "https://github.com/pre-commit/pre-commit-hooks" +rev = "v6.0.0" +hooks = [ + { id = "check-case-conflict" }, + { id = "check-merge-conflict" }, + { id = "check-toml" }, + { id = "check-yaml" }, + { id = "end-of-file-fixer" }, + { id = "trailing-whitespace" }, + { id = "mixed-line-ending" }, + { id = "debug-statements" }, +] + +[[repos]] +repo = "https://github.com/astral-sh/ruff-pre-commit" +rev = "v0.15.12" +hooks = [ + { id = "ruff-check", args = ["--fix", "--show-fixes"] }, + { id = "ruff-format" }, +] diff --git a/pyproject.toml b/pyproject.toml index e1614df..86fa652 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -21,4 +21,8 @@ tests = [ "ty>=0.0.34", ] docs = ["mkdocstrings[python]>=1.0.4", "zensical>=0.0.41"] -dev = [{ include-group = "docs" }, { include-group = "tests" }] +dev = [ + { include-group = "docs" }, + { include-group = "tests" }, + "prek>=0.3.13", +] diff --git a/uv.lock b/uv.lock index d52e83a..019e215 100644 --- a/uv.lock +++ b/uv.lock @@ -118,6 +118,7 @@ dependencies = [ dev = [ { name = "mkdocstrings", extra = ["python"] }, { name = "numpy" }, + { name = "prek" }, { name = "pytest" }, { name = "pytest-cov" }, { name = "ruff" }, @@ -143,6 +144,7 @@ requires-dist = [{ name = "xarray", specifier = ">=2026.4.0" }] dev = [ { name = "mkdocstrings", extras = ["python"], specifier = ">=1.0.4" }, { name = "numpy", specifier = ">=2.4.4" }, + { name = "prek", specifier = ">=0.3.13" }, { name = "pytest", specifier = ">=9.0.3" }, { name = "pytest-cov", specifier = ">=7.1.0" }, { name = "ruff", specifier = ">=0.15.12" }, @@ -403,6 +405,30 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/54/20/4d324d65cc6d9205fabedc306948156824eb9f0ee1633355a8f7ec5c66bf/pluggy-1.6.0-py3-none-any.whl", hash = "sha256:e920276dd6813095e9377c0bc5566d94c932c33b27a3e3945d8389c374dd4746", size = 20538, upload-time = "2025-05-15T12:30:06.134Z" }, ] +[[package]] +name = "prek" +version = "0.3.13" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/3c/59/0a279983f96bd5d538b4975f0a23121082aa3b8560b6649fdf61f8011b07/prek-0.3.13.tar.gz", hash = "sha256:c48586ee3708bfbf3df80121f55583e9a7d0fa166b08172c091fe5971e92a0ac", size = 444848, upload-time = "2026-05-05T18:07:09.076Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/bc/6a/9baa2bda21dccc2927e952416f6cc23a75eb99c9ed18837164ac2e4a5640/prek-0.3.13-py3-none-linux_armv6l.whl", hash = "sha256:b00d38f01235073c35aa5f48df57fefef45a6cec2ae0884d750345a2c7220370", size = 5506622, upload-time = "2026-05-05T18:06:53.091Z" }, + { url = "https://files.pythonhosted.org/packages/56/77/d44b5d9bdca0879b865f8e47bf84cf5dc9e8b358d029e6d9b83d8809c116/prek-0.3.13-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:0d89ac712c60e34d1550a606ad5fdfb8ad71d44ced8afa2fa5cbc106be4abd9e", size = 5878743, upload-time = "2026-05-05T18:07:23.164Z" }, + { url = "https://files.pythonhosted.org/packages/08/cf/19e8525cde8b3aa12858aca434d1fa653ef3b152da5af11eafc857634dc2/prek-0.3.13-py3-none-macosx_11_0_arm64.whl", hash = "sha256:f9b5265863d18b5be4ea094fdce4fd6ca61a8c89a70ee3d8ee153b3e0ed6b272", size = 5434909, upload-time = "2026-05-05T18:07:25.276Z" }, + { url = "https://files.pythonhosted.org/packages/7a/9a/e5f97194782de4dab622ce09dafb3ebdd2ee4d354a83ac4def7ebeee236c/prek-0.3.13-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.musllinux_1_1_aarch64.whl", hash = "sha256:64b59a1550780af2bba37297c704b17f81d8e9df6288af1fab4017938e33b1db", size = 5697536, upload-time = "2026-05-05T18:07:05.475Z" }, + { url = "https://files.pythonhosted.org/packages/c4/8c/e1f548ffc4b227e4c2b5a9b30f5978a7e0e6dad51305b97a2ba5b2a923e7/prek-0.3.13-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:9ce6cd8f114ba9bbdbe97422103fd886101949b1c42e588a7543c4436ead2020", size = 5428160, upload-time = "2026-05-05T18:07:01.489Z" }, + { url = "https://files.pythonhosted.org/packages/8a/44/abd919b00905a32d21dca2cec32c707860cf217da2431b62dd52684b310e/prek-0.3.13-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cc03e924a24d8d961f56195853c8b206cb196be6db4ad8312125dae847d718ac", size = 5827275, upload-time = "2026-05-05T18:07:17.437Z" }, + { url = "https://files.pythonhosted.org/packages/af/ed/cafd2b80d58a83faf8371c6543bd1475a2224242a3294da7f8582f6aa551/prek-0.3.13-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7ca8c526a23873177fb3b92013500b08ef5f8bedc7263f9f3a44dd2f49645a26", size = 6710293, upload-time = "2026-05-05T18:07:10.663Z" }, + { url = "https://files.pythonhosted.org/packages/35/09/52a4a27596b764173a34d74db09356b30faaacb4a1075b75adbc036a0008/prek-0.3.13-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a5bbb175478438a871e3281d2c3c3f067288af73ad81707a9bdebfd769766c7d", size = 6096556, upload-time = "2026-05-05T18:07:19.46Z" }, + { url = "https://files.pythonhosted.org/packages/63/60/80f61729ce6498815d46d5580cf76da2c157c9b6494046183682441a0ea3/prek-0.3.13-py3-none-manylinux_2_28_aarch64.whl", hash = "sha256:a65327a014d838341af757dfc05a706d10e8e33f039bc32bb3dbe2fa21c440c0", size = 5693267, upload-time = "2026-05-05T18:07:03.66Z" }, + { url = "https://files.pythonhosted.org/packages/36/9d/c7a663fe70676ffab2e0c6c9a71997a3ccd002ed5bc60b7422a937911af0/prek-0.3.13-py3-none-manylinux_2_31_riscv64.whl", hash = "sha256:b6a200843a36a5b0c41764ce7639ccb3471d48b097f1c5e3fc8f034219b42626", size = 5532865, upload-time = "2026-05-05T18:07:15.237Z" }, + { url = "https://files.pythonhosted.org/packages/32/68/506ef5a235536030e16f61e7210474554f6e05f845f27df5877d2dbb1a06/prek-0.3.13-py3-none-musllinux_1_1_armv7l.whl", hash = "sha256:bdacaad8f35f343e063d251211fe34db1de9e5cc591795361ad69a6485202258", size = 5395951, upload-time = "2026-05-05T18:06:55.183Z" }, + { url = "https://files.pythonhosted.org/packages/3e/00/22d7c6db7f43b58f7d015913c12660c9bbc82751cff6cfd8c31993cf30eb/prek-0.3.13-py3-none-musllinux_1_1_i686.whl", hash = "sha256:f00328f1c520d8fefb910ab0d3c6764ee330d227952baa19b7e3de7242bd8b3b", size = 5681195, upload-time = "2026-05-05T18:07:12.804Z" }, + { url = "https://files.pythonhosted.org/packages/10/e3/fdf9882238796914ddaf11381a9083b374980156200a953324f6c795f34d/prek-0.3.13-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:e5530a867bcf5b172b7513a64e71b06a337d1d184696227ae953845867376b8d", size = 6212085, upload-time = "2026-05-05T18:07:07.213Z" }, + { url = "https://files.pythonhosted.org/packages/ca/1d/528759931344b5c7103085798f5fa2e86d27d9410b753a6bcbe7726aa8ba/prek-0.3.13-py3-none-win32.whl", hash = "sha256:326fac2bdce00074ce6c5046b861d310638aee2b9de1ed241ba7eb32bdc83898", size = 5199566, upload-time = "2026-05-05T18:07:21.416Z" }, + { url = "https://files.pythonhosted.org/packages/6b/d0/8715ee837c73314a02767d20652cc312d1b6ff6733fa00f52de2b648bc3a/prek-0.3.13-py3-none-win_amd64.whl", hash = "sha256:841049f89f5ec9f4035299283d11e566ac5a068e3742ead1055ea04f886831fc", size = 5589599, upload-time = "2026-05-05T18:06:57.28Z" }, + { url = "https://files.pythonhosted.org/packages/ff/cf/0af0b15be0ebd82f7e50adee149b05a73533d78cb1b97cb889f0647ebffe/prek-0.3.13-py3-none-win_arm64.whl", hash = "sha256:a9fd74e0aec550c6b8d41076fdcdd6ff121cd7d94d743c1338bd794784e3c775", size = 5419029, upload-time = "2026-05-05T18:06:59.645Z" }, +] + [[package]] name = "pygments" version = "2.20.0"