diff --git a/.github/labeler.yaml b/.github/labeler.yaml index f556e7e0..47b84014 100644 --- a/.github/labeler.yaml +++ b/.github/labeler.yaml @@ -1,33 +1,33 @@ tests: - changed-files: - - any-glob-to-any-file: 'tests/*' + - any-glob-to-any-file: "tests/*" - head-branch: - - 'test/*' - - 'tests/*' + - "test/*" + - "tests/*" DevOps: - changed-files: - - any-glob-to-any-file: '.github/*' + - any-glob-to-any-file: ".github/*" CLI: - changed-files: - - any-glob-to-any-file: '**/__main__.py' + - any-glob-to-any-file: "**/__main__.py" documentation: - changed-files: - - any-glob-to-any-file: '**/*.md' + - any-glob-to-any-file: "**/*.md" enhancement: - head-branch: - - 'feature/*' - - 'feat/*' - - 'enhancement/*' + - "feature/*" + - "feat/*" + - "enhancement/*" fix: - head-branch: - - 'fix/*' - - 'bug/*' - - 'hotfix/*' - - 'issue/*' - - 'bugfix/*' - - 'patch/*' + - "fix/*" + - "bug/*" + - "hotfix/*" + - "issue/*" + - "bugfix/*" + - "patch/*" diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index b092747c..ac57f492 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -4,12 +4,12 @@ on: workflow_dispatch: pull_request: paths: - - 'requirements.txt' - - 'pyproject.toml' - - 'luxonis_train/**' - - 'tests/**' - - .github/workflows/ci.yaml - - '!**/*.md' + - "requirements.txt" + - "pyproject.toml" + - "luxonis_train/**" + - "tests/**" + - ".github/workflows/ci.yaml" + - "!**/*.md" concurrency: group: ${{ github.workflow }}-${{ github.ref }} @@ -24,16 +24,16 @@ jobs: pre-commit: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} - - name: Install pre-commit - run: python -m pip install 'pre-commit<4.0.0' + - name: Install pre-commit + run: python -m pip install 'pre-commit<4.0.0' - - name: Run pre-commit - uses: pre-commit/action@v3.0.1 + - name: Run pre-commit + uses: pre-commit/action@v3.0.1 docs: needs: @@ -56,33 +56,33 @@ jobs: - pre-commit runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - cache: pip - - - name: Install dependencies - run: pip install -e .[dev] - - - name: Install dev version of LuxonisML - if: startsWith(github.head_ref, 'release/') == false - run: | - pip uninstall luxonis-ml -y - pip install "luxonis-ml[data,tracker] @ git+https://github.com/luxonis/luxonis-ml.git@main" - - - name: Pyright check - uses: jakebailey/pyright-action@v2 - with: - level: warning - warnings: true - python-version: '3.10' - project: pyproject.toml + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: pip + + - name: Install dependencies + run: pip install -e .[dev] + + - name: Install dev version of LuxonisML + if: startsWith(github.head_ref, 'release/') == false + run: | + pip uninstall luxonis-ml -y + pip install "luxonis-ml[data,tracker] @ git+https://github.com/luxonis/luxonis-ml.git@main" + + - name: Pyright check + uses: jakebailey/pyright-action@v2 + with: + level: warning + warnings: true + python-version: "3.10" + project: pyproject.toml # Tests that the `luxonis-train.config.Config` works # even when the dependencies of `luxonis-train` are @@ -95,32 +95,32 @@ jobs: - docs steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - cache: pip - - - name: Install released version of LuxonisML - if: startsWith(github.head_ref, 'release/') == true - run: pip install luxonis-ml[utils] - - - name: Install dev version of LuxonisML - if: startsWith(github.head_ref, 'release/') == false - run: | - pip install "luxonis-ml[utils] @ git+https://github.com/luxonis/luxonis-ml.git@main" - - - name: Test config without dependencies - run: | - pip install semver~=3.0 pydantic-extra-types~=2.10 - pip install -e . --no-deps - python -c 'from luxonis_train.config import Config; \ - Config.get_config("configs/complex_model.yaml")' + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: pip + + - name: Install released version of LuxonisML + if: startsWith(github.head_ref, 'release/') == true + run: pip install luxonis-ml[utils] + + - name: Install dev version of LuxonisML + if: startsWith(github.head_ref, 'release/') == false + run: | + pip install "luxonis-ml[utils] @ git+https://github.com/luxonis/luxonis-ml.git@main" + + - name: Test config without dependencies + run: | + pip install semver~=3.0 pydantic-extra-types~=2.10 + pip install -e . --no-deps + python -c 'from luxonis_train.config import Config; \ + Config.get_config("configs/complex_model.yaml")' tests: needs: @@ -133,59 +133,59 @@ jobs: runs-on: ${{ matrix.suite == 'unit' && 'ubuntu-latest' || 'ubuntu-t4-4core' }} steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.head_ref }} - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - cache: pip - - - name: Install dependencies - run: pip install -e .[dev] - - - name: Install dev version of LuxonisML - if: startsWith(github.head_ref, 'release/') == false - run: | - pip uninstall luxonis-ml -y - pip install "luxonis-ml[data,tracker] @ git+https://github.com/luxonis/luxonis-ml.git@main" - - - name: Authenticate to Google Cloud - id: google-auth - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} - create_credentials_file: true - export_environment_variables: true - token_format: access_token - - - name: Run pytest - env: - LUXONISML_BUCKET: luxonis-test-bucket - SUITE: ${{ matrix.suite }} - HUBAI_API_KEY: ${{ secrets.HUBAI_API_KEY }} - run: pytest -x --cov --junitxml=junit.xml -o junit_family=legacy -m "${SUITE}" - - - name: Upload test results to Codecov - uses: codecov/test-results-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: false - flags: ${{ matrix.suite }} - - - name: Upload coverage results to Codecov - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: false - flags: ${{ matrix.suite }} - - - name: Upload coverage as artifact - uses: actions/upload-artifact@v4 - with: - name: coverage-${{ matrix.suite }} - path: coverage.xml - overwrite: true + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: pip + + - name: Install dependencies + run: pip install -e .[dev] + + - name: Install dev version of LuxonisML + if: startsWith(github.head_ref, 'release/') == false + run: | + pip uninstall luxonis-ml -y + pip install "luxonis-ml[data,tracker] @ git+https://github.com/luxonis/luxonis-ml.git@main" + + - name: Authenticate to Google Cloud + id: google-auth + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + create_credentials_file: true + export_environment_variables: true + token_format: access_token + + - name: Run pytest + env: + LUXONISML_BUCKET: luxonis-test-bucket + SUITE: ${{ matrix.suite }} + HUBAI_API_KEY: ${{ secrets.HUBAI_API_KEY }} + run: pytest -x --cov --junitxml=junit.xml -o junit_family=legacy -m "${SUITE}" + + - name: Upload test results to Codecov + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + flags: ${{ matrix.suite }} + + - name: Upload coverage results to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false + flags: ${{ matrix.suite }} + + - name: Upload coverage as artifact + uses: actions/upload-artifact@v4 + with: + name: coverage-${{ matrix.suite }} + path: coverage.xml + overwrite: true diff --git a/.github/workflows/python-publish.yaml b/.github/workflows/python-publish.yaml index a88a297f..9ca33748 100644 --- a/.github/workflows/python-publish.yaml +++ b/.github/workflows/python-publish.yaml @@ -12,23 +12,23 @@ jobs: deploy: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install build + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build - - name: Build package - run: python -m build + - name: Build package + run: python -m build - - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 - with: - user: __token__ - password: ${{ secrets.PYPI_API_TOKEN }} + - name: Publish package + uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/semgrep.yaml b/.github/workflows/semgrep.yaml index 94099dd4..67ce581c 100644 --- a/.github/workflows/semgrep.yaml +++ b/.github/workflows/semgrep.yaml @@ -27,10 +27,10 @@ jobs: uses: actions/checkout@v4 - name: Perform Semgrep Analysis - # @NOTE: This is the actual semgrep command to scan your code. - # Modify the --config option to 'r/all' to scan using all rules, - # or use multiple flags to specify particular rules, such as - # --config r/all --config custom/rules + # @NOTE: This is the actual semgrep command to scan your code. + # Modify the --config option to 'r/all' to scan using all rules, + # or use multiple flags to specify particular rules, such as + # --config r/all --config custom/rules run: semgrep scan -q --sarif --config auto --config "p/secrets" . > semgrep-results.sarif - name: Pretty-Print SARIF Output diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 792433fc..27792faa 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -4,33 +4,33 @@ on: workflow_dispatch: inputs: ml_ref: - description: 'luxonis-ml version (branch/tag/SHA)' - required: true - default: main + description: "luxonis-ml version (branch/tag/SHA)" + required: true + default: main train_ref: - description: 'luxonis-train version (branch/tag/SHA)' - required: true - default: main + description: "luxonis-train version (branch/tag/SHA)" + required: true + default: main workflow_call: inputs: ml_ref: - description: 'luxonis-ml version (branch/tag/SHA)' + description: "luxonis-ml version (branch/tag/SHA)" required: true type: string train_ref: - description: 'luxonis-train version (branch/tag/SHA)' + description: "luxonis-train version (branch/tag/SHA)" required: true type: string secrets: GOOGLE_APPLICATION_CREDENTIALS: - description: 'GCP service-account JSON' + description: "GCP service-account JSON" required: true CODECOV_TOKEN: - description: 'Codecov upload token' + description: "Codecov upload token" required: true HUBAI_API_KEY: - description: 'HubAI API key' + description: "HubAI API key" required: true permissions: @@ -48,66 +48,66 @@ jobs: runs-on: ${{ matrix.os }} steps: - - name: Checkout - uses: actions/checkout@v4 - with: - repository: Luxonis/luxonis-train - ref: ${{ inputs.train_ref }} - path: luxonis-train + - name: Checkout + uses: actions/checkout@v4 + with: + repository: Luxonis/luxonis-train + ref: ${{ inputs.train_ref }} + path: luxonis-train - - name: Free Disk Space (Ubuntu) - if: matrix.os == 'ubuntu-latest' - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - large-packages: false + - name: Free Disk Space (Ubuntu) + if: matrix.os == 'ubuntu-latest' + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + large-packages: false - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.10' - cache: pip + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + cache: pip - - name: Install dependencies - working-directory: luxonis-train - run: pip install -e .[dev] + - name: Install dependencies + working-directory: luxonis-train + run: pip install -e .[dev] - - name: Install specified luxonis-ml - shell: bash - env: - ML_REF: ${{ inputs.ml_ref }} - run: | - pip uninstall luxonis-ml -y - pip install \ - "luxonis-ml[data,tracker] @ git+https://github.com/luxonis/luxonis-ml.git@${ML_REF}" \ - --upgrade --force-reinstall + - name: Install specified luxonis-ml + shell: bash + env: + ML_REF: ${{ inputs.ml_ref }} + run: | + pip uninstall luxonis-ml -y + pip install \ + "luxonis-ml[data,tracker] @ git+https://github.com/luxonis/luxonis-ml.git@${ML_REF}" \ + --upgrade --force-reinstall - - name: Authenticate to Google Cloud - id: google-auth - uses: google-github-actions/auth@v2 - with: - credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} - create_credentials_file: true - export_environment_variables: true - token_format: access_token + - name: Authenticate to Google Cloud + id: google-auth + uses: google-github-actions/auth@v2 + with: + credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} + create_credentials_file: true + export_environment_variables: true + token_format: access_token - - name: Run pytest - working-directory: luxonis-train - env: - LUXONISML_BUCKET: luxonis-test-bucket - HUBAI_API_KEY: ${{ secrets.HUBAI_API_KEY }} - run: pytest --cov --junitxml=junit.xml -o junit_family=legacy + - name: Run pytest + working-directory: luxonis-train + env: + LUXONISML_BUCKET: luxonis-test-bucket + HUBAI_API_KEY: ${{ secrets.HUBAI_API_KEY }} + run: pytest --cov --junitxml=junit.xml -o junit_family=legacy - - name: Upload test results to Codecov - if: matrix.os == 'ubuntu-t4-4core' - uses: codecov/test-results-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: false + - name: Upload test results to Codecov + if: matrix.os == 'ubuntu-t4-4core' + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false - - name: Upload coverage results to Codecov - if: matrix.os == 'ubuntu-t4-4core' - uses: codecov/codecov-action@v4 - with: - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: false + - name: Upload coverage results to Codecov + if: matrix.os == 'ubuntu-t4-4core' + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: false diff --git a/.github/workflows/update-cov-report.yaml b/.github/workflows/update-cov-report.yaml index 3c6aa04a..2490ce08 100644 --- a/.github/workflows/update-cov-report.yaml +++ b/.github/workflows/update-cov-report.yaml @@ -2,7 +2,7 @@ name: Update Coverage Report on: push: - branches: [ main ] + branches: [main] jobs: update-base-report: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1d882e20..458b0d49 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -24,6 +24,12 @@ repos: additional_dependencies: - mdformat-gfm + - repo: https://github.com/JoC0de/pre-commit-prettier + rev: v3.8.1 + hooks: + - id: prettier + types_or: [yaml] + - repo: https://github.com/ComPWA/taplo-pre-commit rev: v0.9.3 diff --git a/configs/anomaly_detection_model.yaml b/configs/anomaly_detection_model.yaml index af06f905..06afe1a7 100644 --- a/configs/anomaly_detection_model.yaml +++ b/configs/anomaly_detection_model.yaml @@ -8,7 +8,7 @@ loader: name: LuxonisLoaderPerlinNoise params: dataset_name: mvtec_v2 - anomaly_source_path: "../data/dtd/images/" + anomaly_source_path: "../data/dtd/images/" trainer: preprocessing: diff --git a/configs/complex_model.yaml b/configs/complex_model.yaml index d6a2f9d7..d12c011f 100644 --- a/configs/complex_model.yaml +++ b/configs/complex_model.yaml @@ -1,6 +1,5 @@ # An example configuration for a more complex network. - model: name: complex_model nodes: diff --git a/configs/example_tuning.yaml b/configs/example_tuning.yaml index 8f15852e..b85ee6fd 100644 --- a/configs/example_tuning.yaml +++ b/configs/example_tuning.yaml @@ -42,4 +42,5 @@ tuner: trainer.optimizer.name_categorical: ["Adam", "SGD"] trainer.optimizer.params.lr_float: [0.0001, 0.001] trainer.batch_size_int: [4, 16, 4] - trainer.preprocessing.augmentations_subset: [["Defocus", "Sharpen", "VerticalFlip"], 2] + trainer.preprocessing.augmentations_subset: + [["Defocus", "Sharpen", "VerticalFlip"], 2] diff --git a/requirements.txt b/requirements.txt index 4ad224d3..eae5a7a8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,7 +3,7 @@ cyclopts~=4.2 faster-coco-eval~=1.7 grad-cam~=1.5 lightning~=2.5 -luxonis-ml[data,tracker,s3,gcs,roboflow]>=0.8.1 +luxonis-ml[data,tracker,s3,gcs,roboflow]>=0.8.2 mlflow~=3.6 onnxruntime~=1.23 onnxscript~=0.5 @@ -21,4 +21,4 @@ tensorboard~=2.20 termcolor~=3.2 torchmetrics~=1.8 torchvision~=0.24 -hubai-sdk +hubai-sdk>=0.2.1