From 94e7bb84a17aaf905280382b252326c1b965707b Mon Sep 17 00:00:00 2001 From: Cameron Fairchild Date: Mon, 22 Jul 2024 10:32:07 -0400 Subject: [PATCH 1/4] Merge pull request #2156 from opentensor/feat/ledger-integration [Ledger Integration] [Feature] bump pysub to 1.7.9+ --- bittensor/subtensor.py | 15 --------------- requirements/prod.txt | 6 +++--- scripts/environments/apple_m1_environment.yml | 4 ++-- 3 files changed, 5 insertions(+), 20 deletions(-) diff --git a/bittensor/subtensor.py b/bittensor/subtensor.py index 701e469e19..ebfd733e83 100644 --- a/bittensor/subtensor.py +++ b/bittensor/subtensor.py @@ -22,7 +22,6 @@ """ import argparse import copy -import functools import socket import time from typing import List, Dict, Union, Optional, Tuple, TypedDict, Any, TypeVar @@ -105,20 +104,6 @@ KEY_NONCE: Dict[str, int] = {} -T = TypeVar("T") - -####### -# Monkey patch in caching the convert_type_string method -####### -if hasattr(RuntimeConfiguration, "convert_type_string"): - original_convert_type_string = RuntimeConfiguration.convert_type_string - - @functools.lru_cache(maxsize=None) - def convert_type_string(cls, name): - return original_convert_type_string(name) - - RuntimeConfiguration.convert_type_string = convert_type_string -####### class ParamWithTypes(TypedDict): diff --git a/requirements/prod.txt b/requirements/prod.txt index d5bbf44b87..ca8f2e9b5e 100644 --- a/requirements/prod.txt +++ b/requirements/prod.txt @@ -28,9 +28,9 @@ pytest retry requests rich -scalecodec==1.2.7 # scalecodec should not be changed unless first verifying compatibility with the subtensor's monkeypatching of scalecodec.RuntimeConfiguration.get_decoder_class -shtab==1.6.5 -substrate-interface==1.7.5 +scalecodec==1.2.11 +shtab~=1.6.5 +substrate-interface~=1.7.9 termcolor tqdm uvicorn==0.22.0 diff --git a/scripts/environments/apple_m1_environment.yml b/scripts/environments/apple_m1_environment.yml index c18da7236a..031b36c2bd 100644 --- a/scripts/environments/apple_m1_environment.yml +++ b/scripts/environments/apple_m1_environment.yml @@ -229,7 +229,7 @@ dependencies: - retry==0.9.2 - rich==12.5.1 - rsa==4.9 - - scalecodec==1.2.7 # scalecodec should not be changed unless first verifying compatibility with the subtensor's monkeypatching of scalecodec.RuntimeConfiguration.get_decoder_class + - scalecodec==1.2.11 - scikit-learn==1.2.2 - scipy==1.10.1 - sentencepiece==0.1.99 @@ -243,7 +243,7 @@ dependencies: - sqlalchemy==2.0.19 - starlette==0.37.2 - streamlit==1.22.0 - - substrate-interface==1.5.2 + - substrate-interface==1.7.9 - tenacity==8.2.2 - termcolor==2.1.1 - threadpoolctl==3.1.0 From 31175ecb9dc7935ee3827257df22f5e2dac68a5c Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 25 Jul 2024 13:27:07 -0700 Subject: [PATCH 2/4] Bumps version to 7.0.2 --- VERSION | 2 +- bittensor/__init__.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/VERSION b/VERSION index 73a86b1970..2f963cd6d1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -7.0.1 \ No newline at end of file +7.0.2 \ No newline at end of file diff --git a/bittensor/__init__.py b/bittensor/__init__.py index 22afe57058..9a6524b1ea 100644 --- a/bittensor/__init__.py +++ b/bittensor/__init__.py @@ -27,7 +27,7 @@ nest_asyncio.apply() # Bittensor code and protocol version. -__version__ = "7.0.1" +__version__ = "7.0.2" version_split = __version__.split(".") __version_as_int__: int = ( From 1021d463466906b1a0b8298b72cd6c9b969fa2ee Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 25 Jul 2024 13:49:21 -0700 Subject: [PATCH 3/4] Adds back TypeVar --- bittensor/subtensor.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bittensor/subtensor.py b/bittensor/subtensor.py index ebfd733e83..29f59b3e1d 100644 --- a/bittensor/subtensor.py +++ b/bittensor/subtensor.py @@ -20,6 +20,7 @@ The ``bittensor.subtensor`` module in Bittensor serves as a crucial interface for interacting with the Bittensor blockchain, facilitating a range of operations essential for the decentralized machine learning network. """ + import argparse import copy import socket @@ -104,6 +105,7 @@ KEY_NONCE: Dict[str, int] = {} +T = TypeVar("T") class ParamWithTypes(TypedDict): @@ -2741,9 +2743,7 @@ def query_runtime_api( """ call_definition = bittensor.__type_registry__["runtime_api"][runtime_api][ # type: ignore "methods" # type: ignore - ][ - method - ] # type: ignore + ][method] # type: ignore json_result = self.state_call( method=f"{runtime_api}_{method}", @@ -4131,7 +4131,8 @@ def make_substrate_call_with_retry(): if block_hash: params = params + [block_hash] return self.substrate.rpc_request( - method="neuronInfo_getNeuron", params=params # custom rpc method + method="neuronInfo_getNeuron", + params=params, # custom rpc method ) json_body = make_substrate_call_with_retry() From 8c1ba64e7f50952338d0227cabfbfbef246e6732 Mon Sep 17 00:00:00 2001 From: ibraheem-opentensor Date: Thu, 25 Jul 2024 15:16:30 -0700 Subject: [PATCH 4/4] Adds release workflow --- .github/workflows/release.yml | 72 +++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000000..2cdfe5dfa0 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,72 @@ +name: Build and Publish Python Package + +on: + workflow_dispatch: + inputs: + version: + description: 'Version to release' + required: true + type: string + +jobs: + build: + name: Build Python distribution + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: '3.10' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install build wheel twine + + - name: Build package + run: python setup.py sdist bdist_wheel + + - name: Check if package version already exists + run: | + PACKAGE_NAME=$(python setup.py --name) + PACKAGE_VERSION=${{ github.event.inputs.version }} + if twine check dist/*; then + if pip install $PACKAGE_NAME==$PACKAGE_VERSION; then + echo "Error: Version $PACKAGE_VERSION of $PACKAGE_NAME already exists on PyPI" + exit 1 + else + echo "Version $PACKAGE_VERSION of $PACKAGE_NAME does not exist on PyPI. Proceeding with upload." + fi + else + echo "Error: Twine check failed." + exit 1 + fi + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: dist + path: dist/ + + approve-and-publish: + needs: build + runs-on: ubuntu-latest + environment: release + permissions: + contents: read + id-token: write + + steps: + - name: Download artifact + uses: actions/download-artifact@v3 + with: + name: dist + path: dist/ + + - name: Publish package distributions to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + verbose: true + print-hash: true \ No newline at end of file