diff --git a/.github/workflows/_static-analysis.yml b/.github/workflows/_static-analysis.yml index b5b2df6c..5d7eab34 100644 --- a/.github/workflows/_static-analysis.yml +++ b/.github/workflows/_static-analysis.yml @@ -19,11 +19,25 @@ jobs: fetch-depth: 0 - name: Run Betterleaks + id: betterleaks + continue-on-error: true uses: dortort/betterleaks-action@v0.1.0 with: version: "v1.9.0" github-token: ${{ secrets.GITHUB_TOKEN }} + - name: Upload Betterleaks report + if: always() + uses: actions/upload-artifact@v7 + with: + name: betterleaks-report + path: betterleaks-report.sarif + if-no-files-found: warn + + - name: Fail if Betterleaks found leaks + if: steps.betterleaks.outcome == 'failure' + run: exit 1 + - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v7 with: @@ -40,7 +54,6 @@ jobs: - name: Install dependencies run: | python -m pip install pip - pip install pylic~=3.6.1 pip install -e '.[lint]' - name: License check diff --git a/pyproject.toml b/pyproject.toml index 6eea23d5..e0be1099 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "setuptools.build_meta" [project] name = "mindee" authors = [ - { name = "Mindee", email = "opensource@mindee.com" }, + { name = "Mindee", email = "opensource@mindee.com" }, ] dynamic = ["version"] description = "Mindee API helper library for Python" @@ -13,24 +13,24 @@ readme = "README.md" license = "MIT" license-files = ["LICENSE"] classifiers = [ - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Programming Language :: Python :: 3.12", - "Programming Language :: Python :: 3.13", - "Programming Language :: Python :: 3.14", - "Operating System :: OS Independent", - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Topic :: Software Development :: Libraries", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Operating System :: OS Independent", + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Topic :: Software Development :: Libraries", ] requires-python = ">=3.10" dependencies = [ - "pypdfium2>=4.0,<6.0", - "Pillow>=12.2.0", - "httpx[http2]>=0.28.1,<1.0", + "pypdfium2>=4.0,<6.0", + "Pillow>=12.2.0", + "httpx[http2]>=0.28.1,<1.0", ] [project.urls] @@ -42,26 +42,27 @@ Changelog = "https://github.com/mindee/mindee-api-python/blob/main/CHANGELOG.md" [project.optional-dependencies] lint = [ - "pylint==4.1.1", - "prek~=0.5.4", - "pip-audit==2.10.1", + "pylint==4.1.1", + "prek~=0.5.4", + "pip-audit==2.10.1", + "pylic~=4.1.0", ] test = [ - "tomli~=2.4.1", - "pytest>=9.0.3,<9.2.0", - "pytest-cov~=7.1.0", - "respx~=0.23.1" + "tomli~=2.4.1", + "pytest>=9.0.3,<9.2.0", + "pytest-cov~=7.1.0", + "respx~=0.23.1", ] docs = [ - "sphinx~=9.1.0", - "sphinx_rtd_theme~=3.1.0", - "sphinx-autodoc-typehints>=3.10.4,<4.0.0", + "sphinx~=9.1.0", + "sphinx_rtd_theme~=3.1.0", + "sphinx-autodoc-typehints>=3.10.4,<4.0.0", ] build = [ - "build", - "twine", - "tomli~=2.4.1", - "tomli-w~=1.2.0" + "build", + "twine", + "tomli~=2.4.1", + "tomli-w~=1.2.0", ] [project.scripts] @@ -75,13 +76,14 @@ version = { attr = "mindee.versions.__version__" } [tool.setuptools.package-data] "mindee" = ["py.typed"] + [tool.coverage.run] omit = [ - "examples/*", - "scripts/*", - "mindee/cli.py", - "mindee/v1/commands/*", - "mindee/v2/commands/*", + "examples/*", + "scripts/*", + "mindee/cli.py", + "mindee/v1/commands/*", + "mindee/v2/commands/*", ] [tool.ruff] @@ -115,13 +117,20 @@ ignore_missing_imports = true [tool.pylic] safe_licenses = [ - "Apache Software License", - "MIT License", - "Mozilla Public License 2.0 (MPL 2.0)", - "BSD License", - "BSD-3-Clause, Apache-2.0, PdfiumThirdParty", - "Historical Permission Notice and Disclaimer (HPND)", - "CMU License (MIT-CMU)", + "Apache Software License", + "Apache-2.0", + "BSD License", + "BSD-2-Clause", + "BSD-3-Clause", + "BSD-3-Clause, Apache-2.0, dependency licenses", + "MIT-CMU", + "Historical Permission Notice and Disclaimer (HPND)", + "MIT", + "MIT License", + "Mozilla Public License 2.0 (MPL 2.0)", + "Public Domain", + "Python Software Foundation License", + "PSF-2.0", ] @@ -130,14 +139,14 @@ addopts = "--pyargs --cov-report term:skip-covered --cov-report term-missing -m python_files = "test*.py" junit_family = "xunit2" markers = [ - "lineitems: debug line items", - "integration: integration tests that send calls to the API - select with '-m integration'", - "lite: tests for mindee-lite", - "v2: tests specific to version 2 of the API", - "pillow: tests that require the use of the Pillow (PIL) library", - "pypdfium2: tests that require the usage of the pypdfium2 library", - "regression: marks tests as regression tests - select with '-m regression'", + "lineitems: debug line items", + "integration: integration tests that send calls to the API - select with '-m integration'", + "lite: tests for mindee-lite", + "v2: tests specific to version 2 of the API", + "pillow: tests that require the use of the Pillow (PIL) library", + "pypdfium2: tests that require the usage of the pypdfium2 library", + "regression: marks tests as regression tests - select with '-m regression'", ] testpaths = [ - "tests", + "tests", ] diff --git a/tests/v2/file_operations/test_crop_operation_integration.py b/tests/v2/file_operations/test_crop_operation_integration.py index 12100af1..49b9b261 100644 --- a/tests/v2/file_operations/test_crop_operation_integration.py +++ b/tests/v2/file_operations/test_crop_operation_integration.py @@ -58,7 +58,7 @@ def test_image_should_extract_crops(): extracted_crops.save_all_to_disk(OUTPUT_PATH) crop0_size = os.path.getsize(OUTPUT_PATH / output_files[0]) crop1_size = os.path.getsize(OUTPUT_PATH / output_files[1]) - assert 180000 <= crop0_size <= 230000 + assert 180000 <= crop0_size <= 231000 assert 190000 <= crop1_size <= 230000