Skip to content

Add ty as type checker#1189

Merged
ryneeverett merged 8 commits intoGothenburgBitFactory:developfrom
Lotram:add-ty
Mar 24, 2026
Merged

Add ty as type checker#1189
ryneeverett merged 8 commits intoGothenburgBitFactory:developfrom
Lotram:add-ty

Conversation

@Lotram
Copy link
Copy Markdown
Collaborator

@Lotram Lotram commented Mar 19, 2026

Following #1151, this add ty as a type checker, and fix all related errors.

Some notes:

  • dev dependencies are now defined in a dependency group, to avoid including them in the project when it's built
  • I added a CI job for that, as well as for ruff (linter + formatter). ruff used to be checked through a test (removed to so tests don't require having ruff anymore), which is not really standard IMO, but I can revert this if needed.
  • I migrated all CI jobs to use uv instead of pip, for better consistency.
  • tests and docs are excluded from type checking. This can be changed in the future, but I don't see a good reason to enforce it for now
  • I'll introduce new ruff rules (some ANN rules) to ensure all functions are properly typed, in another MR

Comment thread bugwarrior/services/teamwork_projects.py
Comment thread bugwarrior/services/trac.py
@Lotram Lotram marked this pull request as draft March 19, 2026 09:27
Comment thread .github/workflows/bugwarrior.yml
Comment thread .readthedocs.yaml
Comment thread .github/workflows/bugwarrior.yml
@Lotram Lotram force-pushed the add-ty branch 2 times, most recently from 094a987 to e4e4133 Compare March 19, 2026 10:16
@Lotram Lotram marked this pull request as ready for review March 19, 2026 10:22
Lotram added 2 commits March 19, 2026 15:20
- Add ty configuration: python-version 3.10, exclude tests/ and docs/
- All ty rules at default severity (no downgrades)
- Add lint CI job (ruff check, ruff format, ty check)
- Remove ruff pytest tests (now covered by lint CI job)
- Migrate test matrix and API change check jobs from pip to uv
- Remove redundant uv-test job (now covered by test matrix)
- Keep multiarch job on pip (uv not available on ppc64le)
- Move docs from optional dependency to dependency group
- Include docs group in test group (tests/test_docs.py needs docutils)
- Migrate ReadTheDocs to uv
Fix all errors reported by ty across the codebase.
Copy link
Copy Markdown
Collaborator

@ryneeverett ryneeverett left a comment

Choose a reason for hiding this comment

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

* dev dependencies are now defined in a [dependency group](https://packaging.python.org/en/latest/specifications/dependency-groups/#dependency-groups), to avoid including them in the project when it's built

Fine, but it seems like we need to update contributing.rst to include the group --dev for uv and whatever pip needs to adapt.

* I added a CI job for that, as well as for ruff (linter + formatter). `ruff` used to be checked through a test (removed to so tests don't require having ruff anymore), which is not really standard IMO, but I can revert this if needed.

What is the problem with tests requiring ruff and ty? I know it's not standard practice, but from my perspective the more we have in tests and the less in CI the better because (a) less distinction between local/CI to debug (b) the tests are portable and extremely stable whereas CI configuration is vendored and less stable.

* I migrated all CI jobs to use uv instead of pip, for better consistency.

That's fine, but could we copy the old bugwarrior-test to bugwarrior-development-pip-test so we're still testing basic pip functionality (since it's documented as an option). This is in the spirit of what bugwarrior-development-uv-test was doing before, but for pip.

Comment thread bugwarrior/services/__init__.py Outdated
Comment thread bugwarrior/services/bts.py Outdated
Comment thread bugwarrior/services/gitbug.py Outdated
Comment thread bugwarrior/services/gitlab.py
Comment thread bugwarrior/services/phab.py Outdated
Comment thread pyproject.toml Outdated
Comment thread .github/workflows/bugwarrior.yml
Comment thread .github/workflows/bugwarrior.yml Outdated
Comment thread bugwarrior/docs/contributing.rst Outdated
@ryneeverett ryneeverett merged commit 715bec8 into GothenburgBitFactory:develop Mar 24, 2026
7 of 8 checks passed
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.

2 participants