Skip to content

classicvalues/python-documentai

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Python Client for Cloud Document AI API

GA pypi versions

Cloud Document AI API: Service to parse structured information from unstructured or semi-structured documents using state-of-the-art Google AI such as natural language, computer vision, translation, and AutoML.

Quick Start

In order to use this library, you first need to go through the following steps:

  1. Select or create a Cloud Platform project.
  2. Enable billing for your project.
  3. Enable the Cloud Document AI API.
  4. Setup Authentication.

Installation

Install this library in a virtualenv using pip. virtualenv is a tool to create isolated Python environments. The basic problem it addresses is one of dependencies and versions, and indirectly permissions.

With virtualenv, it's possible to install this library without needing system install permissions, and without clashing with the installed system dependencies.

Mac/Linux

pip install virtualenv
virtualenv <your-env>
source <your-env>/bin/activate
<your-env>/bin/pip install google-cloud-documentai

Windows

pip install virtualenv
virtualenv <your-env>
<your-env>\Scripts\activate
<your-env>\Scripts\pip.exe install google-cloud-documentai

Next Steps

Running tests

Prerequisites

  1. Install pyenv for your platform

  2. Install the latest versions of python version 3.6, 3.7, 3.8, and 3.9 via pyenv.

    pyenv install 3.9.${3_9_LATEST_PATCH}
    pyenv install 3.8.${3_8_LATEST_PATCH}
    pyenv install 3.7.${3_7_LATEST_PATCH}
    pyenv install 3.6.${3_6_LATEST_PATCH}

    For example:

    pyenv install 3.9.7
    pyenv install 3.8.12
    pyenv install 3.7.11
    pyenv install 3.6.14

Setup virtual envionrment

  1. Change directories to the root of this repo

  2. Create a 3.8 Python virtual enviornment via pyenv:

    pyenv virtualenv 3.8.${3_8_LATEST_PATCH} docai-venv

    For example:

    pyenv virtualenv 3.8.12 docai-venv
  3. Acitivate the virtual enviornment and use Python versions 2.7, 3.6, 3.7, and 3.9:

    pyenv local docai-venv \
       3.9.${3_9_LATEST_PATCH} \
       3.8.${3_8_LATEST_PATCH} \
       3.7.${3_7_LATEST_PATCH} \
       3.6.${3_6_LATEST_PATCH}

    For example:

    pyenv local docai-venv 3.9.7 3.8.12 3.7.11 3.6.14
  4. Install the required library dependencies and test dependencies in the virtual enviornment:

    pip install google-cloud-documentai nox

Running tests with nox

Note

Nox is directory dependent. Nox will only run tests contained in the current directory and subdirectories. To ensure all tests are run, make sure to run Nox from the root of this repo.

Run all tests:

  1. Change directory to the root of the repo

  2. Run Nox:

    nox

Run system tests:

nox -s system

Run unit tests:

nox -s unit

Run tests for a specific version of Python:

nox -s py-3.8

Run documentation tests:

nox -s docs

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 96.4%
  • Shell 3.4%
  • Dockerfile 0.2%