Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-docs-${{ hashFiles('setup.cfg') }}
key: ${{ runner.os }}-docs-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-docs-
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/license.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.8"]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4

Expand All @@ -26,16 +26,16 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-lic-${{ hashFiles('**/setup.cfg') }}
key: ${{ runner.os }}-lic-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-lic-

- name: Install dependencies
run: |
python -m pip install pip
pip install pylic~=2.2
pip install pylic~=3.6.1
pip install -e .

- name: License check
run: |
pylic check
pylic check --allow-extra-safe-licenses
6 changes: 3 additions & 3 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-dev-${{ hashFiles('setup.cfg') }}
key: ${{ runner.os }}-lint-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-dev-
${{ runner.os }}-lint-
- name: Install dependencies
# We install the full dev requirements to make sure everything installs OK
run: |
python -m pip install pip
pip install -e .[dev]
pip install -e .[lint]
- name: Cache pre-commit
uses: actions/cache@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-build-${{ hashFiles('setup.cfg') }}
key: ${{ runner.os }}-build-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-build-
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-code-samples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-samples-${{ hashFiles('**/setup.cfg') }}
key: ${{ runner.os }}-samples-${{ hashFiles('**/pyproject.toml') }}
restore-keys: |
${{ runner.os }}-samples-
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-dev-${{ hashFiles('setup.cfg') }}
key: ${{ runner.os }}-test-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-dev-
${{ runner.os }}-test-
- name: Install dependencies
run: |
python -m pip install pip
pip install -e .[dev]
pip install -e .[test]
- name: Run Integration Testing
env:
MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,14 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-dev-${{ hashFiles('setup.cfg') }}
key: ${{ runner.os }}-test-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-dev-
${{ runner.os }}-test-

- name: Install dependencies
run: |
python -m pip install pip
pip install -e .[dev]
pip install -e .[test]
- name: Run Regression Testing
env:
MINDEE_API_KEY: ${{ secrets.MINDEE_API_KEY_SE_TESTS }}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-dev-${{ hashFiles('setup.cfg') }}
key: ${{ runner.os }}-test-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-dev-
${{ runner.os }}-test-

- name: Install dependencies
run: |
python -m pip install pip
pip install -e .[dev]
pip install -e .[test]

- name: Unit testing with pytest
env:
Expand Down
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@ repos:
"--ignore=D10,D212,D203,D401"
]

- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.2
hooks:
- id: gitleaks

- repo: https://github.com/PyCQA/pylint
rev: v2.17.7
rev: v3.2.7
hooks:
- id: pylint
name: pylint
Expand Down
2 changes: 0 additions & 2 deletions examples/auto_multi_receipts_extraction_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os

from mindee import Client, product
from mindee.extraction.multi_receipts_extractor.multi_receipts_extractor import (
extract_receipts,
Expand Down
2 changes: 1 addition & 1 deletion mindee/extraction/common/image_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from PIL import Image

from mindee.error import MindeeError
from mindee.extraction.common import ExtractedImage
from mindee.extraction.common.extracted_image import ExtractedImage
from mindee.geometry import Point, get_min_max_x, get_min_max_y
from mindee.input import BytesInput, LocalInputSource

Expand Down
2 changes: 1 addition & 1 deletion mindee/input/local_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def as_dict(self) -> Dict[str, Any]:

@staticmethod
def _process_secret_key(
secret_key: Union[str, bytes, bytearray]
secret_key: Union[str, bytes, bytearray],
) -> Union[bytes, bytearray]:
"""
Processes the secret key as a byte array.
Expand Down
1 change: 0 additions & 1 deletion mindee/version

This file was deleted.

5 changes: 1 addition & 4 deletions mindee/versions.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
import os
import sys

dir_path = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(dir_path, "version"), "r", encoding="utf-8") as version_file:
__version__ = version_file.read().strip()
__version__ = "4.13.0"

python_version = f"{sys.version_info[0]}.{sys.version_info[1]}"

Expand Down
86 changes: 85 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,84 @@
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "mindee"
authors = [
{name = "Mindee", email = "opensource@mindee.com"},
]
dynamic = ["version"]
description = "Mindee API helper library for Python"
readme = "README.md"
license = {file = "LICENSE"}
classifiers = [
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
"License :: OSI Approved :: MIT License",
]

requires-python = ">=3.7"

dependencies = [
"pypdfium2>=4.0,<5",
"Pillow>=9.5.0",
"pytz>=2023.3",
"requests~=2.31.0",
]

[project.urls]
Homepage = "https://www.mindee.com"
Documentation = "https://developers.mindee.com/docs/python-sdk"
Repository = "https://github.com/publicMindee/mindee-api-python"
Issues = "https://github.com/mindee/mindee-api-python/issues"
Changelog = "https://github.com/mindee/mindee-api-python/blob/main/CHANGELOG.md"

[project.optional-dependencies]
lint = [
"pylint==3.2.7",
"pre-commit~=3.2.2",
"types-pytz>=2023.3",
"types-requests~=2.31",
]
test = [
"toml~=0.10.2",
"pytest~=7.4",
"pytest-cov~=4.1",
]
docs = [
"sphinx~=5.3",
"sphinx_rtd_theme~=1.1",
"sphinx-autodoc-typehints~=1.20",
]
build = [
"setuptools==57.5.0",
"build",
"twine",
]

[project.scripts]
mindee = "mindee.cli:main"


[tool.setuptools]
packages = ["mindee", ]

[tool.setuptools.dynamic]
version = {attr = "mindee.versions.__version__"}

[tool.setuptools.package-data]
"mindee" = ["py.typed"]


[tool.black]
line-length = 88
target-version = [
Expand Down Expand Up @@ -26,16 +107,19 @@ warn_unreachable = true
module = "pypdfium2.*"
ignore_missing_imports = true


[tool.pylic]
safe_licenses = [
"Apache Software License",
"MIT License",
"Mozilla Public License 2.0 (MPL 2.0)",
"BSD License",
"(Apache-2.0 OR BSD-3-Clause) AND LicenseRef-PdfiumThirdParty",
"Historical Permission Notice and Disclaimer (HPND)"
"Historical Permission Notice and Disclaimer (HPND)",
"CMU License (MIT-CMU)",
]


[tool.pytest.ini_options]
addopts = "--pyargs --cov mindee --cov-report term:skip-covered --cov-report term-missing -m 'not regression and not integration'"
python_files = "test*.py"
Expand Down
67 changes: 0 additions & 67 deletions setup.cfg

This file was deleted.

14 changes: 0 additions & 14 deletions setup.py

This file was deleted.

4 changes: 1 addition & 3 deletions tests/extras/test_extras_integration.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import json

import pytest

from mindee import AsyncPredictResponse, Client
from mindee import Client
from mindee.product import InternationalIdV2, InvoiceV4
from tests.product import PRODUCT_DATA_DIR

Expand Down
1 change: 0 additions & 1 deletion tests/mindee_http/test_error.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
handle_error,
)
from mindee.input.sources import PathInput
from mindee.mindee_http import clean_request_json
from tests.test_inputs import FILE_TYPES_DIR
from tests.utils import clear_envvars, dummy_envvars

Expand Down
1 change: 0 additions & 1 deletion tests/product/custom/test_custom_v1_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import pytest

from mindee.error.mindee_error import MindeeProductError
from mindee.geometry.quadrilateral import Quadrilateral
from mindee.parsing.common.document import Document
from mindee.parsing.common.page import Page
Expand Down
Loading