Skip to content

feat!: Modernize codebase & fix V2 user issues#55

Merged
BKDDFS merged 4 commits intomainfrom
dev
Jan 30, 2026
Merged

feat!: Modernize codebase & fix V2 user issues#55
BKDDFS merged 4 commits intomainfrom
dev

Conversation

@BKDDFS
Copy link
Owner

@BKDDFS BKDDFS commented Jan 30, 2026

Describe your changes

Fixes # (issue)

Checklist before requesting a review

  • I have performed a self-review of my code
  • I add tests (if needed)
  • I add docstrings (if needed)

bflisomniviser and others added 4 commits January 18, 2025 21:08
* Fix E2E tests on macOS ARM64 by using multi-arch base image

- Add _is_macos_arm64() helper to detect Apple Silicon
- Conditionally apply --platform linux/amd64 flag only on non-ARM64 systems
- Handle ConnectionResetError in service_initializer for startup timing
- Add unit tests for ARM64 detection and conditional platform behavior

This allows native ARM64 builds on Apple Silicon while maintaining
AMD64 compatibility elsewhere.

* refactor: simplify architecture - use docker-compose directly

- Remove service_manager module (Python wrapper around Docker)
- Remove config.py and start.py entry points
- Users now use docker-compose directly
- Migrate Dockerfile to uv 0.9.26 for faster builds
- Upgrade Python 3.12 → 3.13
- Upgrade TensorFlow 2.18.0 → 2.20.0
- Update documentation with new usage instructions
- Fix Docker build context for uv.lock access

* refactor: rename extractor_service to perfectframe and simplify project structure

Module changes:
- Rename extractor_service/ to perfectframe/
- Move main.py to app.py as the FastAPI entry point
- Update all internal imports to use perfectframe module

Project structure:
- Move Dockerfile from extractor_service/ to project root
- Remove extractor_service/.dockerignore (no longer needed)
- Remove extractor_service/requirements.txt (using pyproject.toml)
- Remove .github/README.pl.md (Polish README)

