Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
d86764b
New workflow file
Arondondon Nov 25, 2024
c660b25
Added org metadata test
Arondondon Nov 25, 2024
9ce93fb
Update test.yml
Deralden Nov 25, 2024
71f8681
Update test.yml part 2
Deralden Nov 25, 2024
51fe531
Update dev.yml
Deralden Nov 25, 2024
06f528a
Fixed tests
Arondondon Nov 25, 2024
bb819f0
Fixed tests sequence
Arondondon Nov 25, 2024
cd89c3e
Fixed tests sequence x2
Arondondon Nov 25, 2024
36b01fb
[SPT-777] Added new tests: unset, channel, client call, create/delete…
MorozovMisha Jan 17, 2025
ad997f5
[SPT-777] Fixed new tests
MorozovMisha Jan 20, 2025
454c1bb
[SPT-777] Fixed last failture
MorozovMisha Jan 20, 2025
780f999
[SPT-777] Fixed two errors in TestClient
MorozovMisha Jan 24, 2025
2ef8fdd
[SPT-777] Fixed version control
MorozovMisha Jan 27, 2025
ae67a77
[SPT-777] Fixed errors with infura
MorozovMisha Jan 29, 2025
9bc1ce4
[SPT-777] New functional tests: account transfer; channel print, clai…
MorozovMisha Jan 31, 2025
5ca6eab
[SPT-777] Fixed errors and added logs
MorozovMisha Jan 31, 2025
8350009
[SPT-777] Added more logs to fix error
MorozovMisha Jan 31, 2025
ac3aaa5
[SPT-777] Fixed channel errors
MorozovMisha Jan 31, 2025
5e9b465
[SPT-777] Fixed last failture
MorozovMisha Jan 31, 2025
dca668c
[SPT-777] Fixed asserrtation failture
MorozovMisha Jan 31, 2025
6652f27
[SPT-777] New functional tests: organization lists, organization and …
MorozovMisha Feb 3, 2025
f7ae101
[SPT-777] Fixed channel claim command and channel open amount
MorozovMisha Feb 3, 2025
c460d4a
[SPT-777] Fixed channel claim test
MorozovMisha Feb 3, 2025
ddedf9e
[SPT-777] New functional tests: call low-level; get-api-registry; met…
MorozovMisha Feb 4, 2025
cf8ccc1
[SPT-777] New functional tests: service metadata daemon, endpoints
MorozovMisha Feb 4, 2025
c6bf9ce
[SPT-777] Fixed input data for test
MorozovMisha Feb 4, 2025
9ef15cc
[SPT-777] Checking for an open channel
MorozovMisha Feb 5, 2025
a941076
[SPT-777] The method of rounding numbers has been replaced. Also upda…
MorozovMisha Feb 5, 2025
b2495a3
[SPT-777] Updated 'network create' command
MorozovMisha Feb 5, 2025
b3ace02
[SPT-777] checking for channel availability
MorozovMisha Feb 5, 2025
7886224
[SPT-777] fixed network create command
MorozovMisha Feb 5, 2025
18e98a2
[SPT-777] Added new tests: channel print-filter-recipient, print-all;…
MorozovMisha Feb 6, 2025
5f36ce9
[SPT-777] Fixed channel_id declaring
MorozovMisha Feb 6, 2025
3a2d30d
[SPT-777] Added second org to open new channel
MorozovMisha Feb 6, 2025
7bc8693
[SPT-777] Fixed AssertationError and incorrect function name
MorozovMisha Feb 6, 2025
7672902
[SPT-777] Added contract tests
MorozovMisha Feb 6, 2025
60d531f
[SPT-777] removed the dependency for the test execution order
MorozovMisha Feb 7, 2025
6d6841c
[SPT-777] New structure of functional tests
MorozovMisha Feb 11, 2025
da90a2c
fix: change yanked version of the jsonschema dependency
Arondondon Dec 17, 2025
c77e38e
fix: update dependencies version
Arondondon Dec 19, 2025
8781778
Merge pull request #547 from singnet/functional-tests-update
Arondondon Dec 19, 2025
5ce5c6c
Merge pull request #548 from singnet/development
Arondondon Dec 19, 2025
85dd5e5
feat: update build configuration
Arondondon Dec 22, 2025
ba0accc
fix: update many modules according to the updated dependencies
Arondondon Dec 22, 2025
2be3c9d
fix: change _get_all_opened_channels_from_blockchain method
Arondondon Dec 24, 2025
ade30ee
fix: change get_kws_for_identity_type function and its usage
Arondondon Dec 26, 2025
8dbce67
fix: change check_ident function
Arondondon Dec 29, 2025
003f4fc
fix: change getting r and s for trezor tx
Arondondon Dec 29, 2025
a217711
fix: change dict iteration
Arondondon Jan 14, 2026
e2d2435
fix: change trezor and ledger transaction building
Arondondon Jan 19, 2026
6ca9313
Merge pull request #549 from singnet/SCLI-11
Arondondon Jan 21, 2026
ebc67ed
feat: update version
Arondondon Jan 21, 2026
d4462bc
Merge branch 'master' into development
Arondondon Jan 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ jobs:
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
# sh -ex ./snet/cli/test/utils/run_all_functional.sh
python3 ./snet/cli/test/functional_tests/test_entry_point.py
python3 ./snet/cli/test/functional_tests/func_tests.py
66 changes: 66 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: tests_functional_tests_update
on:
push:
branches: [ "functional-tests-update" ]
# pull_request:
# branches: [ "development" ]
workflow_dispatch:

