Skip to content

Commit

Permalink
Merge pull request #476 from singnet/development
Browse files Browse the repository at this point in the history
CLI v2.1.0 release
  • Loading branch information
AlbinaPomogalova authored Jan 15, 2024
2 parents f0a2bb8 + e2f45bf commit b5a728b
Show file tree
Hide file tree
Showing 52 changed files with 1,185 additions and 555 deletions.
62 changes: 31 additions & 31 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
jobs:
build:
docker:
- image: circleci/python:3.8.3-node
- image: cimg/python:3.11.6-node
working_directory: ~/singnet/snet-cli
environment:
TRIGGER_BUILD_BRANCH: master
Expand All @@ -17,8 +17,8 @@ jobs:
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
source "$NVM_DIR/nvm.sh"
nvm install 14.19.3
nvm alias default 14.19.3
nvm install 18.18.2
nvm alias default 18.18.2
nvm use default
- run:
name: Install tools and ipfs
Expand All @@ -37,10 +37,10 @@ jobs:
./packages/snet_cli/scripts/blockchain install
sudo pip3 install -e ./packages/snet_cli
- run:
name: Install snet-dk
name: Install snet-sdk
command: |
./packages/snet_cli/scripts/blockchain install
sudo pip3 install -e ./packages/sdk
./packages/snet_cli/scripts/blockchain install
sudo pip3 install -e ./packages/sdk
- run:
name: Install platform-contracts from master
command: |
Expand All @@ -58,24 +58,24 @@ jobs:
- run:
name: Build example service
command: |
cd ~/singnet
git clone https://github.com/singnet/example-service.git
cd example-service
pip3 install -r requirements.txt
sh buildproto.sh
cd ~/singnet
git clone https://github.com/singnet/example-service.git
cd example-service
pip3 install -r requirements.txt
sh buildproto.sh
- run:
name: Set up for snet daemon
command: |
cd ..
mkdir snet-daemon
cd snet-daemon
wget https://github.com/singnet/snet-daemon/releases/download/v5.0.1/snet-daemon-v5.0.1-linux-amd64.tar.gz
tar -xvf snet-daemon-v5.0.1-linux-amd64.tar.gz
cd snet-daemon-v5.0.1-linux-amd64
cp ~/singnet/snet-cli/packages/sdk/testcases/functional_tests/snetd.config.json ~/singnet/snet-daemon/snet-daemon-v5.0.1-linux-amd64
cd ..
mkdir snet-daemon
cd snet-daemon
wget https://github.com/singnet/snet-daemon/releases/download/v5.0.1/snet-daemon-v5.0.1-linux-amd64.tar.gz
tar -xvf snet-daemon-v5.0.1-linux-amd64.tar.gz
cd snet-daemon-v5.0.1-linux-amd64
cp ~/singnet/snet-cli/packages/sdk/testcases/functional_tests/snetd.config.json ~/singnet/snet-daemon/snet-daemon-v5.0.1-linux-amd64


