agcli-py: complete Phase 1 polish, Phase 2 extrinsics MVP, Phase 3 features, DX release#7
Merged
Merged
Conversation
Co-authored-by: Arbos <unarbos@users.noreply.github.com>
Co-authored-by: Arbos <unarbos@users.noreply.github.com>
- events module exposes EventFilter dataclass and async iterator subscriptions (subscribe_events, subscribe_events_filtered, subscribe_blocks) backed by a tokio mpsc-driven PyEventStream that cancels on drop. - live module wraps live_dynamic/live_metagraph/live_portfolio. - localnet module exposes LocalnetConfig/Info/Status/DevAccount pyclasses plus start/stop/status/reset/logs/dev_accounts; status falls back to inactive when docker is missing. - scaffold module mirrors ScaffoldConfig/SubnetConfig/NeuronConfig/result types with load_config and an async run thin-wrapper. - admin module exposes every set_* helper from src/admin.rs, raw_admin_call, and known_params() for AdminUtils sudo calls. Wires AsyncClient.subscribe_* through the native EventStream, registers all new submodules under agcli._agcli, and updates _native.pyi. Tests cover EventFilter roundtrip, dev_accounts/LocalnetConfig/status without docker, scaffold TOML round-trip, admin known_params and exported set_* inventory, and a live-import smoke test. Localnet/network tests stay gated behind the existing markers. Co-authored-by: Arbos <unarbos@users.noreply.github.com>
Co-authored-by: Arbos <unarbos@users.noreply.github.com>
Co-authored-by: Arbos <unarbos@users.noreply.github.com>
…d-fix Co-authored-by: Arbos <unarbos@users.noreply.github.com>
Co-authored-by: Arbos <unarbos@users.noreply.github.com>
The events::tests::pretty_subtensor_variants_are_exhaustive test reads from the subtensor/ submodule which is not initialized by default. Add submodules: recursive to the test and coverage jobs (parity with the check, python-clippy, and sdk-only jobs already updated). Co-authored-by: Arbos <unarbos@users.noreply.github.com>
unarbos
pushed a commit
that referenced
this pull request
May 29, 2026
Reconcile merge conflicts after landing agcli-py Phase 1–3, update Python extrinsic bindings for AlphaBalance/LimitPriceRao and renamed query methods, and keep extrinsic encoding regression tests plus CI jobs from local work. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Completes the agcli Python bindings roadmap on top of the merged Phase 1 base. The branch carries Phase 1 polish, Phase 2 extrinsics MVP, Phase 3 features (events / live / localnet / scaffold / admin), and the DX/release pipeline. After the audit/feature merge that landed on
mainwhile this work was in flight, this branch was force-rebased forward and fixed up so every required CI check passes.Phase 1 polish (carry-forward in this branch):
best_connection,reconnect,is_alive,invalidate_cache), block/hash queries, totals,get_balances_multi,get_all_dynamic_info, every pinned/historical_at_block/_at_hashvariant.get_delegated, full weight commit/reveal queries, PoW helpers,fetch_portfolio.agcli.Configwithload/save/load_from/save_to/default_path.AsyncClientmutators:set_dry_run,set_finalization_timeout,set_mortality_blocks,networkgetter.Wallet.create_from_uri,sign_message,verify_message,coldkey_public_ss58.SubnetInfo,NeuronInfo,NeuronInfoLite,Metagraph,StakeInfo,DelegateInfo,DynamicInfo,SubnetHyperparameters,ChainIdentity,SubnetIdentity,AlphaBalance).map_error(NetworkError,AuthError,ValidationError,ChainError,TimeoutError,IOError).agcli.SyncClient(private tokio runtime).Rust SDK prep:
agcli::Client::network()accessor.agcli::sdkre-export module (Client,Config,Wallet,Balance,Network,NetUid,types::chain_data,error).[[bin]] required-features = ["cli"]socargo check --no-default-features --features sdk-onlyworks at the workspace root.Phase 2 extrinsics MVP:
transfer,transfer_all); staking (add_stake,remove_stake,*_limit,move_stake,swap_stake,swap_stake_limit,transfer_stake,unstake_all,unstake_all_alpha,recycle_alpha,burn_alpha,claim_root); weights (set_weights,commit_weights,reveal_weights); registration (register_network,burned_register,pow_register,root_register,dissolve_network); proxy (add_proxy,remove_proxy,create_pure_proxy,kill_pure_proxy,try_associate_hotkey,schedule_swap_coldkey,swap_hotkey,set_subnet_identity).wait,mev,dry_run,finalization_timeout,mortality_blockskwargs.agcli.ValidationError.Wallet.session(password=...)context manager,unlock_coldkey_with_password,lock,is_coldkey_unlocked,is_hotkey_loaded.python/tests/test_extrinsics_localnet.pycovering transfer, stake, weights, register/dissolve, proxy add/remove behind@pytest.mark.localnet.Phase 3 features:
agcli.events: asyncsubscribe_events,subscribe_events_filtered,subscribe_blocksreturning async iterators backed by tokio mpsc;EventFilterdataclass mirrorsagcli::events::EventFilter.agcli.live:live_dynamic,live_metagraph,live_portfolioasync helpers.agcli.localnet:start,stop,status,reset,logs,dev_accounts, plusLocalnetConfig,LocalnetInfo,LocalnetStatus,DevAccountpyclasses (withstarted_atplus a backwards-compatibleuptimealias for the field rename that landed on main).agcli.scaffold:load_config, asyncrun, plusScaffoldConfig,SubnetConfig,NeuronConfig,ScaffoldResult,SubnetResult,NeuronResultpyclasses.agcli.admin: everyset_*admin extrinsic fromsrc/admin.rs,raw_admin_call, andknown_params().DX / release:
python/agcli/py.typed, exhaustivepython/agcli/_native.pyi(including explicit admin signatures).TypeErroron__reduce__/__getstate__) across every PyO3 class and Python facade; test coverage inpython/tests/test_bindings.py.python/SECURITY.mddocumenting binding-boundary guarantees andcargo audit -qfindings.examples/python/:connect_and_balance.py,wallet_lifecycle.py,transfer_dry_run.py,extrinsics_mvp.py,subscribe_events.py,localnet_smoke.py.docs/tutorials/python-sdk.mdcovering install, async + sync clients, wallet lifecycle, reads, extrinsics, events, localnet, typed errors, config — code blocks sourced fromexamples/python/.python/agcli/__about__.pywith__version__; enrichedpython/pyproject.toml(readme, classifiers, project URLs);python/MANIFEST.in.CI:
python-clippyjob (cargo clippy -p agcli-py --no-deps --features pyo3/extension-module -- -D warnings).sdk-onlyjob (cargo check --no-default-features --features sdk-only).pytest -m "not network and not localnet".wheelsmatrix ({ubuntu-latest, macos-latest} × {3.10, 3.11, 3.12}) runningmaturin build --release --stripwith artifact upload.submodules: recursiveadded to checkout forcheck,python-clippy,sdk-only,test, andcoveragejobs (the events exhaustiveness test reads from thesubtensor/submodule).Swatinem/rust-cache@v2target cache across jobs.Notes:
@pytest.mark.localnet. CI does not run them by default; adocker-capable runner can opt in by settingAGCLI_LOCALNET_WS.mainafter a large audit/feature merge landed there (Merge main and fix agcli-py/CI regressions); see the merge commit and follow-on fix commits for the rename + clippy fixes.Acceptance:
py.typedmarker shipped in wheel;_native.pyiexhaustive.docs/tutorials/python-sdk.mdandexamples/python/*present and cross-referenced.TypeError(test exercised).python/SECURITY.mdpresent with audit findings.python-clippy,sdk-only, andwheelsmatrix jobs.Check & Lint,Python clippy,SDK-only check,Test,Python bindings,Wheels (ubuntu × {3.10, 3.11, 3.12}),Wheels (macos × {3.10, 3.11, 3.12}). (CoverageandBuild Releaseare skipped on PRs by design — they only run on push tomain.)MERGEABLEagainstmain.