jobs:
run_tests_functional_tests_update:
runs-on: ubuntu-latest
container: node:20-bookworm
steps:

- name: install packs
run: |
apt update
apt install -y libudev-dev libusb-1.0-0-dev curl jq
apt install -y python3-pip python3.11-venv

- name: clone repo
uses: actions/checkout@v3

- name: install pip packages
run: |
pip3 install -r requirements.txt --break-system-packages
# pip3 install nose --break-system-packages
# pip3 uninstall pyreadline --break-system-packages
# pip3 install pyreadline3 --break-system-packages

- name: install snet-cli
run: |
# ./scripts/blockchain install
pip3 install -e . --break-system-packages

# - name: install platform-contracts
# run: |
# cd ..
# git clone https://github.com/singnet/platform-contracts.git
# cd platform-contracts
# npm install
# npm install ganache-cli
# npm run-script compile

# - name: build example service
# run: |
# git clone https://github.com/singnet/example-service.git
# cd example-service
# pip3 install -r requirements.txt --break-system-packages
# sh buildproto.sh

# - name: unit tests
# run: |
# cd ./snet/cli/test
# nosetests -v --with-doctest

- name: functional tests for cli
run: |
export SNET_TEST_WALLET_PRIVATE_KEY=${{ secrets.PRIV_KEY }}
export SNET_TEST_INFURA_KEY=${{ secrets.INF_KEY }}
export SNET_TEST_WALLET_ADDRESS=${{ secrets.ADDR }}
export FORMER_SNET_TEST_INFURA_KEY=${{ secrets.FORM_INF_KEY }}
export PIP_BREAK_SYSTEM_PACKAGES=1
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python
# sh -ex ./snet/cli/test/utils/run_all_functional.sh
python3 ./snet/cli/test/functional_tests/test_entry_point.py
50 changes: 50 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
[build-system]
requires = [
"setuptools>=61.0",
"wheel",
"protobuf~=6.30",
"grpcio-tools~=1.59"
]
build-backend = "setuptools.build_meta"

[project]
name = "snet-cli"
version = "3.1.0"
description = "SingularityNET CLI"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "MIT"}
authors = [
{name = "SingularityNET Foundation", email = "info@singularitynet.io"}
]
urls = {Homepage = "https://github.com/singnet/snet-cli"}

