citrate-labs-sdk 0.6.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. citrate_labs_sdk-0.6.0/CHANGELOG.md +31 -0
  2. citrate_labs_sdk-0.6.0/LICENSE +145 -0
  3. citrate_labs_sdk-0.6.0/MANIFEST.in +11 -0
  4. citrate_labs_sdk-0.6.0/PKG-INFO +87 -0
  5. citrate_labs_sdk-0.6.0/README.md +39 -0
  6. citrate_labs_sdk-0.6.0/citrate_labs_sdk.egg-info/PKG-INFO +87 -0
  7. citrate_labs_sdk-0.6.0/citrate_labs_sdk.egg-info/SOURCES.txt +44 -0
  8. citrate_labs_sdk-0.6.0/citrate_labs_sdk.egg-info/dependency_links.txt +1 -0
  9. citrate_labs_sdk-0.6.0/citrate_labs_sdk.egg-info/entry_points.txt +2 -0
  10. citrate_labs_sdk-0.6.0/citrate_labs_sdk.egg-info/requires.txt +21 -0
  11. citrate_labs_sdk-0.6.0/citrate_labs_sdk.egg-info/top_level.txt +1 -0
  12. citrate_labs_sdk-0.6.0/citrate_sdk/__init__.py +81 -0
  13. citrate_labs_sdk-0.6.0/citrate_sdk/_generated/__init__.py +0 -0
  14. citrate_labs_sdk-0.6.0/citrate_sdk/_generated/contract.py +68 -0
  15. citrate_labs_sdk-0.6.0/citrate_sdk/_generated/federation_contract.json +127 -0
  16. citrate_labs_sdk-0.6.0/citrate_sdk/_url_security.py +75 -0
  17. citrate_labs_sdk-0.6.0/citrate_sdk/abi.py +137 -0
  18. citrate_labs_sdk-0.6.0/citrate_sdk/cli.py +140 -0
  19. citrate_labs_sdk-0.6.0/citrate_sdk/client.py +399 -0
  20. citrate_labs_sdk-0.6.0/citrate_sdk/compute.py +501 -0
  21. citrate_labs_sdk-0.6.0/citrate_sdk/crypto.py +392 -0
  22. citrate_labs_sdk-0.6.0/citrate_sdk/ecdh_real.py +258 -0
  23. citrate_labs_sdk-0.6.0/citrate_sdk/economics/__init__.py +147 -0
  24. citrate_labs_sdk-0.6.0/citrate_sdk/economics/agents.py +447 -0
  25. citrate_labs_sdk-0.6.0/citrate_sdk/economics/charts.py +479 -0
  26. citrate_labs_sdk-0.6.0/citrate_sdk/economics/parameters.py +142 -0
  27. citrate_labs_sdk-0.6.0/citrate_sdk/economics/simulation.py +941 -0
  28. citrate_labs_sdk-0.6.0/citrate_sdk/edu/__init__.py +6 -0
  29. citrate_labs_sdk-0.6.0/citrate_sdk/entitlements.py +68 -0
  30. citrate_labs_sdk-0.6.0/citrate_sdk/errors.py +77 -0
  31. citrate_labs_sdk-0.6.0/citrate_sdk/farming.py +325 -0
  32. citrate_labs_sdk-0.6.0/citrate_sdk/finite_field.py +304 -0
  33. citrate_labs_sdk-0.6.0/citrate_sdk/gateway.py +83 -0
  34. citrate_labs_sdk-0.6.0/citrate_sdk/identity/__init__.py +32 -0
  35. citrate_labs_sdk-0.6.0/citrate_sdk/identity/client.py +204 -0
  36. citrate_labs_sdk-0.6.0/citrate_sdk/identity/jwt.py +91 -0
  37. citrate_labs_sdk-0.6.0/citrate_sdk/identity/pkce.py +32 -0
  38. citrate_labs_sdk-0.6.0/citrate_sdk/identity/wallet.py +101 -0
  39. citrate_labs_sdk-0.6.0/citrate_sdk/ipfs.py +384 -0
  40. citrate_labs_sdk-0.6.0/citrate_sdk/learning.py +799 -0
  41. citrate_labs_sdk-0.6.0/citrate_sdk/models.py +164 -0
  42. citrate_labs_sdk-0.6.0/citrate_sdk/py.typed +0 -0
  43. citrate_labs_sdk-0.6.0/citrate_sdk/treasury.py +317 -0
  44. citrate_labs_sdk-0.6.0/citrate_sdk/types.py +179 -0
  45. citrate_labs_sdk-0.6.0/pyproject.toml +208 -0
  46. citrate_labs_sdk-0.6.0/setup.cfg +4 -0
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ All notable changes to `citrate-labs-sdk` are documented here. This project adheres to
4
+ [Semantic Versioning](https://semver.org/).
5
+
6
+ ## [0.6.0] - 2026-07-26 — DevX Convergence
7
+
8
+ ### Added
9
+ - **Federation contract artifact** (`citrate_sdk._generated.contract`): the single source of
10
+ truth for chain addresses, chainId, endpoints, and the entitlement tier vocabulary, vendored
11
+ from the generated `federation-contract.json` and drift-gated (`scripts/sync_contract.py`).
12
+ - **Identity spine + embedded wallet** (`citrate_sdk.identity`): OIDC PKCE + SIWE, hardened
13
+ `verify_id_token` (RS256; rejects alg:none / alg-confusion / bad aud/iss / expired / tampered),
14
+ `IdentityClient` (discover / authorize / exchange / refresh / userinfo → capabilities / deploy
15
+ permit / guardians / logout), and smart-account address prediction
16
+ (`predict_wallet_address` / `verify_wallet_address_on_chain`) verified byte-for-byte against
17
+ the on-chain factory — never trusting the authority's `/aa/address`.
18
+ - **Entitlement capabilities** (`citrate_sdk.entitlements`): canonical `normalize_tier`
19
+ (unknown → public, never escalates) + capability map (`commercial.kyc` opens transactions,
20
+ not content; no global rank).
21
+ - **Inference gateway client** (`citrate_sdk.gateway`): OpenAI-compatible over
22
+ `infer.citrate.ai`, `cgk_` bearer, typed 401/402/429/503, fail-closed without a key.
23
+ - **Command line** (`citrate`): `contract`, `wallet predict`, `entitlement`, `gateway` — fixes
24
+ the previously-declared-but-missing `citrate_sdk.cli:main` entry point.
25
+ - **`py.typed`** marker so type checkers recognize the package's inline types.
26
+
27
+ ### Notes
28
+ - All new crypto uses existing dependencies (`eth_utils`, `cryptography`, `requests`) — no new
29
+ runtime dependencies.
30
+ - Cross-language parity: address prediction and capability answers match the JavaScript SDK
31
+ (`@citratenetwork/sdk`) exactly.
@@ -0,0 +1,145 @@
1
+ SPDX-FileCopyrightText: 2026 Mozi Cooperative
2
+ SPDX-License-Identifier: BUSL-1.1
3
+
4
+ Citrate — Business Source License 1.1 Parameters and Additional Use Grant
5
+
6
+ Licensor: Mozi Cooperative
7
+
8
+ Licensed Work: The Citrate software, source code, binaries, SDKs, browser wallet,
9
+ desktop applications, formal specifications, documentation, design assets,
10
+ configuration, examples, and related materials made available by or on behalf of
11
+ Mozi Cooperative in this repository and its official companion repositories,
12
+ excluding third-party components that are separately licensed.
13
+
14
+ Additional Use Grant:
15
+
16
+ You may make Production Use of the Licensed Work, without a separate commercial
17
+ license from Mozi Cooperative, solely for Permitted Community Use. "Permitted
18
+ Community Use" means:
19
+
20
+ 1. personal study, hobby, experimentation, academic study, classroom use,
21
+ public-interest research, lab work, or private evaluation;
22
+ 2. internal noncommercial use by an individual, school, university, research
23
+ group, nonprofit, cooperative, or community organization;
24
+ 3. operation of a private, non-public learning or research network, including
25
+ use with friends, classmates, collaborators, or a small local community,
26
+ provided that all of the following are true:
27
+ a. the network is not operated as a commercial product or service;
28
+ b. the network is not used to generate direct or indirect revenue, fees,
29
+ subscriptions, token-sale proceeds, or paid support obligations tied to the
30
+ Licensed Work;
31
+ c. the network is not offered to third parties as hosted infrastructure,
32
+ managed infrastructure, white-label infrastructure, wallet-as-a-service,
33
+ RPC-as-a-service, agent-as-a-service, inference-as-a-service,
34
+ compute-as-a-service, validator-as-a-service, or similar commercial
35
+ infrastructure;
36
+ d. the deployment remains at or below 25 nodes and 250 user accounts or
37
+ wallet accounts;
38
+ e. any fork or derivative removes or replaces Citrate, Citrate OpenWallet,
39
+ SALT, Mozi Cooperative, and related branding unless separately licensed in
40
+ writing.
41
+
42
+ For clarity, the Additional Use Grant does not permit, without separate written
43
+ permission from Mozi Cooperative:
44
+
45
+ - a public production launch of a chain, network, wallet, hosted service,
46
+ platform, or derivative product;
47
+ - any use in connection with a revenue-generating or fee-generating offering;
48
+ - any production use by or for a commercial entity except as expressly allowed
49
+ above;
50
+ - use of Citrate, Citrate OpenWallet, SALT, Mozi Cooperative marks, logos, or
51
+ confusingly similar branding;
52
+ - offering commercial support, managed hosting, or institutional rollout
53
+ services built on the Licensed Work.
54
+
55
+ Commercial, production, institutional, and partnership use inquiries:
56
+ Partnerships@Citrate.ai
57
+
58
+ Change Date: 2030-04-01
59
+
60
+ Change License: GPL-2.0-or-later
61
+
62
+ Notice on patents, trademarks, and reserved rights:
63
+
64
+ This License does not grant trademark rights. See TRADEMARK_POLICY.md.
65
+ No express or implied patent license is granted except as may be required by law.
66
+ Certain mechanisms and designs embodied in the Licensed Work, including but not
67
+ limited to consensus mechanisms, AI-native precompile interfaces, ZK verifiable
68
+ compute flows, embedded-node application architecture, and agent harness
69
+ architecture, may be the subject of filed, pending, or future patent claims or
70
+ applications by Mozi Cooperative or its affiliates. See PATENT_NOTICE.md.
71
+
72
+ ---
73
+
74
+ Business Source License 1.1
75
+
76
+ License text copyright © 2024 MariaDB plc, All Rights Reserved. “Business Source
77
+ License” is a trademark of MariaDB plc.
78
+
79
+ Terms
80
+
81
+ The Licensor hereby grants you the right to copy, modify, create derivative
82
+ works, redistribute, and make non-production use of the Licensed Work. The
83
+ Licensor may make an Additional Use Grant, above, permitting limited production
84
+ use.
85
+
86
+ Effective on the Change Date, or the fourth anniversary of the first publicly
87
+ available distribution of a specific version of the Licensed Work under this
88
+ License, whichever comes first, the Licensor hereby grants you rights under the
89
+ terms of the Change License, and the rights granted in the paragraph above
90
+ terminate.
91
+
92
+ If your use of the Licensed Work does not comply with the requirements currently
93
+ in effect as described in this License, you must purchase a commercial license
94
+ from the Licensor, its affiliated entities, or authorized resellers, or you must
95
+ refrain from using the Licensed Work.
96
+
97
+ All copies of the original and modified Licensed Work, and derivative works of
98
+ the Licensed Work, are subject to this License. This License applies separately
99
+ for each version of the Licensed Work and the Change Date may vary for each
100
+ version of the Licensed Work released by Licensor.
101
+
102
+ You must conspicuously display this License on each original or modified copy of
103
+ the Licensed Work. If you receive the Licensed Work in original or modified form
104
+ from a third party, the terms and conditions set forth in this License apply to
105
+ your use of that work.
106
+
107
+ Any use of the Licensed Work in violation of this License will automatically
108
+ terminate your rights under this License for the current and all other versions
109
+ of the Licensed Work.
110
+
111
+ This License does not grant you any right in any trademark or logo of Licensor
112
+ or its affiliates (provided that you may use a trademark or logo of Licensor as
113
+ expressly required by this License).
114
+
115
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN
116
+ "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS
117
+ OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS
118
+ FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
119
+
120
+ MariaDB hereby grants you permission to use this License's text to license your
121
+ works, and to refer to it using the trademark "Business Source License", as long
122
+ as you comply with the Covenants of Licensor below.
123
+
124
+ Covenants of Licensor
125
+
126
+ In consideration of the right to use this License's text and the "Business Source
127
+ License" name and trademark, Licensor covenants to MariaDB, and to all other
128
+ recipients of the licensed work to be provided by Licensor:
129
+
130
+ To specify as the Change License the GPL Version 2.0 or any later version, or a
131
+ license that is compatible with GPL Version 2.0 or a later version, where
132
+ "compatible" means that software provided under the Change License can be
133
+ included in a program with software provided under GPL Version 2.0 or a later
134
+ version. Licensor may specify additional Change Licenses without limitation.
135
+
136
+ To either: (a) specify an additional grant of rights to use that does not impose
137
+ any additional restriction on the right granted in this License, as the
138
+ Additional Use Grant; or (b) insert the text "None" to specify a Change Date. Not
139
+ to modify this License in any other way.
140
+
141
+ Notice
142
+
143
+ The Business Source License (this document, or the "License") is not an Open
144
+ Source license. However, the Licensed Work will eventually be made available
145
+ under an Open Source License, as stated in this License.
@@ -0,0 +1,11 @@
1
+ include README.md
2
+ include LICENSE
3
+ include CHANGELOG.md
4
+ include requirements.txt
5
+ include pyproject.toml
6
+ recursive-include citrate_sdk *.py *.pyi
7
+ recursive-include citrate_sdk py.typed
8
+ recursive-exclude * __pycache__
9
+ recursive-exclude * *.py[co]
10
+ recursive-exclude tests *
11
+ global-exclude .DS_Store
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: citrate-labs-sdk
3
+ Version: 0.6.0
4
+ Summary: Non-canonical Python SDK for the Citrate distributed AI network. The canonical SDK is citrate-js (TypeScript). This Python SDK is opt-in and may lag behind the canonical SDK.
5
+ Author-email: Citrate Team <developers@citrate.ai>
6
+ Maintainer-email: Citrate Team <developers@citrate.ai>
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://citrate.ai
9
+ Project-URL: Documentation, https://docs.citrate.ai
10
+ Project-URL: Repository, https://github.com/SaulBuilds/citrate
11
+ Project-URL: Bug Tracker, https://github.com/SaulBuilds/citrate/issues
12
+ Project-URL: Changelog, https://github.com/SaulBuilds/citrate/blob/main/CHANGELOG.md
13
+ Keywords: citrate,distributed-ai,ai,dag,web3,machine-learning
14
+ Classifier: Development Status :: 2 - Pre-Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: System :: Distributed Computing
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: requests~=2.33
29
+ Requires-Dist: cryptography~=46.0
30
+ Requires-Dist: eth-account~=0.9
31
+ Requires-Dist: web3~=7.15
32
+ Requires-Dist: numpy~=2.0
33
+ Requires-Dist: typing-extensions~=4.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
37
+ Requires-Dist: black>=23.0; extra == "dev"
38
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
39
+ Requires-Dist: mypy>=1.0; extra == "dev"
40
+ Requires-Dist: isort<7,>=5.13; extra == "dev"
41
+ Requires-Dist: coverage>=7.0; extra == "dev"
42
+ Provides-Extra: docs
43
+ Requires-Dist: sphinx>=8.1.3; extra == "docs"
44
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
45
+ Requires-Dist: myst-parser>=2.0; extra == "docs"
46
+ Requires-Dist: sphinx-autodoc-typehints>=1.20; extra == "docs"
47
+ Dynamic: license-file
48
+
49
+ ---
50
+ created: 2026-05-18T00:18:30Z
51
+ branch: main
52
+ author: monorepo-split
53
+ status: active
54
+ split-from-monorepo-at: b3ccd5c7
55
+ split-from-monorepo-tag: pre-split-v0.4.0
56
+ archived-monorepo: https://github.com/CitrateNetwork/citrate-monorepo-archive
57
+ agentile-archive: https://github.com/CitrateNetwork/citrate-agentile-archive
58
+ ---
59
+
60
+ # citrate-sdk-python
61
+
62
+ Python SDK for Citrate Network
63
+
64
+ ## Repository context
65
+
66
+ This repo was split from the **Citrate monorepo** on 2026-05-18. For the full history of decisions, sprints, audits, remediations, and ADRs that led to the split, see:
67
+
68
+ - **Monorepo archive**: https://github.com/CitrateNetwork/citrate-monorepo-archive — pre-split source + history (frozen)
69
+ - **Agentile archive**: https://github.com/CitrateNetwork/citrate-agentile-archive — methodology corpus (rules, planset, sprints, audits)
70
+
71
+ The source paths inside the pre-split monorepo were:
72
+
73
+ ```
74
+ --path citrate_v0.01.1/sdks/python/ --path-rename citrate_v0.01.1/sdks/python/:
75
+ ```
76
+
77
+ ## Releases
78
+
79
+ This repo versions **independently** from other CitrateNetwork repos. See GitHub Releases for tagged versions.
80
+
81
+ ## Contributing
82
+
83
+ This repo inherits the operating rules from `CitrateNetwork/citrate-agentile-archive/rules/CORE_RULES.md`. The Agentile framework's 13 non-negotiable rules apply uniformly across all CitrateNetwork repos.
84
+
85
+ ## License
86
+
87
+ Inherits from the monorepo. See [`LICENSE`](LICENSE) if present, or the [monorepo archive](https://github.com/CitrateNetwork/citrate-monorepo-archive/blob/main/LICENSE).
@@ -0,0 +1,39 @@
1
+ ---
2
+ created: 2026-05-18T00:18:30Z
3
+ branch: main
4
+ author: monorepo-split
5
+ status: active
6
+ split-from-monorepo-at: b3ccd5c7
7
+ split-from-monorepo-tag: pre-split-v0.4.0
8
+ archived-monorepo: https://github.com/CitrateNetwork/citrate-monorepo-archive
9
+ agentile-archive: https://github.com/CitrateNetwork/citrate-agentile-archive
10
+ ---
11
+
12
+ # citrate-sdk-python
13
+
14
+ Python SDK for Citrate Network
15
+
16
+ ## Repository context
17
+
18
+ This repo was split from the **Citrate monorepo** on 2026-05-18. For the full history of decisions, sprints, audits, remediations, and ADRs that led to the split, see:
19
+
20
+ - **Monorepo archive**: https://github.com/CitrateNetwork/citrate-monorepo-archive — pre-split source + history (frozen)
21
+ - **Agentile archive**: https://github.com/CitrateNetwork/citrate-agentile-archive — methodology corpus (rules, planset, sprints, audits)
22
+
23
+ The source paths inside the pre-split monorepo were:
24
+
25
+ ```
26
+ --path citrate_v0.01.1/sdks/python/ --path-rename citrate_v0.01.1/sdks/python/:
27
+ ```
28
+
29
+ ## Releases
30
+
31
+ This repo versions **independently** from other CitrateNetwork repos. See GitHub Releases for tagged versions.
32
+
33
+ ## Contributing
34
+
35
+ This repo inherits the operating rules from `CitrateNetwork/citrate-agentile-archive/rules/CORE_RULES.md`. The Agentile framework's 13 non-negotiable rules apply uniformly across all CitrateNetwork repos.
36
+
37
+ ## License
38
+
39
+ Inherits from the monorepo. See [`LICENSE`](LICENSE) if present, or the [monorepo archive](https://github.com/CitrateNetwork/citrate-monorepo-archive/blob/main/LICENSE).
@@ -0,0 +1,87 @@
1
+ Metadata-Version: 2.4
2
+ Name: citrate-labs-sdk
3
+ Version: 0.6.0
4
+ Summary: Non-canonical Python SDK for the Citrate distributed AI network. The canonical SDK is citrate-js (TypeScript). This Python SDK is opt-in and may lag behind the canonical SDK.
5
+ Author-email: Citrate Team <developers@citrate.ai>
6
+ Maintainer-email: Citrate Team <developers@citrate.ai>
7
+ License: Apache-2.0
8
+ Project-URL: Homepage, https://citrate.ai
9
+ Project-URL: Documentation, https://docs.citrate.ai
10
+ Project-URL: Repository, https://github.com/SaulBuilds/citrate
11
+ Project-URL: Bug Tracker, https://github.com/SaulBuilds/citrate/issues
12
+ Project-URL: Changelog, https://github.com/SaulBuilds/citrate/blob/main/CHANGELOG.md
13
+ Keywords: citrate,distributed-ai,ai,dag,web3,machine-learning
14
+ Classifier: Development Status :: 2 - Pre-Alpha
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: License :: OSI Approved :: Apache Software License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.10
20
+ Classifier: Programming Language :: Python :: 3.11
21
+ Classifier: Programming Language :: Python :: 3.12
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: System :: Distributed Computing
25
+ Requires-Python: >=3.10
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: requests~=2.33
29
+ Requires-Dist: cryptography~=46.0
30
+ Requires-Dist: eth-account~=0.9
31
+ Requires-Dist: web3~=7.15
32
+ Requires-Dist: numpy~=2.0
33
+ Requires-Dist: typing-extensions~=4.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=7.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
37
+ Requires-Dist: black>=23.0; extra == "dev"
38
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
39
+ Requires-Dist: mypy>=1.0; extra == "dev"
40
+ Requires-Dist: isort<7,>=5.13; extra == "dev"
41
+ Requires-Dist: coverage>=7.0; extra == "dev"
42
+ Provides-Extra: docs
43
+ Requires-Dist: sphinx>=8.1.3; extra == "docs"
44
+ Requires-Dist: sphinx-rtd-theme>=1.0; extra == "docs"
45
+ Requires-Dist: myst-parser>=2.0; extra == "docs"
46
+ Requires-Dist: sphinx-autodoc-typehints>=1.20; extra == "docs"
47
+ Dynamic: license-file
48
+
49
+ ---
50
+ created: 2026-05-18T00:18:30Z
51
+ branch: main
52
+ author: monorepo-split
53
+ status: active
54
+ split-from-monorepo-at: b3ccd5c7
55
+ split-from-monorepo-tag: pre-split-v0.4.0
56
+ archived-monorepo: https://github.com/CitrateNetwork/citrate-monorepo-archive
57
+ agentile-archive: https://github.com/CitrateNetwork/citrate-agentile-archive
58
+ ---
59
+
60
+ # citrate-sdk-python
61
+
62
+ Python SDK for Citrate Network
63
+
64
+ ## Repository context
65
+
66
+ This repo was split from the **Citrate monorepo** on 2026-05-18. For the full history of decisions, sprints, audits, remediations, and ADRs that led to the split, see:
67
+
68
+ - **Monorepo archive**: https://github.com/CitrateNetwork/citrate-monorepo-archive — pre-split source + history (frozen)
69
+ - **Agentile archive**: https://github.com/CitrateNetwork/citrate-agentile-archive — methodology corpus (rules, planset, sprints, audits)
70
+
71
+ The source paths inside the pre-split monorepo were:
72
+
73
+ ```
74
+ --path citrate_v0.01.1/sdks/python/ --path-rename citrate_v0.01.1/sdks/python/:
75
+ ```
76
+
77
+ ## Releases
78
+
79
+ This repo versions **independently** from other CitrateNetwork repos. See GitHub Releases for tagged versions.
80
+
81
+ ## Contributing
82
+
83
+ This repo inherits the operating rules from `CitrateNetwork/citrate-agentile-archive/rules/CORE_RULES.md`. The Agentile framework's 13 non-negotiable rules apply uniformly across all CitrateNetwork repos.
84
+
85
+ ## License
86
+
87
+ Inherits from the monorepo. See [`LICENSE`](LICENSE) if present, or the [monorepo archive](https://github.com/CitrateNetwork/citrate-monorepo-archive/blob/main/LICENSE).
@@ -0,0 +1,44 @@
1
+ CHANGELOG.md
2
+ LICENSE
3
+ MANIFEST.in
4
+ README.md
5
+ pyproject.toml
6
+ citrate_labs_sdk.egg-info/PKG-INFO
7
+ citrate_labs_sdk.egg-info/SOURCES.txt
8
+ citrate_labs_sdk.egg-info/dependency_links.txt
9
+ citrate_labs_sdk.egg-info/entry_points.txt
10
+ citrate_labs_sdk.egg-info/requires.txt
11
+ citrate_labs_sdk.egg-info/top_level.txt
12
+ citrate_sdk/__init__.py
13
+ citrate_sdk/_url_security.py
14
+ citrate_sdk/abi.py
15
+ citrate_sdk/cli.py
16
+ citrate_sdk/client.py
17
+ citrate_sdk/compute.py
18
+ citrate_sdk/crypto.py
19
+ citrate_sdk/ecdh_real.py
20
+ citrate_sdk/entitlements.py
21
+ citrate_sdk/errors.py
22
+ citrate_sdk/farming.py
23
+ citrate_sdk/finite_field.py
24
+ citrate_sdk/gateway.py
25
+ citrate_sdk/ipfs.py
26
+ citrate_sdk/learning.py
27
+ citrate_sdk/models.py
28
+ citrate_sdk/py.typed
29
+ citrate_sdk/treasury.py
30
+ citrate_sdk/types.py
31
+ citrate_sdk/_generated/__init__.py
32
+ citrate_sdk/_generated/contract.py
33
+ citrate_sdk/_generated/federation_contract.json
34
+ citrate_sdk/economics/__init__.py
35
+ citrate_sdk/economics/agents.py
36
+ citrate_sdk/economics/charts.py
37
+ citrate_sdk/economics/parameters.py
38
+ citrate_sdk/economics/simulation.py
39
+ citrate_sdk/edu/__init__.py
40
+ citrate_sdk/identity/__init__.py
41
+ citrate_sdk/identity/client.py
42
+ citrate_sdk/identity/jwt.py
43
+ citrate_sdk/identity/pkce.py
44
+ citrate_sdk/identity/wallet.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ citrate = citrate_sdk.cli:main
@@ -0,0 +1,21 @@
1
+ requests~=2.33
2
+ cryptography~=46.0
3
+ eth-account~=0.9
4
+ web3~=7.15
5
+ numpy~=2.0
6
+ typing-extensions~=4.0
7
+
8
+ [dev]
9
+ pytest>=7.0
10
+ pytest-asyncio>=0.21
11
+ black>=23.0
12
+ ruff>=0.1.0
13
+ mypy>=1.0
14
+ isort<7,>=5.13
15
+ coverage>=7.0
16
+
17
+ [docs]
18
+ sphinx>=8.1.3
19
+ sphinx-rtd-theme>=1.0
20
+ myst-parser>=2.0
21
+ sphinx-autodoc-typehints>=1.20
@@ -0,0 +1,81 @@
1
+ """
2
+ Citrate Python SDK
3
+
4
+ A comprehensive Python SDK for interacting with the Citrate AI blockchain platform.
5
+ Provides easy-to-use interfaces for model deployment, inference execution,
6
+ encryption, access control, payment systems, learning pools, liquid staking,
7
+ classrooms, compute marketplace, treasury, and farming operations.
8
+ """
9
+
10
+ from .client import CitrateClient
11
+ from .models import ModelConfig, ModelDeployment, InferenceRequest, InferenceResult, ModelType, AccessType
12
+ from .crypto import EncryptionConfig, KeyManager
13
+ from .errors import CitrateError, ModelNotFoundError, InsufficientFundsError
14
+
15
+ # LC.5.3: Learning / Staking / Classroom managers
16
+ from .learning import LearningManager, StakingManager, ClassroomManager
17
+
18
+ # COMPUTE-4: Compute marketplace manager
19
+ from .compute import ComputeManager
20
+
21
+ # ECON-2: Treasury and farming managers
22
+ from .treasury import TreasuryManager
23
+ from .farming import FarmingManager
24
+
25
+ # Shared data types for learning / staking / classroom / compute
26
+ from .types import (
27
+ LearningPool,
28
+ CycleStatus,
29
+ Contributions,
30
+ ContributionDetail,
31
+ StakingInfo,
32
+ PendingWithdrawal,
33
+ ClassroomInfo,
34
+ ComputeJob,
35
+ ProviderInfo,
36
+ ComputePool,
37
+ Dispute,
38
+ )
39
+
40
+ __version__ = "0.5.0"
41
+ __author__ = "Citrate Team"
42
+
43
+ __all__ = [
44
+ # Core client
45
+ "CitrateClient",
46
+ # Model types
47
+ "ModelConfig",
48
+ "ModelDeployment",
49
+ "InferenceRequest",
50
+ "InferenceResult",
51
+ "ModelType",
52
+ "AccessType",
53
+ # Crypto
54
+ "EncryptionConfig",
55
+ "KeyManager",
56
+ # Errors
57
+ "CitrateError",
58
+ "ModelNotFoundError",
59
+ "InsufficientFundsError",
60
+ # LC.5.3: Learning managers
61
+ "LearningManager",
62
+ "StakingManager",
63
+ "ClassroomManager",
64
+ # COMPUTE-4: Compute manager
65
+ "ComputeManager",
66
+ # ECON-2: Treasury and farming managers
67
+ "TreasuryManager",
68
+ "FarmingManager",
69
+ # Data types
70
+ "LearningPool",
71
+ "CycleStatus",
72
+ "Contributions",
73
+ "ContributionDetail",
74
+ "StakingInfo",
75
+ "PendingWithdrawal",
76
+ "ClassroomInfo",
77
+ "ComputeJob",
78
+ "ProviderInfo",
79
+ "ComputePool",
80
+ "Dispute",
81
+ ]
@@ -0,0 +1,68 @@
1
+ """Typed accessor over the vendored federation contract artifact (DEVX-S0, ADR-0001).
2
+
3
+ The single source of truth for chain addresses, chainId, endpoints, and the
4
+ entitlement tier vocabulary. Do NOT hand-edit ``federation_contract.json`` — it is
5
+ synced from ``citrate-federation/contract/federation-contract.json`` via
6
+ ``python scripts/sync_contract.py``, which is generated from
7
+ ``citrate-chain/contracts/addresses/40204.json`` + ``citrate-identity``.
8
+ """
9
+ from __future__ import annotations
10
+
11
+ import json
12
+ from functools import lru_cache
13
+ from pathlib import Path
14
+ from typing import Any, Dict, List
15
+
16
+ _ARTIFACT = Path(__file__).with_name("federation_contract.json")
17
+
18
+
19
+ @lru_cache(maxsize=1)
20
+ def federation_contract() -> Dict[str, Any]:
21
+ """Return the full contract artifact as a dict."""
22
+ return json.loads(_ARTIFACT.read_text(encoding="utf-8"))
23
+
24
+
25
+ def chain_id() -> int:
26
+ return int(federation_contract()["chain"]["chainId"])
27
+
28
+
29
+ def rpc_url() -> str:
30
+ return str(federation_contract()["chain"]["rpcUrl"])
31
+
32
+
33
+ def ws_url() -> str:
34
+ return str(federation_contract()["chain"]["wsUrl"])
35
+
36
+
37
+ def aa_stack() -> Dict[str, str]:
38
+ """ERC-4337 account-abstraction stack addresses (EntryPoint, factory, paymaster, …)."""
39
+ return dict(federation_contract()["aaStack"])
40
+
41
+
42
+ def contracts() -> Dict[str, str]:
43
+ return dict(federation_contract()["contracts"])
44
+
45
+
46
+ def membership() -> Dict[str, Any]:
47
+ return dict(federation_contract()["membership"])
48
+
49
+
50
+ def precompiles() -> Dict[str, str]:
51
+ return dict(federation_contract()["precompiles"])
52
+
53
+
54
+ def identity() -> Dict[str, Any]:
55
+ """OIDC issuer/discovery/jwks/scopes + the entitlement claim URI."""
56
+ return dict(federation_contract()["identity"])
57
+
58
+
59
+ def gateway() -> Dict[str, str]:
60
+ return dict(federation_contract()["gateway"])
61
+
62
+
63
+ def entitlement_tiers() -> List[str]:
64
+ return list(federation_contract()["entitlements"]["tiers"])
65
+
66
+
67
+ def kyc_baseline_tier() -> str:
68
+ return str(federation_contract()["entitlements"]["kycBaselineTier"])