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/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
# We install the full dev requirements to make sure everything installs OK
run: |
python -m pip install pip
pip install --requirement ./requirements.dev.txt
pip install -e .[dev]
- name: Analysing the code with Black
run: |
black --check .
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install pip
pip install pytest~=6.1.2 pytest-cov~=2.11.1 wheel
pip install --requirement ./requirements.txt
pip install -e .[test]

- name: Testing the code with pytest
run: |
Expand Down
20 changes: 9 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Receipt, passport and invoice OCR python helper for Mindee API
# Mindee API helper library for Python

The full documentation is available [here](https://developers.mindee.com/docs/getting-started)

Expand All @@ -13,21 +13,20 @@ Install from PyPi using pip, a package manager for Python.
```shell script
pip install mindee
```

Don't have pip installed? Try installing it, by running this from the command line:

```shell script
$ curl https://bootstrap.pypa.io/get-pip.py | python
```

Getting started with the Mindee API couldn't be easier. Create a Client and you're ready to go.

Getting started with the Mindee API couldn't be easier.
Create a Client and you're ready to go.

## Create your Client

The mindee.Client needs your API credentials. You can either pass these directly to the constructor (see the code below) or via environment variables.


The mindee.Client needs your [API credentials](https://developers.mindee.com/docs/make-your-first-request#create-an-api-key).
You can either pass these directly to the constructor (see the code below) or via environment variables.

Depending on what type of document you want to parse, you need to add specifics auth token for each endpoint.

Expand All @@ -43,7 +42,8 @@ mindee_client = Client(
)
```

We suggest storing your credentials as environment variables. Why? You'll never have to worry about committing your credentials and accidentally posting them somewhere public.
We suggest storing your credentials as environment variables.
Why? You'll never have to worry about committing your credentials and accidentally posting them somewhere public.


## Parsing methods
Expand Down Expand Up @@ -71,11 +71,10 @@ parsed_data = mindee_client.parse_license_plate("/path/to/file")

You can pass your input file in three ways:


From file path
```python
receipt_data = mindee_client.parse_receipt('/path/to/file', input_type="path")
```
```

From a file object
```python
Expand All @@ -87,4 +86,3 @@ From a base64
```python
receipt_data = mindee_client.parse_receipt(base64_string, input_type="base64")
```

1 change: 1 addition & 0 deletions mindee/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.2.3
6 changes: 5 additions & 1 deletion mindee/versions.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
import os
import sys

__version__ = "1.2.3"

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

python_version = "%s.%s" % (sys.version_info[0], sys.version_info[1])

Expand Down
8 changes: 0 additions & 8 deletions requirements.dev.txt

This file was deleted.

23 changes: 20 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
requests~=2.23.0
pytz~=2021.1
PyMuPDF~=1.18.17
#
# This file is autogenerated by pip-compile with python 3.8
# To update, run:
#
# pip-compile
#
certifi==2021.10.8
# via requests
chardet==4.0.0
# via requests
idna==2.10
# via requests
pymupdf==1.18.17
# via mindee (setup.py)
pytz==2021.3
# via mindee (setup.py)
requests==2.25.1
# via mindee (setup.py)
urllib3==1.26.8
# via requests
54 changes: 34 additions & 20 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import os
import re
from setuptools import find_packages, setup
from mindee.versions import __version__

dir_path = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(dir_path, "mindee", "version"), "r") as version_file:
__version__ = version_file.read().strip()

with open("README.md", "r", newline="", encoding="utf-8") as fh:
long_description = fh.read()
Expand All @@ -12,35 +15,46 @@
GIT_URL = "https://github.com/publicMindee/mindee-api-python"


def make_requirements_list(file="requirements.txt", only_regular=True):
"""
Make a list of package requirements from a requirements.txt file
:param file: path to txt file
:param only_regular: remove rows with /, #, space or empty
:return:
"""
with open(file) as f:
lines = f.read().splitlines()
if only_regular:
regex = (
"\/$|^#|^$$|^git\+" # remove line with /, starting by # or space or empty
)
return [line for line in lines if not re.findall(regex, line)]
else:
return lines
requirements = [
"requests==2.25.1",
"pytz==2021.3",
"PyMuPDF==1.18.17",
]

test_requirements = [
"pytest==6.1.2",
"pytest-cov==2.11.1",
]

dev_requirements = [
"black==21.12b0",
"setuptools==49.2.0",
"pip-tools==6.4.0",
]

setup(
python_requires=">=3.6",
name=f"{PACKAGE_NAME}",
description="Mindee API helper library for python",
name=PACKAGE_NAME,
description="Mindee API helper library for Python",
version=__version__,
long_description=long_description,
long_description_content_type="text/markdown",
url=GIT_URL,
packages=find_packages(),
author="Mindee",
author_email="devrel@mindee.com",
install_requires=make_requirements_list(),
install_requires=requirements,
extras_require={
"dev": dev_requirements,
"test": test_requirements,
},
include_package_data=True,
package_data={"mindee": ["version"]},
classifiers=[
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Libraries",
],
)