Skip to content

Commit d0cfd9e

Browse files
authored
Merge pull request #2872 from opentensor/release/9.5.0
Release/9.5.0
2 parents 4567f37 + 1acc9d8 commit d0cfd9e

File tree

96 files changed

+5055
-2343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+5055
-2343
lines changed

.github/workflows/docker_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
steps:
2020
- name: Check out code
21-
uses: actions/checkout@v3
21+
uses: actions/checkout@v4
2222

2323
- name: Install cosign
2424
uses: sigstore/cosign-installer@v3
@@ -48,4 +48,4 @@ jobs:
4848
DIGEST: ${{ steps.build.outputs.digest }}
4949
TAGS: ${{ steps.build.outputs.tags }}
5050
run: |
51-
echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
51+
echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

.github/workflows/e2e-subtensor-tests.yaml

Lines changed: 82 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
branches: [master, development, staging]
1313
types: [ opened, synchronize, reopened, ready_for_review ]
1414

15+
schedule:
16+
- cron: '0 9 * * *' # Run every night at 2:00 PST
17+
1518
workflow_dispatch:
1619
inputs:
1720
verbose:
@@ -40,7 +43,7 @@ jobs:
4043
run: |
4144
test_files=$(find tests/e2e_tests -name "test*.py" | jq -R -s -c 'split("\n") | map(select(. != ""))')
4245
# keep it here for future debug
43-
# test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(incentive|commit_weights|set_weights)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
46+
# test_files=$(find tests/e2e_tests -type f -name "test*.py" | grep -E 'test_(hotkeys|staking)\.py$' | jq -R -s -c 'split("\n") | map(select(. != ""))')
4447
echo "test-files=$test_files" >> "$GITHUB_OUTPUT"
4548
shell: bash
4649

@@ -63,8 +66,8 @@ jobs:
6366
path: subtensor-localnet.tar
6467

