Skip to content

refactor(template): five strict type checkers and bump style tooling - #26

Merged
hasansezertasan merged 5 commits into
mainfrom
feat/soft-anorak
Jun 24, 2026
Merged

refactor(template): five strict type checkers and bump style tooling#26
hasansezertasan merged 5 commits into
mainfrom
feat/soft-anorak

Conversation

@hasansezertasan

Copy link
Copy Markdown
Owner

Summary

Hardens the generated project's type-checking and refreshes the lint toolchain.

  • Five type checkers, no redundancy. Drops pyright and invokes strict basedpyright (its superset) alongside mypy (×2 versions), ty, pyrefly, and zuban — the two previously-installed-but-never-run tools now pull their weight.
  • Two latent bugs caught by the new checkers, both fixed: a [tool.pyright] venvPath misconfiguration (.venv/.venv), and a BINDINGS type-invariance error in tui/app.py.
  • Full-strict basedpyright, code fixed to match (not relaxed): @override via typing_extensions, ClassVar/@final annotations, _ = discards, single-string literals. The one unavoidable library-boundary Any (MCP tool args) carries an explicit # pyright: ignore.
  • All style tools bumped to latest (mypy 2.1.0, basedpyright 1.39.8, ty 0.0.53, pyrefly 1.1.1, zuban 0.9.0, ruff 0.15.19, …); pre-commit and trunk pins aligned. Two bonus wins fell out: zuban 0.9 fixed a misc miscategorization (restored mypy strictness in mcp/app.py), and basedpyright 1.39 flagged a set_event_loop_policy deprecation (worker modernized to uvloop.run()).
  • Removed bandit (hook + trunk + commented dep) and the commented pyupgrade-directories — ruff's S/UP rules cover both under select=ALL.
  • The pre-commit pyright hook is replaced by a local basedpyright hook.

Decision recorded in ADR-005.

Test plan

  • tox -e style → green on a default render and a litestar + MCP + worker render (all five checkers + ruff/vulture/slotscheck/taplo/validate-pyproject/typos/actionlint).
  • tox -e pre-commit → green; all bumped hooks and the local basedpyright hook resolve and install.

cliff.toml and .cliffignore configured git-cliff for a changelog that was
never wired to any workflow, hook, or task. Changelog generation for
generated projects is owned by release-please, and the template repo
itself has no git-cliff invocation, so these files were dead config.
Align the template's tooling with the release-please pipeline and remove
overlapping/conflicting tools that duplicated its or each other's work.

Commitizen (ADR-004): scope to Conventional Commit authoring/linting only.
release-please owns version bumping, git tagging, and CHANGELOG.md, so drop
the [tool.commitizen] bump/tag/changelog keys (they competed over the same
tags and changelog file) and the commented-out bump-my-version dep.

Lint orchestration (ADR-003): make the uv-backed tox `style` env the single
canonical lint/type-check runner; default include_pants and include_trunk to
off (opt-in) so a default project's full suite lives in one place with one set
of versions. Remove redundant/conflicting tools: black and isort (ruff owns
format + import sorting), codespell (typos), and legacy markdownlint
(markdownlint-cli2).

Pre-commit: make hooks always-on and remove the include_precommit toggle.
Standardize the runner on prek across the dependency group, the tox `pre-commit`
env, and the CI `hooks` job (previously split between pre-commit and prek, which
left the CI job calling an uninstalled binary).

Sync docs (README, CLAUDE.md, AGENTS.md) and add ADR-003 and ADR-004.
Replace pyright with strict basedpyright and invoke all installed type checkers (mypy x2, basedpyright, ty, pyrefly, zuban). Wiring in the former dead-weight tools surfaced two latent bugs, both fixed: a [tool.pyright] venvPath misconfiguration and a BINDINGS type-invariance error in tui/app.py.

Generated code is fixed to satisfy basedpyright's full strict ruleset (typing_extensions for @OverRide, ClassVar/@Final annotations, _ = discards, single-string literals) rather than relaxing it; the one unavoidable library-boundary Any (MCP tool args) carries an explicit # pyright: ignore.

