Metadata-Version: 2.1
Name: senzing_grpc
Version: 0.0.3
Summary: Python SDK for Senzing API over gRPC
Home-page: https://github.com/Senzing/g2-sdk-python-grpc
Author: senzing
Author-email: support@senzing.com
License: Apache 2
Project-URL: Bug Tracker, https://github.com/Senzing/g2-sdk-python-grpc/issues
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: grpcio
Requires-Dist: protobuf
Requires-Dist: senzing-abstract

# g2-sdk-python-grpc

## :warning: WARNING: g2-sdk-python-grpc is still in development :warning: _

At the moment, this is "work-in-progress" with Semantic Versions of `0.n.x`.
Although it can be reviewed and commented on,
the recommendation is not to use it yet.

## Synopsis

The Senzing `g2-sdk-python-grpc` package provides a Python Software Development Kit
adhering to the abstract classes of
[g2-sdk-python-abstract](https://github.com/Senzing/g2-sdk-python-abstract/tree/main/src/senzing_abstract)
that communicates with a
[Senzing gRPC server](https://github.com/Senzing/servegrpc).

## Overview

The Senzing `g2-sdk-python-grpc` packages enable Python programs to call Senzing library functions
across a network to a
[Senzing gRPC server](https://github.com/Senzing/servegrpc).

The `g2-sdk-python-grpc` package implements the following
[g2-sdk-python-abstract](https://github.com/Senzing/g2-sdk-python-abstract/tree/main/src/senzing_abstract)
interfaces:

1. [G2ConfigAbstract](https://github.com/Senzing/g2-sdk-python-abstract/blob/main/src/senzing_abstract/g2config_abstract.py)
1. [G2ConfigMgrAbstract](https://github.com/Senzing/g2-sdk-python-abstract/blob/main/src/senzing_abstract/g2configmgr_abstract.py)
1. [G2DiagnosticAbstract](https://github.com/Senzing/g2-sdk-python-abstract/blob/main/src/senzing_abstract/g2diagnostic_abstract.py)
1. [G2EngineAbstract](https://github.com/Senzing/g2-sdk-python-abstract/blob/main/src/senzing_abstract/g2engine_abstract.py)
1. [G2ProductAbstract](https://github.com/Senzing/g2-sdk-python-abstract/blob/main/src/senzing_abstract/g2product_abstract.py)

Other implementations of the
[g2-sdk-python-abstract](https://github.com/Senzing/g2-sdk-python-abstract/tree/main/src/senzing_abstract)
interface include:

- [g2-sdk-python-next](https://github.com/Senzing/g2-sdk-python-next) - for
  calling Senzing SDK APIs natively

## Use

The following example shows how to start a Senzing gRPC server Docker container
and access it using the `senzing_grpc` Python package.

1. Install the `senzing-grpc` Python package.
   If the `senzing-grpc` Python package is already installed,
   this step is not necessary.
   Example:

    ```console
    python3 -m pip install --upgrade senzing-grpc
    ```

1. Run a Senzing gRPC service using Docker.
   Example:

    ```console
    docker run \
      --env SENZING_TOOLS_COMMAND=serve-grpc \
      --env SENZING_TOOLS_DATABASE_URL=sqlite3://na:na@/tmp/sqlite/G2C.db \
      --env SENZING_TOOLS_ENABLE_ALL=true \
      --name senzing-tools-serve-grpc \
      --publish 8261:8261 \
      --rm \
      senzing/senzing-tools
    ```

   **Note:** In this example, `SENZING_TOOLS_DATABASE_URL` specifies a file *inside* the container.
   Thus the database is temporal and will be deleted when the container is killed.

1. In a separate window, start an interactive Python session.
   Example:

    ```console
    python3
    ```

1. Paste the following into the interactive Python session.
   Example:

    ```python
    import grpc
    from senzing_grpc import G2ProductGrpc
    g2_product = G2ProductGrpc(grpc_channel=grpc.insecure_channel("localhost:8261"))
    print(g2_product.version())
    ```

More can be seen in
[Examples](docs/examples.md).

## References

1. [Development](docs/development.md)
1. [Errors](docs/errors.md)
1. [Examples](docs/examples.md)
1. [g2-sdk-python-abstract package reference](http://hub.senzing.com/g2-sdk-python-abstract/)
