From f8f78a3206c76535fa9282b7ec1c723de0afdeee Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Sat, 29 Aug 2026 22:10:59 -0700 Subject: [PATCH 1/2] fix when there are optional dependencies --- .github/workflows/publish-pypi.yml | 2 +- .github/workflows/run-tests.yml | 3 ++ .pre-commit-config.yaml | 7 +++ pyproject.toml | 62 ++++++++++++++++++------ template/.github/workflows/run-tests.yml | 3 ++ template/tox.ini | 4 +- tox.ini | 4 +- 7 files changed, 64 insertions(+), 21 deletions(-) diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 68e2196..3a661e2 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -72,7 +72,7 @@ jobs: runs-on: ubuntu-latest environment: name: pypi - url: https://pypi.org/p/{{ project_name|replace('-', '_') }} + url: https://pypi.org/p/hatchit permissions: id-token: write # IMPORTANT: mandatory for trusted publishing steps: diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4aa904e..662c96f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -51,6 +51,9 @@ jobs: - name: Install tox run: uv tool install tox --with tox-uv + - name: Install dependencies + run: uv sync --all-extras --python ${{ matrix.python }} + - name: Run tests run: | tox -e default -- --cov --cov-branch --cov-report=xml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 863ce2d..af3eb03 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -53,3 +53,10 @@ repos: # rev: v2.2.5 # hooks: # - id: codespell + +- repo: https://github.com/PyCQA/bandit + rev: 1.7.9 + hooks: + - id: bandit + args: ["-c", "pyproject.toml"] + additional_dependencies: ["bandit[toml]"] diff --git a/pyproject.toml b/pyproject.toml index c29246b..e2757cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,14 +1,29 @@ [project] name = "hatchit" -dynamic = ["version"] +dynamic = [ + "version", +] description = "Modern Python project scaffolder combining uv and hatch" readme = "README.md" authors = [ - { name = "Jayaram Kancherla", email = "jayaram.kancherla@gmail.com" } + { name = "Jayaram Kancherla", email = "jayaram.kancherla@gmail.com" }, ] requires-python = ">=3.10" -dependencies = ["uv", "copier>=9.0.0"] -keywords = ["scaffold", "uv", "hatch", "project", "generator", "template", "copier", "packaging", "pypi"] +dependencies = [ + "uv", + "copier>=9.0.0", +] +keywords = [ + "scaffold", + "uv", + "hatch", + "project", + "generator", + "template", + "copier", + "packaging", + "pypi", +] classifiers = [ "Development Status :: 4 - Beta", "Programming Language :: Python :: 3", @@ -20,7 +35,7 @@ classifiers = [ "Operating System :: OS Independent", "License :: OSI Approved :: MIT License", "Intended Audience :: Developers", - "Topic :: Software Development :: Code Generators" + "Topic :: Software Development :: Code Generators", ] [project.urls] @@ -33,12 +48,15 @@ Repository = "https://github.com/biocpy/hatchit" hatchit = "hatchit.cli:main" [build-system] -requires = ["hatchling", "hatch-vcs"] +requires = [ + "hatchling", + "hatch-vcs", +] build-backend = "hatchling.build" [tool.hatch.build.targets.wheel.force-include] "copier.yml" = "hatchit/copier.yml" -"template" = "hatchit/template" +template = "hatchit/template" [tool.hatch.version] source = "vcs" @@ -46,17 +64,27 @@ fallback-version = "0.1.0" [tool.ruff] line-length = 120 -src = ["src"] -exclude = ["tests", "docs"] +src = [ + "src", +] +exclude = [ + "tests", + "docs", +] [tool.ruff.lint] -extend-ignore = ["F821"] +extend-ignore = [ + "F821", +] [tool.ruff.lint.pydocstyle] convention = "google" [tool.ruff.lint.per-file-ignores] -"__init__.py" = ["E402", "F401"] +"__init__.py" = [ + "E402", + "F401", +] [tool.ruff.format] docstring-code-format = true @@ -67,16 +95,18 @@ strict = true [tool.pytest.ini_options] addopts = "--cov --cov-report term-missing" -testpaths = ["tests"] +testpaths = [ + "tests", +] [dependency-groups] dev = [ - "furo", - "linkify-it-py", - "mypy", - "myst-nb", "pytest", "pytest-cov", "sphinx", + "myst-nb", + "furo", "sphinx-autodoc-typehints", + "linkify-it-py", + "mypy", ] diff --git a/template/.github/workflows/run-tests.yml b/template/.github/workflows/run-tests.yml index 4aa904e..662c96f 100644 --- a/template/.github/workflows/run-tests.yml +++ b/template/.github/workflows/run-tests.yml @@ -51,6 +51,9 @@ jobs: - name: Install tox run: uv tool install tox --with tox-uv + - name: Install dependencies + run: uv sync --all-extras --python ${{ matrix.python }} + - name: Run tests run: | tox -e default -- --cov --cov-branch --cov-report=xml diff --git a/template/tox.ini b/template/tox.ini index dbc5d26..d759a6a 100644 --- a/template/tox.ini +++ b/template/tox.ini @@ -10,13 +10,13 @@ description = Invoke pytest to run automated tests allowlist_externals = uv skip_install = True commands = - uv run pytest {posargs} + uv run --all-extras pytest {posargs} [testenv:typecheck] description = Run static type checking with mypy skip_install = True commands = - uv run mypy src/ + uv run --all-extras mypy src/ [testenv:lint] description = Perform static analysis and style checks diff --git a/tox.ini b/tox.ini index dbc5d26..d759a6a 100644 --- a/tox.ini +++ b/tox.ini @@ -10,13 +10,13 @@ description = Invoke pytest to run automated tests allowlist_externals = uv skip_install = True commands = - uv run pytest {posargs} + uv run --all-extras pytest {posargs} [testenv:typecheck] description = Run static type checking with mypy skip_install = True commands = - uv run mypy src/ + uv run --all-extras mypy src/ [testenv:lint] description = Perform static analysis and style checks From 950e36aa0833ac78c1729aa3600157f625096c41 Mon Sep 17 00:00:00 2001 From: Jayaram Kancherla Date: Sat, 29 Aug 2026 22:17:19 -0700 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 286b31e..5d497ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,6 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 0.1.0 - 0.1.2 +## 0.1.0 - 0.1.3 - Switch to copier and modify the templates