Bump all style-group tools to latest (mypy 2.1.0, basedpyright 1.39.8, ty 0.0.53, pyrefly 1.1.1, zuban 0.9.0, ruff 0.15.19, vulture 2.16, typos 1.47.2, actionlint-py 1.7.12.24, slotscheck 0.20.0, editorconfig-checker 3.6.1, validate-pyproject 0.25) and align the pre-commit and trunk version pins. zuban 0.9 fixed an earlier misc miscategorization, restoring mypy strictness in mcp/app.py; basedpyright 1.39 flagged a set_event_loop_policy deprecation, so the worker is modernized to uvloop.run().

Remove bandit (pre-commit hook, trunk entry, commented dep) and the commented pyupgrade-directories dep; ruff's S and UP rules cover both under select=ALL.

Verified: tox -e style and tox -e pre-commit pass on default and litestar+mcp+worker renders. See ADR-005.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry @hasansezertasan, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 973e613da7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread copier.yml Outdated
…, render ruff-clean

Migrate generated projects from a pre-commit `.pre-commit-config.yaml` to a
native `prek.toml`, drop the `include_commitizen` toggle, fix the c-extensions
style suite, and clean up rendered-output whitespace across all components.

- prek: replace `.pre-commit-config.yaml.jinja` with `prek.toml.jinja` (builtin
  repo for simple hooks; upstream repo kept for check-yaml --unsafe /
  debug-statements / check-ast). Drop the pre-commit.ci `ci:` block and the
  sync-with-uv hook; Renovate now bumps hook revs via a customManagers regex
  (its built-in pre-commit manager only reads .pre-commit-config.yaml). Rename
  the `pre-commit` dep group / tox env / mise task to `prek`; bump prek to 0.4.3.
- commitizen: always included (the toggle already defaulted true and its hooks
  were unconditional, so the gate only added inconsistency). Remove the
  copier.yml variable and the conditionals around the dep and `[tool.commitizen]`.
- c-extensions style: ignore preview RUF067 on the package __init__ and gate
  basedpyright reportMissingModuleSource / reportImplicitStringConcatenation when
  C extensions are enabled (the .pyi stub has no in-tree source; ruff's formatter
  keeps the warning string implicitly concatenated).
- whitespace: fix 16 template files so rendered output is ruff-clean without
  relying on fix=true / mutating `ruff format` (Jinja `{%- -%}` strip markers,
  magic-comma collapses, isort, pytest->TYPE_CHECKING). Make profile.py
  executable (EXE001) and tidy its file-level noqa.
- docs: update README, CLAUDE.md, AGENTS.md, ADR-003/004 to match.
…lways-on, slim CHANGELOG to release-please stub

Drop five copier toggles to shrink the matrix and remove vestigial tooling.

- Remove Pants and Trunk entirely: delete pants.toml.jinja and the .trunk/
  directory (trunk.yaml + hadolint/markdownlint configs); the tox `style` env is
  now the sole lint/build orchestrator a generated project ships.
- Make Codecov always-on: rename to .codecov.yml.jinja and run the CI coverage
  upload unconditionally (needs CODECOV_TOKEN).
- Make mise always-on: rename to mise.toml.jinja; unconditional devcontainer
  mise feature and VS Code mise extension.
- Make the changelog always-on: this resolves a latent inconsistency, since
  release-please (changelog-path: CHANGELOG.md) generated the file regardless of
  the old "link to Releases" mode.
- Slim CHANGELOG.md to a minimal release-please-owned stub: the Keep-a-Changelog
  skeleton (Unreleased section + changelog-start/end markers) was a git-cliff-era
  leftover that conflicts with release-please's default emoji-section format.
- Remove the include_pants/include_trunk/include_codecov/include_changelog/
  include_mise variables from copier.yml and .example-input.yml; drop
  include_codecov=true from the meta-CI render matrix.
- Docs: update README, CLAUDE.md, AGENTS.md; add a dated supersession note to
  ADR-003 (pants/trunk removed, not merely opt-in) and clean stale
  include_changelog references in ADR-002/004.
@hasansezertasan
hasansezertasan merged commit 1900696 into main Jun 24, 2026
6 checks passed
@hasansezertasan
hasansezertasan deleted the feat/soft-anorak branch June 24, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant