Skip to content

Commit 74eb7d9

Browse files
authored
fix: use python 3.13 in pre-commit hook (#782)
The pre-commit hook would not work after python was bumped from 3.12 to 3.13. Also: - enforce pre-commit check in CI/CD - fix `.pre-commit-config.yaml` (exclude snapshot files) - remove `yesqa` from `.pre-commit-config.yaml`, instead use `poetry run ruff check` or `poetry run ruff check --fix` - fix existing files (that is, run the `pre-commit` hooks on the repository)
1 parent 341c145 commit 74eb7d9

File tree

13 files changed

+34
-32
lines changed

13 files changed

+34
-32
lines changed

.github/workflows/test_publish.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,9 @@ jobs:
8787
- name: Style checks
8888
uses: devcontainers/[email protected]
8989
with:
90-
runCmd: make style_checks
90+
runCmd: |
91+
make style_checks
92+
poetry run pre-commit run --all-files --show-diff-on-failure --hook-stage manual
9193
push: never
9294
skipContainerUserIdUpdate: false
9395
cacheFrom: ${{ needs.build-devcontainer.outputs.image_repository }}:${{ needs.build-devcontainer.outputs.image_tag }}

.pre-commit-config.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
default_language_version:
2-
python: python3.12
2+
python: python3.13
33
repos:
44
- repo: local
55
hooks:
@@ -8,6 +8,8 @@ repos:
88
entry: make style_checks
99
language: system
1010
pass_filenames: false
11+
stages:
12+
- pre-commit
1113
- repo: https://github.com/pre-commit/pre-commit-hooks
1214
rev: v4.5.0
1315
hooks:
@@ -18,11 +20,7 @@ repos:
1820
- id: check-toml
1921
- id: debug-statements
2022
- id: end-of-file-fixer
21-
exclude: 'components/renku_data_services/message_queue/(avro_models|schemas)'
23+
exclude: '(components/renku_data_services/message_queue/(avro_models|schemas))|(.ambr)'
2224
- id: mixed-line-ending
2325
- id: trailing-whitespace
24-
exclude: 'components/renku_data_services/message_queue/(avro_models|schemas)'
25-
- repo: https://github.com/asottile/yesqa
26-
rev: v1.5.0
27-
hooks:
28-
- id: yesqa
26+
exclude: '(components/renku_data_services/message_queue/(avro_models|schemas))|(.ambr)'

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ style_checks: ${API_SPECS} ## Run linting and style checks
9494
poetry check
9595
poetry run mypy
9696
poetry run ruff format --check
97-
poetry run ruff check .
97+
poetry run ruff check
9898
poetry run bandit -c pyproject.toml -r .
9999
poetry poly check
100100
poetry poly libs
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Common models for all services."""
22

3-
from renku_data_services.base_models.core import * # noqa: F401, F403
3+
from renku_data_services.base_models.core import * # noqa: F403

components/renku_data_services/connected_services/db.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def get_oauth2_client(self, provider_id: str, user: base_models.APIUser) -
6363
client = result.one_or_none()
6464
if client is None:
6565
raise errors.MissingResourceError(
66-
message=f"OAuth2 Client with id '{provider_id}' does not exist or you do not have access to it." # noqa: E501
66+
message=f"OAuth2 Client with id '{provider_id}' does not exist or you do not have access to it."
6767
)
6868
return client.dump(user_is_admin=user.is_admin)
6969

@@ -302,7 +302,7 @@ async def get_oauth2_connection(self, connection_id: ULID, user: base_models.API
302302
"""Get one OAuth2 connection from the database."""
303303
if not user.is_authenticated or user.id is None:
304304
raise errors.MissingResourceError(
305-
message=f"OAuth2 connection with id '{connection_id}' does not exist or you do not have access to it." # noqa: E501
305+
message=f"OAuth2 connection with id '{connection_id}' does not exist or you do not have access to it."
306306
)
307307

308308
async with self.session_maker() as session:
@@ -394,7 +394,7 @@ async def get_async_oauth2_client(
394394
"""Get the AsyncOAuth2Client for the given connection_id and user."""
395395
if not user.is_authenticated or user.id is None:
396396
raise errors.MissingResourceError(
397-
message=f"OAuth2 connection with id '{connection_id}' does not exist or you do not have access to it." # noqa: E501
397+
message=f"OAuth2 connection with id '{connection_id}' does not exist or you do not have access to it."
398398
)
399399

400400
async with self.session_maker() as session:

components/renku_data_services/data_connectors/api.spec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,7 +855,7 @@ components:
855855
description: Information about inaccessible data connector links
856856
type: object
857857
properties:
858-
count:
858+
count:
859859
type: integer
860860
minimum: 0
861861
description: The number of data links the user does not have access to
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
"""Service errors component."""
22

3-
from renku_data_services.errors.errors import * # noqa: F401, F403
3+
from renku_data_services.errors.errors import * # noqa: F403

components/renku_data_services/migrations/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def run_migrations_for_app(name: str, revision: str = "heads") -> None:
1515
"""Perform migrations for app `name`.
1616
1717
From: https://alembic.sqlalchemy.org/en/latest/cookbook.html#programmatic-api-use-connection-sharing-with-asyncio
18-
""" # noqa: E501
18+
"""
1919
cfg = get_alembic_config(name)
2020
command.upgrade(cfg, revision)
2121

components/renku_data_services/migrations/versions/450ae3930996_create_initial_global_environments.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -89,27 +89,27 @@ def upgrade() -> None:
8989
op.execute(
9090
sa.text(
9191
"""INSERT INTO sessions.environments(
92-
id,
92+
id,
9393
name, description,
94-
created_by_id,
95-
creation_date,
96-
container_image,
97-
default_url,
94+
created_by_id,
95+
creation_date,
96+
container_image,
97+
default_url,
9898
port,
9999
working_directory,
100100
mount_directory,
101101
uid,
102102
gid,
103103
args,
104104
command,
105-
environment_kind
105+
environment_kind
106106
)VALUES (
107-
generate_ulid(),
108-
:name,
109-
:description,
110-
:created_by_id,
111-
now(),
112-
:container_image,
107+
generate_ulid(),
108+
:name,
109+
:description,
110+
:created_by_id,
111+
now(),
112+
:container_image,
113113
:default_url,
114114
:port,
115115
:working_directory,

projects/background_jobs/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ RUN if $DEV_BUILD ; then \
2222
/home/renku/.local/bin/poetry export -o requirements.txt; \
2323
fi && \
2424
env/bin/pip install -r requirements.txt
25-
RUN /home/renku/.local/bin/poetry -C projects/background_jobs build-project -f wheel --custom-temp-path=/tmp
25+
RUN /home/renku/.local/bin/poetry -C projects/background_jobs build-project -f wheel --custom-temp-path=/tmp
2626
RUN env/bin/pip --no-cache-dir install projects/background_jobs/dist/*.whl
2727

2828
FROM python:3.13-slim-bookworm

0 commit comments

Comments
 (0)