Skip to content

chore: update ruff and mypy#582

Merged
netomi merged 7 commits intoeclipse-csi:mainfrom
etas-contrib:upgrades
Feb 5, 2026
Merged

chore: update ruff and mypy#582
netomi merged 7 commits intoeclipse-csi:mainfrom
etas-contrib:upgrades

Conversation

@AlexanderLanin
Copy link
Contributor

Up to now local execution of ruff/mypy via CLI or via VS Code extensions produces very different results than execution via pre-commit. This PR does not address the underlying drift. Simply updating the versions used by pre-commit, and fixing the code along the way.

Note that I made individual commits to facilitate review.

Note2: I don't have the slightest idea why pypi/pypi/-/aiohttp-client-cache/0.14.2 is automatically added to DEPENDENCIES. It happens automatically and always.

Copilot AI review requested due to automatic review settings February 4, 2026 21:40
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request updates the development tools ruff (from 0.8 to 0.15) and mypy (from 1.8.0 to 1.19.1) to align local and pre-commit execution results. The PR includes necessary code changes to satisfy the new linter and type checker requirements.

Changes:

  • Updated ruff version constraint from >=0.8 to >=0.15 and mypy from >=1.8.0 to >=1.19.1
  • Migrated from Enum with multiple inheritance to StrEnum throughout the codebase
  • Replaced Optional[T] type hints with T | None union syntax
  • Updated cast() calls to use quoted string types for forward references
  • Fixed type checking issues and improved type hints for better type safety

Reviewed changes

Copilot reviewed 25 out of 26 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
pyproject.toml Updated version constraints for ruff (>=0.15) and mypy (>=1.19.1)
poetry.lock Updated locked versions for ruff (0.15.0) and mypy (1.19.1), added librt dependency for mypy
.pre-commit-config.yaml Updated pre-commit hook versions to match pyproject.toml (ruff v0.15.0, mypy v1.19.1)
tests/providers/github/integration/helpers/http_mock.py Updated comment to reflect current mypy behavior
tests/operations/test_operation.py Moved fmt comment after decorator to properly format function definition
otterdog/webapp/webhook/github_models.py Migrated from Enum to StrEnum for AuthorAssociation
otterdog/webapp/utils.py Changed cast to use quoted string type
otterdog/webapp/tasks/blueprints/pin_workflow.py Improved type hint from generic dict to specific WorkflowFile type
otterdog/webapp/policies/init.py Migrated from Enum to StrEnum for PolicyType
otterdog/webapp/db/models.py Migrated to StrEnum and replaced Optional[T] with T | None throughout
otterdog/webapp/blueprints/init.py Migrated from Enum to StrEnum for BlueprintType
otterdog/utils.py Added type check to prevent runtime error, prefixed unused variable with underscore
otterdog/providers/github/graphql.py Added status code check before accessing JSON data
otterdog/models/*.py Updated cast() calls to quoted strings, reorganized imports to TYPE_CHECKING block
otterdog/logging.py Changed cast to use quoted string type
DEPENDENCIES Updated werkzeug version and added duplicate aiohttp-client-cache entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@netomi
Copy link
Member

netomi commented Feb 4, 2026

there is a comment in pyproject.toml why the new union syntax is not used in db/models.py

[tool.ruff.lint.per-file-ignores]
"**/db/models.py" = ["UP007", "TCH003"] # new optional spec is not yet supported by odmantic

unless something has changed, we need to keep it like that.

the version of ruff in pre-commit and the project diverged and I had not noticed. What I do in another project to prevent that is to use pre-commit hooks like that:

- repo: local
  hooks:
    - id: ruff
      name: Ruff Linter
      entry: ruff check --fix
      language: system
      types: [python]

that will use the version of ruff from your local venv.
The downside is you need to activate the venv when committing.

I was also thinking of using pyright instead of mypy.
The dependencies stuff is annoying, I think we can stop updating that file.

@AlexanderLanin
Copy link
Contributor Author

@netomi it seems those ignore-settings did not work for some reason. Anyway it was fixed in 1.1.0 just recently art049/odmantic#500

That's why I made this odmantic update commit.

@netomi netomi merged commit 0cecc51 into eclipse-csi:main Feb 5, 2026
5 checks passed
WolfgangFischerEtas added a commit to etas-contrib/eclipse-csi_otterdog that referenced this pull request Feb 6, 2026
…ssions and environment variables and secrets (#1)

* Feature development: team with team-sync, external groups, team-permissions and environment variables and secrets

* chore: update ruff and mypy (eclipse-csi#582)

* chore: update ruff

* chore: ruff auto fix

* chore: ruff manual fixes

* chore: update mypy and fix code

* chore: fix ruff autofixes by updating odmantic

See art049/odmantic#501

* chore: ruff format

* chore: fix non formatting block

* chore: remove fixme

* Merge remote-tracking branch 'upstream/main' into feature/teampermission

* fix: status added in _run_page_query as it is now used

* chore: fixed by ruff

* feat: add team sync variables to team

---------

Co-authored-by: Alexander Lanin <Alexander.Lanin@etas.com>
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