6568
# Job to run tests in parallel
66-
run-e2e-test:
67-
name: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}
69+
run-fast-blocks-e2e-test:
70+
name: "FB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}"
6871
needs:
6972
- find-tests
7073
- pull-docker-image
@@ -107,7 +110,80 @@ jobs:
107110
- name: Run tests with retry
108111
run: |
109112
set +e
110-
for i in 1 2; do
113+
for i in 1 2 3; do
114+
echo "🔁 Attempt $i: Running tests"
115+
uv run pytest ${{ matrix.test-file }} -s
116+
status=$?
117+
if [ $status -eq 0 ]; then
118+
echo "✅ Tests passed on attempt $i"
119+
break
120+
else
121+
echo "❌ Tests failed on attempt $i"
122+
if [ $i -eq 3 ]; then
123+
echo "Tests failed after 3 attempts"
124+
exit 1
125+
fi
126+
echo "Retrying..."
127+
sleep 5
128+
fi
129+
done
130+
131+
132+
cron-run-non-fast-blocks-e2e-test:
133+
if: github.event_name == 'schedule'
134+
name: "NFB: ${{ matrix.test-file }} / Python ${{ matrix.python-version }}"
135+
needs:
136+
- find-tests
137+
- pull-docker-image
138+
runs-on: ubuntu-latest
139+
timeout-minutes: 1440
140+
141+
strategy:
142+
fail-fast: false # Allow other matrix jobs to run even if this job fails
143+
max-parallel: 32 # Set the maximum number of parallel jobs (same as we have cores in ubuntu-latest runner)
144+
matrix:
145+
os:
146+
- ubuntu-latest
147+
test-file: ${{ fromJson(needs.find-tests.outputs.test-files) }}
148+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
149+
150+
steps:
151+
- name: Check if today is Saturday
152+
run: |
153+
day=$(date -u +%u)
154+
echo "Today is weekday $day"
155+
if [ "$day" -ne 6 ]; then
156+
echo "⏭️ Skipping: not Saturday"
157+
exit 78
158+
fi
159+
- name: Check-out repository
160+
uses: actions/checkout@v4
161+
162+
- name: Set up Python ${{ matrix.python-version }}
163+
uses: actions/setup-python@v5
164+
with:
165+
python-version: ${{ matrix.python-version }}
166+
167+
- name: Install uv
168+
uses: astral-sh/setup-uv@v4
169+
170+
- name: install dependencies
171+
run: uv sync --extra dev --dev
172+
173+
- name: Download Cached Docker Image
174+
uses: actions/download-artifact@v4
175+
with:
176+
name: subtensor-localnet
177+
178+
- name: Load Docker Image
179+
run: docker load -i subtensor-localnet.tar
180+
181+
- name: Run patched E2E tests
182+
env:
183+
FAST_BLOCKS: "0"
184+
run: |
185+
set +e
186+
for i in 1 2 3; do
111187
echo "🔁 Attempt $i: Running tests"
112188
uv run pytest ${{ matrix.test-file }} -s
113189
status=$?
@@ -116,8 +192,8 @@ jobs:
116192
break
117193
else
118194
echo "❌ Tests failed on attempt $i"
119-
if [ $i -eq 2 ]; then
120-
echo "Tests failed after 2 attempts"
195+
if [ $i -eq 3 ]; then
196+
echo "Tests failed after 3 attempts"
121197
exit 1
122198
fi
123199
echo "Retrying..."
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
# This workflow measures the disk size of a virtual environment
2+
# after installing the Bittensor SDK across multiple Python versions.
3+
# It runs only when a new pull request targets the master branch,
4+
# and posts a comment with the results.
5+
name: Monitor SDK Requirements Size
6+
7+
on:
8+
pull_request:
9+
types: [opened]
10+
branches: [master]
11+
12+
permissions:
13+
pull-requests: write
14+
contents: read
15+
16+
jobs:
17+
measure-venv:
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
22+
outputs:
23+
py39: ${{ steps.set-output.outputs.py39 }}
24+
py310: ${{ steps.set-output.outputs.py310 }}
25+
py311: ${{ steps.set-output.outputs.py311 }}
26+
py312: ${{ steps.set-output.outputs.py312 }}
27+
py313: ${{ steps.set-output.outputs.py313 }}
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
- uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
35+
- name: Create virtualenv and install
36+
run: |
37+
python -m venv venv
38+
source venv/bin/activate
39+
pip install --upgrade pip
40+
pip install .
41+
42+
- name: Measure venv size
43+
id: set-output
44+
run: |
45+
SIZE=$(du -sm venv | cut -f1)
46+
VERSION=${{ matrix.python-version }}
47+
echo "Detected size: $SIZE MB for Python $VERSION"
48+
case "$VERSION" in
49+
3.9) echo "py39=$SIZE" >> $GITHUB_OUTPUT ;;
50+
3.10) echo "py310=$SIZE" >> $GITHUB_OUTPUT ;;
51+
3.11) echo "py311=$SIZE" >> $GITHUB_OUTPUT ;;
52+
3.12) echo "py312=$SIZE" >> $GITHUB_OUTPUT ;;
53+
3.13) echo "py313=$SIZE" >> $GITHUB_OUTPUT ;;
54+
esac
55+
56+
comment-on-pr:
57+
if: github.event_name == 'pull_request' && github.base_ref == 'master'
58+
needs: measure-venv
59+
runs-on: ubuntu-latest
60+
steps:
61+
- name: Post venv size summary to PR
62+
uses: actions/github-script@v7
63+
with:
64+
github-token: ${{ secrets.GITHUB_TOKEN }}
65+
script: |
66+
const sizes = {
67+
"3.9": "${{ needs.measure-venv.outputs.py39 || 'N/A' }}",
68+
"3.10": "${{ needs.measure-venv.outputs.py310 || 'N/A' }}",
69+
"3.11": "${{ needs.measure-venv.outputs.py311 || 'N/A' }}",
70+
"3.12": "${{ needs.measure-venv.outputs.py312 || 'N/A' }}",
71+
"3.13": "${{ needs.measure-venv.outputs.py313 || 'N/A' }}",
72+
};
73+
74+
const body = [
75+
'**Bittensor SDK virtual environment sizes by Python version:**',
76+
'',
77+
'```'
78+
]
79+
.concat(Object.entries(sizes).map(([v, s]) => `Python ${v}: ${s} MB`))
80+
.concat(['```'])
81+
.join('\n');
82+
83+
github.rest.issues.createComment({
84+
issue_number: context.issue.number,
85+
owner: context.repo.owner,
86+
repo: context.repo.repo,
87+
body
88+
});

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
name: Build Python distribution
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
16+
- uses: actions/checkout@v4
1717

1818
- name: Set up Python
1919
uses: actions/setup-python@v4
@@ -69,4 +69,4 @@ jobs:
6969
uses: pypa/gh-action-pypi-publish@release/v1
7070
with:
7171
verbose: true
72-
print-hash: true
72+
print-hash: true

CHANGELOG.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,44 @@
11
# Changelog
22

3+
## 9.5.0 /2025-05-12
4+
5+
## What's Changed
6+
* Release/9.4.0 by @ibraheem-abe in https://github.com/opentensor/bittensor/pull/2837
7+
* Update subnet units by @thewhaleking in https://github.com/opentensor/bittensor/pull/2838
8+
* Add `force_register_neuron` into MockSubtensor by @basfroman in https://github.com/opentensor/bittensor/pull/2839
9+
* Add `Monitor-Requirements-Size` workflow by @basfroman in https://github.com/opentensor/bittensor/pull/2842
10+
* Add `SelectiveMetagraph` interface into SDK by @basfroman in https://github.com/opentensor/bittensor/pull/2846
11+
* Update docs for unstake amount by @thewhaleking in https://github.com/opentensor/bittensor/pull/2845
12+
* Add one more attempt to e2e tests by @basfroman in https://github.com/opentensor/bittensor/pull/2849
13+
* Fix typos in test documentation and docstrings by @leopardracer in https://github.com/opentensor/bittensor/pull/2848
14+
* Add bittensor-drand==0.5.0 by @basfroman in https://github.com/opentensor/bittensor/pull/2835
15+
* Extend selective metagraph logic by @basfroman in https://github.com/opentensor/bittensor/pull/2852
16+
* fix: $BASH_ENV loading issue by @defitricks in https://github.com/opentensor/bittensor/pull/2851
17+
* Update github actions versions due to deprecation by @PixelPil0t1 in https://github.com/opentensor/bittensor/pull/2850
18+
* Add methods to Async/Subtensor class by @basfroman in https://github.com/opentensor/bittensor/pull/2854
19+
* Cleanup, refactoring, small fix, improvement by @basfroman in https://github.com/opentensor/bittensor/pull/2856
20+
* Add `period` argument to extrinsics calls by @basfroman in https://github.com/opentensor/bittensor/pull/2857
21+
* Add nightly run of e2e tests by @basfroman in https://github.com/opentensor/bittensor/pull/2858
22+
* `period=16` for fast blocks test by @basfroman in https://github.com/opentensor/bittensor/pull/2859
23+
* Fix some unittests warnings by @zyzniewski-reef in https://github.com/opentensor/bittensor/pull/2774
24+
* docs: fix typos in `README.md` by @gap-editor in https://github.com/opentensor/bittensor/pull/2861
25+
* Introduce `SubtensorApi` interface for SDK by @basfroman in https://github.com/opentensor/bittensor/pull/2862
26+
* Adds `__all__` to easy_imports.py to get rid of all the #noqa stuff by @thewhaleking in https://github.com/opentensor/bittensor/pull/2863
27+
* `🥩s` to `staking` by @basfroman in https://github.com/opentensor/bittensor/pull/2864
28+
* Fix `get_next_epoch_start_block` by @basfroman in https://github.com/opentensor/bittensor/pull/2865
29+
* docs: fix dead link by @GarmashAlex in https://github.com/opentensor/bittensor/pull/2866
30+
* Add `non-fast-blocks` e2e tests each Saturday by @basfroman in https://github.com/opentensor/bittensor/pull/2860
31+
* Selective-metagraph -> MetagraphInfo by @basfroman in https://github.com/opentensor/bittensor/pull/2870
32+
* Improve e2e tests and fix bug in SubtensorApi by @basfroman in https://github.com/opentensor/bittensor/pull/2869
33+
34+
## New Contributors
35+
* @defitricks made their first contribution in https://github.com/opentensor/bittensor/pull/2851
36+
* @PixelPil0t1 made their first contribution in https://github.com/opentensor/bittensor/pull/2850
37+
* @gap-editor made their first contribution in https://github.com/opentensor/bittensor/pull/2861
38+
* @GarmashAlex made their first contribution in https://github.com/opentensor/bittensor/pull/2866
39+
40+
**Full Changelog**: https://github.com/opentensor/bittensor/compare/v9.4.0...v9.5.0
41+
342
## 9.4.0 /2025-04-17
443

544
## What's Changed

README.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,23 +234,29 @@ pytest tests/unit_tests
234234
- using a compiler based on the substrait code
235235
- using an already built docker image (docker runner)
236236

237+
#### Local environment variables:
238+
- `LOCALNET_SH_PATH` - path to `localnet.sh` script in cloned subtensor repository (for legacy runner);
239+
- `BUILD_BINARY` - (`=0` or `=1`) - used with `LOCALNET_SH_PATH` for build or not before start localnet node (for legacy runner);
240+
- `USE_DOCKER` - (`=0` or `=1`) - used if you want to use specific runner to run e2e tests (for docker runner);
241+
- `FAST_BLOCKS` - (`=0` or `=1`) - allows you to run a localnet node in fast or non-fast blocks mode (for both types of runers).
242+
237243
#### Using `docker runner` (default for now):
238244
- E2E tests with docker image do not require preliminary compilation
239245
- are executed very quickly
240246
- require docker installed in OS
241247

242-
Ho to use:
248+
How to use:
243249
```bash
244250
pytest tests/e2e_tests
245251
```
246252

247-
#### TUsing `legacy runner`:
253+
#### Using `legacy runner`:
248254
- Will start compilation of the collected code in your subtensor repository
249255
- you must provide the `LOCALNET_SH_PATH` variable in the local environment with the path to the file `/scripts/localnet.sh` in the cloned repository within your OS
250256
- you can use the `BUILD_BINARY=0` variable, this will skip the copy step for each test.
251257
- you can use the `USE_DOCKER=0` variable, this will run tests using the "legacy runner", even if docker is installed in your OS
252258

253-
#### Ho to use:
259+
#### How to use:
254260
Regular e2e tests run
255261
```bash
256262
LOCALNET_SH_PATH=/path/to/your/localnet.sh pytest tests/e2e_tests

0 commit comments

Comments
 (0)