# Cleaned dependencies list
dependencies = [
"protobuf~=6.30",
"grpcio~=1.59",
"grpcio-tools~=1.59",
"wheel~=0.45",
"rlp~=4.0",
"web3~=7.0",
"mnemonic==0.21",
"pyyaml~=6.0.1",
"ipfshttpclient==0.4.13.2",
"pymultihash==0.8.2",
"base58==2.1.1",
"argcomplete~=3.1",
"grpcio-health-checking~=1.59",
"jsonschema~=4.1",
"eth-account~=0.9",
"trezor~=0.13.8",
"ledgerblue~=0.1.48",
"snet-contracts==1.0.1",
"lighthouseweb3~=0.1.4",
"cryptography~=46.0"
]

[project.scripts]
snet = "snet.cli:main"

[tool.setuptools.packages.find]
include = ["snet*"]
41 changes: 21 additions & 20 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
protobuf==4.21.6
grpcio-tools==1.59.0
wheel==0.41.2
jsonrpcclient==4.0.3
eth-hash==0.5.2
rlp==3.0.0
eth-rlp==0.3.0
web3==6.11.1
mnemonic==0.20
pycoin==0.92.20230326
pyyaml==6.0.1
protobuf~=6.30
grpcio~=1.59
grpcio-tools~=1.59
wheel~=0.45
# jsonrpcclient~=4.0
# eth-hash~=0.5
rlp~=4.0
# eth-rlp~=2.0
web3~=7.0
mnemonic==0.21
# pycoin==0.92.20241201
pyyaml~=6.0.1
ipfshttpclient==0.4.13.2
pymultihash==0.8.2
base58==2.1.1
argcomplete==3.1.2
grpcio-health-checking==1.59.0
jsonschema==4.0.0
eth-account==0.9.0
trezor==0.13.8
ledgerblue==0.1.48
snet-contracts==1.0.0
lighthouseweb3==0.1.4
cryptography==44.0.1
argcomplete~=3.1
grpcio-health-checking~=1.59
jsonschema~=4.1
eth-account~=0.9
trezor~=0.13.8
ledgerblue~=0.1.48
snet-contracts==1.0.1
lighthouseweb3~=0.1.4
cryptography~=46.0
96 changes: 47 additions & 49 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,73 +1,71 @@
import os
from pathlib import Path
from setuptools import find_namespace_packages, setup
from setuptools import setup
from setuptools.command.develop import develop as _develop
from setuptools.command.install import install as _install
from setuptools.command.build_py import build_py as _build_py
from grpc_tools import protoc
from pkg_resources import resource_filename

from snet.cli.utils.utils import compile_proto
from version import __version__

PACKAGE_NAME = 'snet-cli'


this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
long_description = f.read()
def install_and_compile_proto():
"""
Compiles protobuf files directly.
"""
proto_dir = Path(__file__).absolute().parent.joinpath(
"snet", "cli", "resources", "proto")

# Locate the standard grpc_tools internal protos (google/protobuf/...)
grpc_protos_include = resource_filename('grpc_tools', '_proto')

with open("./requirements.txt") as f:
requirements_str = f.read()
requirements = requirements_str.split("\n")
print(f"Proto directory: {proto_dir}")
print(f"Grpc include directory: {grpc_protos_include}")

if not proto_dir.exists():
print(f"Warning: Proto directory not found at {proto_dir}")
return

def install_and_compile_proto():
proto_dir = Path(__file__).absolute().parent.joinpath(
"snet", "cli", "resources", "proto")
print(proto_dir, "->", proto_dir)
# glob('*.proto') is non-recursive. It will NOT look inside subfolders.
for fn in proto_dir.glob('*.proto'):
print("Compiling protobuf", fn)
compile_proto(proto_dir, proto_dir, proto_file=fn)

print(f"Compiling protobuf: {fn}")

command = [
'grpc_tools.protoc',
f'-I{proto_dir}',
f'-I{grpc_protos_include}', # <--- CRITICAL FIX: Add standard protos to include path
f'--python_out={proto_dir}',
f'--grpc_python_out={proto_dir}',
str(fn)
]