Test reorganization:
- Flatten test structure from tests/extractor_service/* and tests/service_manager/*
  to tests/unit/, tests/integration/, tests/e2e/
- Merge common test fixtures into tests/common.py
- Update all test imports to use perfectframe module
- Rename docker e2e tests for clarity (docker_best_frames_extractor_test.py, etc.)

Configuration updates:
- Update docker-compose.yaml to use root Dockerfile
- Update pyproject.toml with new module path
- Update .github/workflows/run_tests.yml for new test paths
- Add perfectframe/ to .gitignore patterns
- Exclude perfectframe/ from ty pre-commit check (isolated env lacks dependencies)

* feat: migrate from TensorFlow to ONNX Runtime

- Replace TensorFlow (~500MB) with ONNX Runtime (~50MB)
- Update Python to 3.14.2 and all dependencies to latest versions
- Add conversion scripts for model weights (TF -> ONNX)
- Update Dockerfile with fixed versions for production
- Reduce Docker image size by ~450MB

* chore: configure Ruff linter and pre-commit hooks

- Add .pre-commit-config.yaml with ruff, docformatter, detect-secrets, pytest
- Configure ruff in pyproject.toml with ALL rules and sensible ignores
- Add docstrings to all modules and public functions (Google style)
- Fix all linting issues: RET504, PLR2004, D401, D205, D404
- Migrate tests from unittest.mock to pytest-mock
- Add pytest-mock to test dependencies
- Remove obsolete scripts/ directory (ONNX conversion)
- Add .secrets.baseline for detect-secrets
- Update .gitignore with *.onnx, *.h5

* fix: resolve ty type checker errors in pre-commit

Remove return type annotations from yield-based pytest fixtures that ty
incorrectly infers as generators. Exclude tests/ from ty-check since test
files use dev dependencies not available in pre-commit environment.

* chore: update Python target version to 3.13

* test: enforce 100% coverage in CI and pre-commit

- Add unit tests for app.py endpoints
- Add --cov=perfectframe --cov-fail-under=100 to pytest
- Remove unused if __name__ == "__main__" block

* feat: switch to onnxruntime-gpu with automatic GPU/CPU fallback

- Change onnxruntime to onnxruntime-gpu for CUDA support (Linux/Windows)
- Keep onnxruntime for macOS (no CUDA support on Apple Silicon)
- Rename docker-compose services: extractor_service -> perfectframe
- Remove TensorFlow leftover environment variable
- Add CPU Mode and GPU Mode sections to README
- Update Built with section: Tensorflow -> ONNX Runtime

* refactor: clean up docstrings and README

- Remove redundant Args sections from docstrings (types are self-documenting)
- Remove "Built with" section from README
- Add usage comments to dependencies in pyproject.toml

* refactor: improve type annotations and add runtime type checks

Replace type: ignore comments with proper runtime checks and add type
aliases (Image, Images, ImagesBatch, ScoresArray) for better code clarity.
Fix tuple type annotations and Generator return type.

* fix: race condition between extractor check and flag set

Set _active_extractor immediately after check in start_extractor
instead of inside background task to prevent concurrent requests
from bypassing the single-extractor constraint.

* refactor: use ExtractorName enum for active_extractor type

Replace str | None with ExtractorName | None in ExtractorStatus
and ExtractorManager for type consistency across the codebase.

* refactor: improve type annotations in video_processors

- Rename batch_size to frames_batch_size in get_next_frames
- Use Images type for frames batch return type
- Use Image type for _read_next_frame return
- Skip None frames when building batch
- Remove unused numpy import

* refactor: rename target_image_size to input_size with ImageResolution type

* fix: update tests and code to use enum .value for string representation

- Fix extractor_manager to use .value when building error messages
- Update unit tests to expect enum .value in assertions
- Update integration tests to use ImageExtension/VideoExtension enums
  instead of removed config attributes
- Use ExtractorName enum instead of string in integration test
- Remove unused config fixture arguments from tests
- Remove curl from Dockerfile and healthcheck from docker-compose

* docs: improve README Usage section, remove Tests/Roadmap/Polski

* refactor: merge InceptionResNetNIMA and _ONNXModel into NIMAEvaluator

Consolidate legacy class structure after TensorFlow to ONNX migration.
The InceptionResNetNIMA name was misleading as it no longer reflects
architecture-specific knowledge - it's now a generic ONNX loader.

* ci: add release-please and PR title validation

* feat: add Docker macOS ARM64 support and CI improvements

* ci: add SBOM attestation and versioned filename on release

* ci: add OpenSSF Scorecard workflow

* docs: add OpenSSF Scorecard badge

* ci: replace lint job with pre-commit in CI workflow

Replace separate ruff/ty lint job with pre-commit/action to run all
pre-commit hooks in CI, ensuring checks can't be bypassed with --no-verify.
Test jobs now depend on pre-commit passing first.

* ci: add dev branch to CI and CodeQL workflows

* ci: add SonarCloud integration

* security: move workflow permissions to job level

* ci: pin trivy-action to v0.28.0

* ci: add --group test to uv run commands

* ci: add pytest-timeout to test dependencies

* ci: update all GitHub Actions to latest versions

* ci: fix docker image name for Trivy scanner

* ci: remove SonarCloud CI workflow in favor of Automatic Analysis

* security: run container as non-root user

* fix: ensure proper permissions for non-root container user

* fix: address silent failures, typos, and license inconsistency

- Add exception logging in ExtractorManager.__run_extractor()
- Check cv2.imwrite() return value and log errors on failure
- Fix test bug: add missing parentheses to assert_not_called()
- Fix typo: rename compering_group_size to comparing_group_size
- Fix typo: change "ulr" to "url" in log message
- Update license in pyproject.toml from GPL-3.0 to Apache-2.0
- Add requests.RequestException handling for model download

* refactor: merge consecutive RUN instructions in Dockerfile

* ci: add uv package ecosystem to Dependabot

Enable automatic dependency updates for Python packages managed by uv.

* chore: change license from GPL v3 to Apache 2.0

- Replace LICENSE.md with Apache License 2.0 text
- Remove GPL license blocks from Python module docstrings
- Update README license reference and add v3.0 to comparison table
- Remove license badge (GitHub displays it automatically)

* fix: improve README badge consistency and order

- Move GitHub stars badge to the end
- Add flat style to OpenSSF Scorecard badge
- Use shields.io proxy for SonarCloud badge for consistent styling

* fix: remove wide badges for single-line layout

Remove OpenSSF Scorecard and SonarCloud Quality Gate badges
to ensure all badges fit on one line.
@sonarqubecloud
Copy link

Quality Gate Failed Quality Gate failed

Failed conditions
5 Security Hotspots

See analysis details on SonarQube Cloud

@BKDDFS BKDDFS changed the title Dev feat!: Modernize codebase & fix V2 user issues Jan 30, 2026
@BKDDFS BKDDFS merged commit 20637d5 into main Jan 30, 2026
14 of 18 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