From 77cd1759a23dba0072b01e180992747f9aae0788 Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Fri, 7 Feb 2025 17:30:36 +0100 Subject: [PATCH 1/6] ci: add mypy as pre-commit hook in .pre-commit-config.yaml --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5590ca5..ab8e62b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -17,3 +17,11 @@ repos: - id: conventional-pre-commit stages: [commit-msg] args: [ --verbose ] + + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v1.4.1 + hooks: + - id: mypy + entry: mypy fluster/ scripts/ + pass_filenames: false + args: [ --strict, --no-warn-unused-ignores, --ignore-missing-imports, --explicit-package-bases ] From 95fe790087a14a6fd416ea14edc5e06b26ceacc0 Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Fri, 7 Feb 2025 17:32:38 +0100 Subject: [PATCH 2/6] ci: change ruff pre-commit hook to automated fix mode --- .pre-commit-config.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ab8e62b..5a5a40f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,9 +7,8 @@ repos: rev: v0.9.2 hooks: - id: ruff - args: [ check ] + args: [ --fix ] - id: ruff-format - args: [ --check ] - repo: https://github.com/compilerla/conventional-pre-commit rev: v4.0.0 From 3114bb74a75af0ba519fdbf189a0cbfa34c7f52a Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Fri, 7 Feb 2025 17:35:52 +0100 Subject: [PATCH 3/6] chore: remove ruff and mypy packages from project requirements --- requirements.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/requirements.txt b/requirements.txt index 405c9d2..587040c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1 @@ -ruff==0.9.2 -mypy==1.4.1 pre-commit==2.21.0 From a1da2dc5064b7fe06b58e7032520392b4830f9d6 Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Fri, 7 Feb 2025 17:39:04 +0100 Subject: [PATCH 4/6] build: remove depedencies from pyproject.toml - removed optional-dependencies from project group. this group is meant for runtime deps of specific sw features --- pyproject.toml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2472834..27389dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,10 @@ build-backend = "setuptools.build_meta" [project] name = "fluster-conformance" -version = "0.2.0" # TODO: Ensure that version 0.2.0 is marked as the final version in the CI release workflow only when we are certain about deploying a new release. This prevents creating an irreversible history in PyPI, which would block re-uploading the same version. +# TODO: Ensure that version 0.x.0 is marked as the final version in the CI release workflow only when we are certain +# about deploying a new release. This prevents creating an irreversible history in PyPI, which would block re-uploading +# the same version. +version = "0.2.0" authors = [ {name = "Andoni Morales Alastruey", email="amorales@fluendo.com"}, # {name = "Pablo Marcos Oltra"}, wait to (https://github.com/pypi/warehouse/issues/12877) @@ -95,11 +98,9 @@ packages = ["fluster", "fluster.decoders"] "test_suites/vp9/VP9-TEST-VECTORS.json" ] -[project.optional-dependencies] -dev = [ - "ruff", - "mypy" -] +# Once https://github.com/pypa/pip/issues/12963 is implemented we can think about adding +# [dependency-groups] +# dev = ["pre-commit==2.21.0"] # https://docs.astral.sh/ruff/configuration/#configuring-ruff [tool.ruff] From 9ac1712f6fdd17c7867190d7dd885d7cc5584ba8 Mon Sep 17 00:00:00 2001 From: Michalis Dimopoulos Date: Fri, 7 Feb 2025 17:46:05 +0100 Subject: [PATCH 5/6] chore: remove mypy and ruff from Makefile - remove lint, lint-check and format targets from Makefile - clean obsolete variables in Makefile --- Makefile | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 3582c95..1725f89 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,3 @@ -PY_FILES=fluster scripts CONTRIB_DIR=contrib DECODERS_DIR=decoders PYTHONPATH=. @@ -16,7 +15,7 @@ help: install_deps: ## install Python dependencies python3 -m pip install -r requirements.txt -check: lint-check ## check that very basic tests run +check: ## check that very basic tests run @echo "Running dummy test..." $(FLUSTER) list $(FLUSTER) list -c @@ -50,18 +49,6 @@ ifneq ($(OS),Windows_NT) endif @echo "\nAll test finished succesfully!" -format: ## format python code - @echo "Formatting coding style with ruff..." - ruff format $(PY_FILES) - -lint: ## run static python code analysis - fix issues (manual fix, complements pre-commit) - @echo "Linting and fixing issues with ruff... " - ruff check --fix $(PY_FILES) - -lint-check: ## run static python code analysis - does not apply fixes - @echo "Checking static types with mypy..." - mypy --strict $(PY_FILES) - create_dirs=mkdir -p $(CONTRIB_DIR) $(DECODERS_DIR) all_reference_decoders: h264_reference_decoder h265_reference_decoder h266_reference_decoder mpeg_2_aac_reference_decoder mpeg_4_aac_reference_decoder ## build all reference decoders @@ -195,4 +182,4 @@ dbg-%: echo "Value of $* = $($*)" .PHONY: help all_reference_decoders h264_reference_decoder h265_reference_decoder h266_reference_decoder\ -mpeg_4_aac_reference_decoder mpeg_2_aac_reference_decoder check format lint lint-check install_deps clean +mpeg_4_aac_reference_decoder mpeg_2_aac_reference_decoder check install_deps clean From 043db7302b56f27ef9ea0de9d056ba23281f5fac Mon Sep 17 00:00:00 2001 From: mcesariniflu Date: Fri, 7 Feb 2025 14:04:12 +0100 Subject: [PATCH 6/6] chore: rename requirements.txt to requirements-dev.txt --- Makefile | 2 +- README.md | 4 ++-- requirements.txt => requirements-dev.txt | 0 3 files changed, 3 insertions(+), 3 deletions(-) rename requirements.txt => requirements-dev.txt (100%) diff --git a/Makefile b/Makefile index 1725f89..239a5a1 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ help: @awk -F ':|##' '/^[^\t].+?:.*?##/ { printf "\033[36m%-30s\033[0m %s\n", $$1, $$NF }' $(MAKEFILE_LIST) install_deps: ## install Python dependencies - python3 -m pip install -r requirements.txt + python3 -m pip install -r requirements-dev.txt check: ## check that very basic tests run @echo "Running dummy test..." diff --git a/README.md b/README.md index 3559090..5bee049 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ suites. ## Description Fluster requires **Python 3.6+** to work. It has zero dependencies apart from -that. The [requirements.txt](https://github.com/fluendo/fluster/blob/master/requirements.txt) file includes Python's modules +that. The [requirements-dev.txt](https://github.com/fluendo/fluster/blob/master/requirements-dev.txt) file includes Python's modules used only for development. The framework works with test suites. Each test suite is associated with one @@ -595,7 +595,7 @@ results are obtained, we can do the following procedure: 1. Fork the repo. 2. Install the required Python modules for development using `pip3 install -r - requirements.txt`. + requirements-dev.txt`. 3. Install the [git hook](https://github.com/fluendo/fluster/blob/master/scripts/install_git_hook.sh) that will run for every commit to ensure it works before pushing. [About git hooks](https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks). diff --git a/requirements.txt b/requirements-dev.txt similarity index 100% rename from requirements.txt rename to requirements-dev.txt