if protoc.main(command) != 0:
print(f"Error: Failed to compile {fn}")
raise RuntimeError(f"Protocol buffer compilation failed for {fn}")

class build_py(_build_py):
"""
Override build_py to compile protos before building the wheel.
This is the hook used by 'python -m build'.
"""
def run(self):
self.execute(install_and_compile_proto, (), msg="Compile protocol buffers")
_build_py.run(self)

class develop(_develop):
"""Post-installation for development mode."""

"""Post-installation for development mode (pip install -e .)."""
def run(self):
self.execute(install_and_compile_proto, (), msg="Compile protocol buffers")
_develop.run(self)
self.execute(install_and_compile_proto, (),
msg="Compile protocol buffers")


class install(_install):
"""Post-installation for installation mode."""

"""Post-installation for legacy installation mode."""
def run(self):
self.execute(install_and_compile_proto, (), msg="Compile protocol buffers")
_install.run(self)
self.execute(install_and_compile_proto, (),
msg="Compile protocol buffers")


setup(
name=PACKAGE_NAME,
version=__version__,
packages=find_namespace_packages(include=['snet*']),
url='https://github.com/singnet/snet-cli',
author="SingularityNET Foundation",
author_email="info@singularitynet.io",
description="SingularityNET CLI",
long_description=long_description,
long_description_content_type='text/markdown',
license="MIT",
python_requires='>=3.10',
install_requires=requirements,
include_package_data=True,
cmdclass={
'develop': develop,
'install': install,
'build_py': build_py,
},
entry_points={
'console_scripts': [
'snet = snet.cli:main'
],
}
)
)
28 changes: 17 additions & 11 deletions snet/cli/arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,24 @@ def __init__(self, default_choice=None, *args, **kwargs):
super().__init__(*args, **kwargs)

def error(self, message):
sys.stderr.write("error: {}\n\n".format(message))
sys.stderr.write(f"error: {message}\n\n")
self.print_help(sys.stderr)
sys.exit(2)

def _parse_known_args(self, arg_strings, *args, **kwargs):
if self.default_choice and not len(list(filter(lambda option: option in arg_strings, {'-h', '--help'}))):
for action in list(filter(
lambda subparser_action: isinstance(
subparser_action, argparse._SubParsersAction),
self._subparsers._actions
)):
if not len(list(filter(lambda arg: arg in action._name_parser_map.keys(), arg_strings))):
if self.default_choice and not any(arg in arg_strings for arg in {'-h', '--help'}):

subparser_action = next(
(a for a in self._actions if isinstance(a, argparse._SubParsersAction)),
None
)

if subparser_action:
is_subcommand_present = any(
arg in subparser_action.choices for arg in arg_strings
)

if not is_subcommand_present:
arg_strings = [self.default_choice] + arg_strings

return super()._parse_known_args(
Expand Down Expand Up @@ -575,8 +581,8 @@ def add_mpe_account_options(parser):
subparsers = parser.add_subparsers(title="Commands", metavar="COMMAND")
subparsers.required = True

def add_p_snt_address_opt(p):
p.add_argument(
def add_p_snt_address_opt(_p):
_p.add_argument(
"--singularitynettoken-at", "--snt", default=None,
help="Address of SingularityNetToken contract, if not specified we read address from \"networks\"")

Expand Down Expand Up @@ -1153,7 +1159,7 @@ def add_mpe_service_options(parser):
p.add_argument("name", help="Name of the contributor")
p.add_argument("email_id", help="Email of the contributor")

p = subparsers.add_parser("metadata-remove-contributor", help="Add contributor")
p = subparsers.add_parser("metadata-remove-contributor", help="Remove contributor")
p.set_defaults(fn="metadata_remove_contributor")
add_p_metadata_file_opt(p)
p.add_argument("email_id", help="Email of the contributor")
Expand Down
Loading