Metadata-Version: 2.1
Name: iotics-grpc-client
Version: 0.10.0
Summary: Iotics gRPC client library
Home-page: https://github.com/Iotic-Labs/iotics-grpc-client-py
Author: Iotics
License: UNKNOWN
Project-URL: Bug Tracker, https://github.com/Iotic-Labs/iotics-grpc-client-py/issues
Project-URL: Changelog, https://github.com/Iotic-Labs/iotics-grpc-client-py/releases
Keywords: iotics,grpc,digital twin
Platform: any
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: googleapis-common-protos (>=1.56.3)
Requires-Dist: grpcio (==1.44.0)
Provides-Extra: dev
Requires-Dist: mypy-protobuf (>=3.2.0) ; extra == 'dev'
Requires-Dist: python-dotenv (>=0.20.0) ; extra == 'dev'
Requires-Dist: iotics-identity (>=1.0.2) ; extra == 'dev'

# Iotics gRPC Python Client
A Python library for interacting with Iotics API.


## Usage
```shell
pip install iotics-grpc-client
```


# Examples
## Configuring identity
To run examples, either set up required environment variables or create an `.env` file with the following values. For
more information on the meaning of these values and how to create them, consult https://docs.iotics.com/docs/identity-api-and-credentials
* __Required__:
  * `SPACE` - Domain name of the IOTICSpace with which to communicate. The scheme can be omitted, eg. examplecorp.
    iotics.space
  * `USER_SEED` - __secret__ value used to (re)create user public and private keys.
  * `AGENT_SEED` - __secret__ value used to (re)create agent public and private keys.

* __Optional__:
  * `DID_RESOLVER_URL` - Where the database of identity documents is accesible, defaults to the one used by the given 
    space.
  * `USER_KEY_NAME` - __secret__ value used to (re)create multiple key pairs, defaults to empty.
  * `USER_NAME` - used to create/identify public keys, defaults to `#user-0`.
  * `AGENT_KEY_NAME` - __secret__ value used to (re)create multiple key pairs, defaults to empty.
  * `AGENT_NAME` - registered identity name that can be used to e.g. identify public keys, defaults to 
   `#agent-0`.

## Running example scripts
Next, create and activate your virtual environment and run any of the scripts in the [examples](https://github.com/Iotic-Labs/iotics-grpc-client-py/tree/main/examples) directory, 
e.g.:
```bash
make deps-py
. env/bin/activate
python examples/search_twin_models.py
```


# Contributing


## Installing dependencies and generating gRPC client
* To satisfy all dependencies, lint proto files and regenerate client files (inside a Docker container):
  ```shell
  make build
  ```
  * To generate gRPC Python files outside a Docker container the following command can be used: `make generate`.
    Currently, there is no official binary for Python gRPC plugin, but there is one built from the official repository
    inside the docker (the following will work on Linux machines):
    ```bash
    docker run --rm -dit --name iotics-grpc-client-py-builder iotics-grpc-client-py-builder /bin/bash
    docker cp iotics-grpc-client-py-builder:/bin/protoc-gen-python_grpc env/bin/protoc-gen-python_grpc
    docker stop iotics-grpc-client-py-builder
    make generate
    ```
* To update the Iotics API version and regenerate client  
  (proto files are submoduled in [./iotics-api.git/](./iotics-api.git)
  from [Iotics API](https://github.com/Iotic-Labs/api) repo):
  ```bash
  _ver=vX.X.X
  make GIT_TAG=$_ver deps-proto-update build
  # Address usages of the new client in `src`, update "Unreleased" section in CHANGELOG.md, then:
  git add CHANGELOG.md iotics-api.git src
  git commit -m "Update Iotics API to $_ver"
  # Push your branch and create a PR
  ```
* Other `make` commands:
  * `clean` - remove artifacts created inside the project.
  * `deps-*` - install specific requirements if missing.
  * `deps-*-update` - update specific requirements when applicable.


## PRs
Should contain a summary of the changes in [CHANGELOG.md](https://github.com/Iotic-Labs/iotics-grpc-client-py/blob/main/CHANGELOG.md) under the "Unreleased" section.


## Versioning

This package will have the same version as the [API](https://github.com/Iotic-Labs/api/tags) but with the API's minor and patch numbers bumped to major and minor. If/when there's a change in the grpc client but not in the API we will change the patch number. We can then know that e.g. API version 0.2.5 works with grpc clients 2.5.X

## Releasing
* Update package version in [setup.py](./setup.py) for the release:
* Update [CHANGELOG.md](https://github.com/Iotic-Labs/iotics-grpc-client-py/blob/main/CHANGELOG.md) (move notes from unreleased section, ensure right tags are used, etc.)
  and any other files as needed.
* Commit changes and create a [PR](https://github.com/Iotic-Labs/iotics-grpc-client-py/compare).
* Once PR is merged manually run the [Create Draft Release GitHub Action](https://github.com/Iotic-Labs/iotics-grpc-client-py/actions/workflows/draft_release.yml), this will create a tag with the version in setup.py and create a draft release in [releases](https://github.com/Iotic-Labs/iotics-grpc-client-py/releases).
* Update the release's information and press the publish button on the release to publish it.
* The [Publish GitHub Action](https://github.com/Iotic-Labs/iotics-grpc-client-ts/actions/workflows/publish.yml)
  will create a package and will publish it to [PyPI](https://pypi.org/project/iotics-grpc-client).


# License

Copyright © 2022 IOTIC LABS LTD. info@iotics.com. All rights reserved. Licensed under the Apache License, Version 2.0. See [LICENSE](https://github.com/Iotic-Labs/iotics-grpc-client-py/tree/main/LICENSE) in the project root for license information.