- run:
Expand All @@ -84,26 +84,26 @@ jobs:
sudo pip3 install nose
nosetests -v --with-doctest
- run:
name: Functional tests fro snet-cli
name: Functional tests for snet-cli
command: |
cd ..
cd snet-cli
sudo npm install -g node-gyp@8.4.1
bash -ex packages/snet_cli/test/utils/run_all_functional.sh
bash -ex packages/snet_cli/test/utils/run_all_functional.sh
- run:
name: Functional tests for sdk
command: |
bash -ex packages/sdk/testcases/utils/run_all_functional.sh
bash -ex packages/sdk/testcases/utils/run_all_functional.sh
- run:
name: Trigger platform-pipeline build
command: |
if [ "$CIRCLE_BRANCH" == "$TRIGGER_BUILD_BRANCH" ]
then
curl -u ${CIRCLECI_PLATFORM_PIPELINE_TOKEN}: \
-d build_parameters[CIRCLE_JOB]=build \
-d build_parameters[PARENT_PROJECT_REPONAME]="$CIRCLE_PROJECT_REPONAME" \
-d build_parameters[PARENT_BRANCH]="$CIRCLE_BRANCH" \
-d build_parameters[PARENT_BUILD_URL]="$CIRCLE_BUILD_URL" \
https://circleci.com/api/v1.1/project/github/singnet/platform-pipeline/tree/${TRIGGER_BUILD_BRANCH}
fi
if [ "$CIRCLE_BRANCH" == "$TRIGGER_BUILD_BRANCH" ]
then
curl -u ${CIRCLECI_PLATFORM_PIPELINE_TOKEN}: \
-d build_parameters[CIRCLE_JOB]=build \
-d build_parameters[PARENT_PROJECT_REPONAME]="$CIRCLE_PROJECT_REPONAME" \
-d build_parameters[PARENT_BRANCH]="$CIRCLE_BRANCH" \
-d build_parameters[PARENT_BUILD_URL]="$CIRCLE_BUILD_URL" \
https://circleci.com/api/v1.1/project/github/singnet/platform-pipeline/tree/${TRIGGER_BUILD_BRANCH}
fi
36 changes: 12 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ For further details, please check our full [Documentation](http://snet-cli-docs.

#### Install prerequisites

You should have python with version 3.7 and pip installed.
You should have python with version 3.11 and pip installed.

Additionally you should install the following packages:

Expand Down Expand Up @@ -91,20 +91,16 @@ Complete documentation is available [here](http://snet-cli-docs.singularitynet.i

#### Prerequisites

* [Python 3.7](https://www.python.org/downloads/release/python-370/)
* [Node 8+ w/npm](https://nodejs.org/en/download/)
* [Python 3.11.6](https://www.python.org/downloads/release/python-3116/)

Backward compatibility for other Python versions is not guaranteed.

---

* Clone the git repository
```bash
$ git clone https://github.com/singnet/snet-cli.git
$ cd snet-cli/packages/snet_cli
```

* Install development/test blockchain dependencies
```bash
$ ./scripts/blockchain install
```

* Install the package in development/editable mode
Expand Down Expand Up @@ -160,7 +156,7 @@ The SingularityNET SDK abstracts and manages state channels with service provide

### Usage

To call a SingularityNET service, the user must be able to deposit funds (AGI tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To call a SingularityNET service, the user must be able to deposit funds (AGIX tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To deposit these tokens or do any other transaction on the Ethereum blockchain, the user must possess an Ethereum identity with available Ether.


Expand Down Expand Up @@ -236,20 +232,16 @@ For more information about gRPC and how to use it with Python, please see:

#### Prerequisites

* [Python 3.7](https://www.python.org/downloads/release/python-370/)
* [Node 8+ w/npm](https://nodejs.org/en/download/)
* [Python 3.11.6](https://www.python.org/downloads/release/python-3116/)

Backward compatibility for other Python versions is not guaranteed.

---

* Clone the git repository
```bash
$ git clone git@github.com:singnet/snet-cli.git
$ cd snet-cli/snet_sdk
```

* Install development/test blockchain dependencies
```bash
$ ./scripts/blockchain install
```

* Install the package in development/editable mode
Expand Down Expand Up @@ -283,7 +275,7 @@ The SingularityNET SDK abstracts and manages state channels with service provide

### Usage

To call a SingularityNET service, the user must be able to deposit funds (AGI tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To call a SingularityNET service, the user must be able to deposit funds (AGIX tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To deposit these tokens or do any other transaction on the Ethereum blockchain, the user must possess an Ethereum identity with available Ether.


Expand Down Expand Up @@ -349,20 +341,16 @@ For more information about gRPC and how to use it with Python, please see:

#### Prerequisites

* [Python 3.7](https://www.python.org/downloads/release/python-377/)
* [Node 8+ w/npm](https://nodejs.org/en/download/)
* [Python 3.11.6](https://www.python.org/downloads/release/python-3116/)

Backward compatibility for other Python versions is not guaranteed.

---

* Clone the git repository
```bash
$ git clone git@github.com:singnet/snet-cli.git
$ cd snet-cli/snet_sdk
```

* Install development/test blockchain dependencies
```bash
$ ./scripts/blockchain install
```

* Install the package in development/editable mode
Expand Down
41 changes: 24 additions & 17 deletions blockchain/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 8 additions & 18 deletions packages/sdk/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ The SingularityNET SDK abstracts and manages state channels with service provide

### Usage

To call a SingularityNET service, the user must be able to deposit funds (AGI tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To call a SingularityNET service, the user must be able to deposit funds (AGIX tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To deposit these tokens or do any other transaction on the Ethereum blockchain, the user must possess an Ethereum identity with available Ether.


Expand Down Expand Up @@ -92,20 +92,16 @@ For more information about gRPC and how to use it with Python, please see:

#### Prerequisites

* [Python 3.7](https://www.python.org/downloads/release/python-377/)
* [Node 8+ w/npm](https://nodejs.org/en/download/)
* [Python 3.11.6](https://www.python.org/downloads/release/python-3116/)

Backward compatibility for other Python versions is not guaranteed.

---

* Clone the git repository
```bash
$ git clone git@github.com:singnet/snet-cli.git
$ cd snet-cli/snet_sdk
```

* Install development/test blockchain dependencies
```bash
$ ./scripts/blockchain install
$ cd snet-cli/packages/sdk
```

* Install the package in development/editable mode
Expand Down Expand Up @@ -139,7 +135,7 @@ The SingularityNET SDK abstracts and manages state channels with service provide

### Usage

To call a SingularityNET service, the user must be able to deposit funds (AGI tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To call a SingularityNET service, the user must be able to deposit funds (AGIX tokens) to the [Multi-Party Escrow](https://dev.singularitynet.io/docs/concepts/multi-party-escrow/) Smart Contract.
To deposit these tokens or do any other transaction on the Ethereum blockchain, the user must possess an Ethereum identity with available Ether.


Expand Down Expand Up @@ -203,10 +199,9 @@ For more information about gRPC and how to use it with Python, please see:

### Prerequisites

* [Python 3.6.5](https://www.python.org/downloads/release/python-365/)
* [Node 8+ w/npm](https://nodejs.org/en/download/)
* [Python 3.11.6](https://www.python.org/downloads/release/python-365/)

`Note!` don't use Python 3.8.2
Backward compatibility for other Python versions is not guaranteed.

---

Expand All @@ -228,11 +223,6 @@ $ pip install -r requirements.txt

```

* Install development/test blockchain dependencies
```bash
$ ./scripts/blockchain install
```

* Blockchain configuration
If required, you can view/edit the snet-cli configuration of ipfs, eth_rpc in `~/.snet/config ` for various networks.

Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/scripts/package-pip
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

python3.7 setup.py sdist bdist_wheel
python3.11 setup.py sdist bdist_wheel
2 changes: 1 addition & 1 deletion packages/sdk/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def is_package_installed(package_name):
author='SingularityNET Foundation',
author_email='info@singularitynet.io',
description='SingularityNET Python SDK',
python_requires='>=3.7',
python_requires='>=3.11',
install_requires=dependencies,
long_description=long_description,
long_description_content_type='text/markdown'
Expand Down
13 changes: 4 additions & 9 deletions packages/sdk/snet/sdk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@


import web3
from web3.gas_strategies.time_based import medium_gas_price_strategy
from rfc3986 import urlparse
import ipfsapi
import ipfshttpclient

from snet.sdk.service_client import ServiceClient
from snet.sdk.account import Account
Expand All @@ -41,7 +40,6 @@ def __init__(
eth_rpc_endpoint = self._config.get("eth_rpc_endpoint", "https://mainnet.infura.io/v3/e7732e1f679e461b9bb4da5653ac3fc2")
provider = web3.HTTPProvider(eth_rpc_endpoint)
self.web3 = web3.Web3(provider)
self.web3.eth.setGasPriceStrategy(medium_gas_price_strategy)

# Get MPE contract address from config if specified; mostly for local testing
_mpe_contract_address = self._config.get("mpe_contract_address", None)
Expand All @@ -51,11 +49,8 @@ def __init__(
self.mpe_contract = MPEContract(self.web3, _mpe_contract_address)

# Instantiate IPFS client
ipfs_rpc_endpoint = self._config.get("ipfs_rpc_endpoint", "https://ipfs.singularitynet.io:80")
ipfs_rpc_endpoint = urlparse(ipfs_rpc_endpoint)
ipfs_scheme = ipfs_rpc_endpoint.scheme if ipfs_rpc_endpoint.scheme else "http"
ipfs_port = ipfs_rpc_endpoint.port if ipfs_rpc_endpoint.port else 5001
self.ipfs_client = ipfsapi.connect(urljoin(ipfs_scheme, ipfs_rpc_endpoint.hostname), ipfs_port)
ipfs_endpoint = self._config.get("default_ipfs_endpoint", "/dns/ipfs.singularitynet.io/tcp/80/")
self.ipfs_client = ipfshttpclient.connect(ipfs_endpoint)

# Get Registry contract address from config if specified; mostly for local testing
_registry_contract_address = self._config.get("registry_contract_address", None)
Expand All @@ -79,7 +74,7 @@ def create_service_client(self, org_id, service_id, service_stub, group_name=Non
options['concurrency'] = self._config.get("concurrency", True)

if self._metadata_provider is None:
self._metadata_provider = IPFSMetadataProvider( self.ipfs_client ,self.registry_contract,)
self._metadata_provider = IPFSMetadataProvider(self.ipfs_client, self.registry_contract)

service_metadata = self._metadata_provider.enhance_service_metadata(org_id, service_id)
group = self._get_service_group_details(service_metadata, group_name)
Expand Down
Loading

0 comments on commit b5a728b

Please sign in to comment.