Skip to content

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

Merged
BKDDFS merged 43 commits intodevfrom
feat/docker-macos-arm64-support
Jan 30, 2026
Merged

feat!: Modernize codebase & fix V2 user issues#50
BKDDFS merged 43 commits intodevfrom
feat/docker-macos-arm64-support

Conversation

@BKDDFS
Copy link
Owner

@BKDDFS BKDDFS commented Jan 29, 2026

No description provided.

BKDDFS and others added 21 commits September 12, 2024 16:44
Standardize imports
- 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.
- 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
…ct 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)
- 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
- 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
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.
- Add unit tests for app.py endpoints
- Add --cov=perfectframe --cov-fail-under=100 to pytest
- Remove unused if __name__ == "__main__" block
- 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
- Remove redundant Args sections from docstrings (types are self-documenting)
- Remove "Built with" section from README
- Add usage comments to dependencies in pyproject.toml
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.
Set _active_extractor immediately after check in start_extractor
instead of inside background task to prevent concurrent requests
from bypassing the single-extractor constraint.
Replace str | None with ExtractorName | None in ExtractorStatus
and ExtractorManager for type consistency across the codebase.
- 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
- 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
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.
@github-advanced-security
Copy link

This pull request sets up GitHub code scanning for this repository. Once the scans have completed and the checks have passed, the analysis results for this pull request branch will appear on this overview. Once you merge this pull request, the 'Security' tab will show more code scanning analysis results (for example, for the default branch). Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results. For more information about GitHub code scanning, check out the documentation.

@BKDDFS BKDDFS force-pushed the feat/docker-macos-arm64-support branch from 2efa4b6 to 65a5d2d Compare January 29, 2026 13:20
BKDDFS added 16 commits January 29, 2026 23:31
- 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
Enable automatic dependency updates for Python packages managed by uv.
- 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)
- Move GitHub stars badge to the end
- Add flat style to OpenSSF Scorecard badge
- Use shields.io proxy for SonarCloud badge for consistent styling
Remove OpenSSF Scorecard and SonarCloud Quality Gate badges
to ensure all badges fit on one line.
@sonarqubecloud
Copy link

@BKDDFS BKDDFS merged commit ac5da65 into dev Jan 30, 2026
9 checks passed
BKDDFS added a commit that referenced this pull request Jan 30, 2026
* feat: make it works for macbook developers and breake gpu support for now

* feat: migrate from poetry to uv

* feat: migrate form pylint to ruff

* feat!: Modernize codebase & fix V2 user issues (#50)

* 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.

---------

Co-authored-by: Bartlomiej Flis <b.flis@omniviser.ai>
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.

1 participant