Build and Import Affinidi TDK Python Packages
This guide will help you build and install locally and import the Python packages of Affinidi TDK into your application from the Github repository.
Before you begin
Make sure you have Git installed on your machine. Follow this guide on how to install Git.
Install Python, including pip on your machine if you haven’t installed yet using this guide.
Build Packages Module
To build the Python version of the Packages
modules of the Affinidi TDK, we will be using the JSII module and run the following commands:
In this example, we will build and install the AuthProvider package.
- Go to your desired directory and clone the Affinidi TDK repository.
git clone git@github.com:affinidi/affinidi-tdk.git
- Go to the cloned repository and then go to the
packages/auth-provider
folder from your command line interface.
cd packages/auth-provider
- Install the Node modules with
--prefix
flag.
npm i --prefix .
- After successfully installing the dependencies, run the build command:
npm run build
- After successfully building the package, run the command to create the JSII package.
npm run package
After running the command, a Wheel (WHL) package is created in the dist
folder.
- Install the generated Wheel (WHL) file on your machine:
pip install dist/python/<GENERATED_WHEEL_FILE>.whl
Replace the
<GENERATED_WHEEL_FILE>
with the generated wheel file name.
Lastly, import the package into your application:
import affinidi_tdk_auth_provider
You can follow the same steps to build the iota-core
library except for iota-browser
, which is a browser-only library.
Build Clients Module
To build and install the Affinidi TDK clients, we will use the setuptools and run the setup.py
file provided on each client.
In this example, we will build and install the credential-issuance client.
- Go to your desired directory and clone the Affinidi TDK repository.
git clone git@github.com:affinidi/affinidi-tdk.git
- Go to the cloned repository and then go to the
clients/python/credential_issuance_client
folder from your command line interface.
cd clients/python/credential_issuance_client
- Install the
setuptools
package on your machine if you haven’t installed it yet.
pip install setuptools
- Run the setup.py file provided in the client’s folder.
python setup.py install --user
- Once the Python package is successfully built, you can now import the package.
import affinidi_tdk_credential_issuance_client
Stay tuned once we publish Affinidi TDK Python modules to the Python Package Index (PyPI) repository.
Glad to hear it! Please tell us how we can improve more.
Sorry to hear that. Please tell us how we can improve.
Thank you for sharing your feedback so we can improve your experience.