diff --git a/.github/workflows/pre-merge-tests.yml b/.github/workflows/pre-merge-tests.yml index 7164f84e..14222c69 100644 --- a/.github/workflows/pre-merge-tests.yml +++ b/.github/workflows/pre-merge-tests.yml @@ -12,21 +12,28 @@ on: env: PREMERGE_TEST_REPORT: pre_merge_test_report.html REPORT_DIRECTORY: reports + PYTHONUTF8: '1' jobs: pr_tests: - # runs-on: ${{ matrix.os }} - runs-on: [self-hosted, sdk-runner] + runs-on: ${{ matrix.os }} strategy: matrix: - # os: [ubuntu-latest, windows-latest] python-version: ['3.8', '3.9', '3.10'] + os: [ubuntu-latest, windows-latest, macos-latest] + exclude: + - os: macos-latest + python-version: '3.10' + - os: windows-latest + python-version: '3.10' fail-fast: true - max-parallel: 1 - steps: + max-parallel: 3 - - name: Checkout code with caching for Git LFS - uses: nschloe/action-cached-lfs-checkout@v1.2.0 + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + lfs: true - name: Set up Python uses: actions/setup-python@v4 @@ -41,23 +48,26 @@ jobs: - name: Create report directory # Creates the temporary directory that is used to store the test report run: | - mkdir $REPORT_DIRECTORY + mkdir -p env.REPORT_DIRECTORY - name: Check formatting with black run: black . --check - name: Check imports with isort run: isort . --check + if: ${{ always() }} - name: Flake8 linting run: flake8 . + if: ${{ always() }} - name: Pydocstyle linting run: pydocstyle geti_sdk --count + if: ${{ always() }} - name: Test with pytest run: | - pytest tests/pre-merge -c tests/offline.ini --cov=geti_sdk --html=$REPORT_DIRECTORY/$PREMERGE_TEST_REPORT --self-contained-html --cov-report html:$REPORT_DIRECTORY/coverage + pytest tests/pre-merge -c tests/offline.ini --cov=geti_sdk --html=env.REPORT_DIRECTORY/env.PREMERGE_TEST_REPORT --self-contained-html --cov-report html:env.REPORT_DIRECTORY/coverage - name: Upload test report for pre-merge tests # Publish the test report to github @@ -71,4 +81,4 @@ jobs: # Remove temporary report directory if: ${{ always() }} run: | - rm -r $REPORT_DIRECTORY + rm -r env.REPORT_DIRECTORY diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba52069e..91206205 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,7 +12,7 @@ repos: # Code formatting - repo: https://github.com/psf/black - rev: 23.3.0 + rev: 24.1.1 hooks: - id: black diff --git a/geti_sdk/benchmarking/benchmarker.py b/geti_sdk/benchmarking/benchmarker.py index 377b9118..00d88861 100644 --- a/geti_sdk/benchmarking/benchmarker.py +++ b/geti_sdk/benchmarking/benchmarker.py @@ -923,9 +923,11 @@ def compare_predictions( "run_name": f"Deployment {deployment_index}", "model_1": deployment.models[0].name, "model_1_score": model_scores[0], - "fps": None - if throughput_benchmark_results is None - else throughput_benchmark_results[deployment_index]["fps"], + "fps": ( + None + if throughput_benchmark_results is None + else throughput_benchmark_results[deployment_index]["fps"] + ), } if not self._is_single_task: model_info.update( diff --git a/geti_sdk/data_models/configurable_parameter_group.py b/geti_sdk/data_models/configurable_parameter_group.py index fb0ccf99..14d9f237 100644 --- a/geti_sdk/data_models/configurable_parameter_group.py +++ b/geti_sdk/data_models/configurable_parameter_group.py @@ -145,9 +145,9 @@ def from_dict(cls, input_dict: Dict[str, Any]) -> "ParameterGroup": input_dict """ input_copy = copy.deepcopy(input_dict) - parameter_dicts: List[ - Union[Dict[str, Any], ConfigurableParameter] - ] = input_copy.pop("parameters", []) + parameter_dicts: List[Union[Dict[str, Any], ConfigurableParameter]] = ( + input_copy.pop("parameters", []) + ) group_dicts: List[Union[Dict[str, Any], ParameterGroup]] = input_copy.pop( "groups", [] ) diff --git a/geti_sdk/data_models/job.py b/geti_sdk/data_models/job.py index 0fe6c9d9..9ae83801 100644 --- a/geti_sdk/data_models/job.py +++ b/geti_sdk/data_models/job.py @@ -162,9 +162,9 @@ class JobMetadata: scores: Optional[List[ScoreMetadata]] = None trained_model: Optional[ModelMetadata] = None # Added in Geti v1.7 warnings: Optional[List[dict]] = None # Added in Geti v1.13 for dataset import jobs - supported_project_types: Optional[ - List[dict] - ] = None # Added in Geti v1.13 for dataset import jobs + supported_project_types: Optional[List[dict]] = ( + None # Added in Geti v1.13 for dataset import jobs + ) project_id: Optional[str] = None # Added in Geti v1.13 for dataset import jobs diff --git a/geti_sdk/geti.py b/geti_sdk/geti.py index 69dbdb0d..8869c085 100644 --- a/geti_sdk/geti.py +++ b/geti_sdk/geti.py @@ -765,9 +765,11 @@ def create_task_chain_project_from_dataset( regarding the uploaded project """ labels_per_task = [ - entry.get_all_label_names() - if isinstance(entry, AnnotationReader) - else entry + ( + entry.get_all_label_names() + if isinstance(entry, AnnotationReader) + else entry + ) for entry in label_source_per_task ] annotation_readers_per_task = [ diff --git a/requirements/requirements-dev.txt b/requirements/requirements-dev.txt index 1ec0b369..df6dee85 100644 --- a/requirements/requirements-dev.txt +++ b/requirements/requirements-dev.txt @@ -7,7 +7,7 @@ pytest-env==1.0.* pytest-html==3.2.* flake8==6.0.* pydocstyle>=6.1 -black>=22.6 +black>=24.1 isort>=5.12 pre-commit>=3.5 nbqa>=1.7.0