⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
37 changes: 37 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[build-system]
requires = [
"setuptools>=61.0",
"wheel",
"protobuf~=6.30",
"grpcio-tools~=1.59"
]
build-backend = "setuptools.build_meta"

[project]
name = "snet-sdk"
version = "5.1.0"
description = "SingularityNET Python SDK"
readme = "README.md"
requires-python = ">=3.10"
license = "MIT"
authors = [
{name = "SingularityNET Foundation", email = "[email protected]"}
]
urls = {Homepage = "https://github.com/singnet/snet-sdk-python"}

# Cleaned dependencies list
dependencies = [
"protobuf~=6.30",
"grpcio~=1.71",
"grpcio-tools~=1.71",
"grpcio-health-checking~=1.71",
"wheel~=0.45",
"rlp~=4.0",
"ipfshttpclient==0.4.13.2",
"snet-contracts==1.0.1",
"lighthouseweb3~=0.1.4",
"py-multihash~=3.0"
]

[tool.setuptools.packages.find]
include = ["snet*"]
20 changes: 9 additions & 11 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
protobuf==5.*
grpcio-tools>=1.71.0
wheel>=0.45.0
rlp>=4.1.0
web3==7.*
ipfshttpclient==0.4.13
rfc3986>=2.0.0
base58>=2.1.1
grpcio-health-checking>=1.71.0
protobuf~=6.30
grpcio~=1.71
grpcio-tools~=1.71
grpcio-health-checking~=1.71
wheel~=0.45
rlp~=4.0
ipfshttpclient==0.4.13.2
snet-contracts==1.0.1
lighthouseweb3>=0.1.4
pymultihash==0.*
lighthouseweb3~=0.1.4
py-multihash~=3.0
89 changes: 64 additions & 25 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,34 +1,73 @@
import os
from setuptools import find_namespace_packages, setup
from pathlib import Path
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
import importlib.resources

from version import __version__

PACKAGE_NAME = 'snet-sdk'
def install_and_compile_proto():
"""
Compiles protobuf files directly.
"""
proto_dir = Path(__file__).absolute().parent.joinpath(
"snet", "sdk", "resources", "proto")

grpc_protos_include = str(importlib.resources.files('grpc_tools').joinpath('_proto'))

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()
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

with open("./requirements.txt") as f:
requirements_str = f.read()
requirements = requirements_str.split("\n")
# glob('*.proto') is non-recursive. It will NOT look inside subfolders.
for fn in proto_dir.glob('*.proto'):
print(f"Compiling protobuf: {fn}")

command = [
'grpc_tools.protoc',
f'-I{proto_dir}',
f'-I{grpc_protos_include}',
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):
"""
This is the hook used by 'python -m build'.
"""
def run(self):
self.execute(install_and_compile_proto, (), msg="Compile protocol buffers")

Check failure on line 49 in setup.py

View check run for this annotation

snet-sonarqube-app / SonarQube Code Analysis

setup.py#L49

Define a constant instead of duplicating this literal "Compile protocol buffers" 3 times.
_build_py.run(self)


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


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


setup(
name=PACKAGE_NAME,
version=__version__,
packages=find_namespace_packages(include=['snet*']),
namespace_packages=['snet'],
url='https://github.com/singnet/snet-sdk-python',
author='SingularityNET Foundation',
author_email='[email protected]',
description='SingularityNET Python SDK',
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,
},
)
33 changes: 0 additions & 33 deletions snet/sdk/resources/proto/control_service_pb2.py

This file was deleted.

137 changes: 0 additions & 137 deletions snet/sdk/resources/proto/control_service_pb2_grpc.py

This file was deleted.

40 changes: 0 additions & 40 deletions snet/sdk/resources/proto/state_service_pb2.py

This file was deleted.

Loading
Loading