Skip to content

Commit 671a570

Browse files
authored
Merge pull request #2886 from opentensor/feat/roman/add-local-env-for-subtensor-endpoint
Add defaults for endpoint and network from local env
2 parents 4112a85 + b28d153 commit 671a570

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

bittensor/core/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@
121121
"maxsize": int(_BT_PRIORITY_MAXSIZE) if _BT_PRIORITY_MAXSIZE else 10,
122122
},
123123
"subtensor": {
124-
"chain_endpoint": DEFAULT_ENDPOINT,
125-
"network": DEFAULT_NETWORK,
124+
"chain_endpoint": os.getenv("BT_CHAIN_ENDPOINT") or DEFAULT_ENDPOINT,
125+
"network": os.getenv("BT_NETWORK") or DEFAULT_NETWORK,
126126
"_mock": False,
127127
},
128128
"wallet": {

bittensor/core/types.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ def add_args(cls, parser: "argparse.ArgumentParser", prefix: Optional[str] = Non
124124
"""
125125
prefix_str = "" if prefix is None else f"{prefix}."
126126
try:
127-
default_network = settings.DEFAULT_NETWORK
128-
default_chain_endpoint = settings.FINNEY_ENTRYPOINT
127+
default_network = settings.DEFAULTS.subtensor.network
128+
default_chain_endpoint = settings.DEFAULTS.subtensor.chain_endpoint
129129

130130
parser.add_argument(
131131
f"--{prefix_str}subtensor.network",

tests/unit_tests/test_subtensor_api.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
def test_properties_methods_comparable(other_class: "Subtensor" = None):
77
"""Verifies that methods in SubtensorApi and its properties contains all Subtensors methods."""
88
# Preps
9-
subtensor = other_class(_mock=True) if other_class else Subtensor(_mock=True)
10-
subtensor_api = SubtensorApi(mock=True)
9+
subtensor = (
10+
other_class(network="latent-lite", _mock=True)
11+
if other_class
12+
else Subtensor(network="latent-lite", _mock=True)
13+
)
14+
subtensor_api = SubtensorApi(network="latent-lite", mock=True)
1115

1216
subtensor_methods = [m for m in dir(subtensor) if not m.startswith("_")]
1317

@@ -62,8 +66,12 @@ def test__methods_comparable_with_passed_legacy_methods(
6266
):
6367
"""Verifies that methods in SubtensorApi contains all Subtensors methods if `legacy_methods=True` is passed."""
6468
# Preps
65-
subtensor = other_class(mock=True) if other_class else Subtensor(_mock=True)
66-
subtensor_api = SubtensorApi(mock=True, legacy_methods=True)
69+
subtensor = (
70+
other_class(network="latent-lite", mock=True)
71+
if other_class
72+
else Subtensor(network="latent-lite", _mock=True)
73+
)
74+
subtensor_api = SubtensorApi(network="latent-lite", mock=True, legacy_methods=True)
6775

6876
subtensor_methods = [m for m in dir(subtensor) if not m.startswith("_")]
6977
subtensor_api_methods = [m for m in dir(subtensor_api) if not m.startswith("_")]

0 commit comments

Comments
 (0)