diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml deleted file mode 100644 index 34242bb..0000000 --- a/.github/workflows/mypy.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: mypy -on: [pull_request] -jobs: - mypy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.12.x' - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install .[dev] - - name: Check with mypy - run: | - mypy . diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml deleted file mode 100644 index 1224231..0000000 --- a/.github/workflows/ruff.yml +++ /dev/null @@ -1,8 +0,0 @@ -name: Ruff -on: [pull_request] -jobs: - ruff: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: astral-sh/ruff-action@v1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8d87399..30dcc9e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.2.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -17,6 +17,10 @@ repos: args: [ --fix ] # Run the formatter. - id: ruff-format +- repo: https://github.com/pre-commit/mirrors-mypy + rev: 'v1.13.0' + hooks: + - id: mypy - repo: local hooks: - id: shellcheck diff --git a/Makefile b/Makefile index 0995660..3406d68 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ DIRECTORS_FILE?=directors.csv RUN_LOG?=run.log RUN_LOG_CMD?=ts | tee -a $(RUN_LOG) -.PHONY: install lint mypy test populate run-update-directors run-update-films run-update-offers run-cleanup run-all run-db-upgrade webapp ui swagger swagger-py swagger-js swagger-ts swagger-all get-dirs get-films +.PHONY: install lint test populate run-update-directors run-update-films run-update-offers run-cleanup run-all run-db-upgrade webapp ui swagger swagger-py swagger-js swagger-ts swagger-all get-dirs get-films install: pdm install -vd @@ -13,9 +13,6 @@ install: lint: install swagger pre-commit run --all-files -mypy: - pdm run mypy . - test: lint pdm run pytest diff --git a/alembic/env.py b/alembic/env.py index 692d694..312232d 100644 --- a/alembic/env.py +++ b/alembic/env.py @@ -3,7 +3,8 @@ from sqlalchemy import engine_from_config from sqlalchemy import pool -from alembic import context +# TODO: Fix type ignore by moving alembic/ directory? +from alembic import context # type: ignore[attr-defined] from letsrolld import db from letsrolld.db import models diff --git a/alembic/versions/6583b50e5924_initial_tables.py b/alembic/versions/6583b50e5924_initial_tables.py index 2c8f53a..1190a6e 100644 --- a/alembic/versions/6583b50e5924_initial_tables.py +++ b/alembic/versions/6583b50e5924_initial_tables.py @@ -8,7 +8,8 @@ from typing import Sequence, Union -from alembic import op +# TODO: Fix type ignore by moving alembic/ directory? +from alembic import op # type: ignore[attr-defined] import sqlalchemy as sa diff --git a/src/letsrolld/db/models.py b/src/letsrolld/db/models.py index 87b3baf..0192477 100644 --- a/src/letsrolld/db/models.py +++ b/src/letsrolld/db/models.py @@ -14,7 +14,7 @@ ) -class Genre(Base): +class Genre(Base): # type: ignore[valid-type,misc] __tablename__ = "genres" id = Column(Integer, primary_key=True) @@ -29,14 +29,14 @@ class Genre(Base): ) -class Country(Base): +class Country(Base): # type: ignore[valid-type,misc] __tablename__ = "countries" id = Column(Integer, primary_key=True) name = Column(String, unique=True) -class FilmOffer(Base): +class FilmOffer(Base): # type: ignore[valid-type,misc] __tablename__ = "film_offer_association_table" film_id = mapped_column(ForeignKey("films.id"), primary_key=True) @@ -45,7 +45,7 @@ class FilmOffer(Base): url = Column(String, nullable=True) -class Offer(Base): +class Offer(Base): # type: ignore[valid-type,misc] __tablename__ = "offers" id = Column(Integer, primary_key=True) @@ -60,7 +60,7 @@ class Offer(Base): ) -class Film(Base): +class Film(Base): # type: ignore[valid-type,misc] __tablename__ = "films" id = Column(Integer, primary_key=True) @@ -97,7 +97,7 @@ def name(self): return self.title -class Director(Base): +class Director(Base): # type: ignore[valid-type,misc] __tablename__ = "directors" id = Column(Integer, primary_key=True)