Skip to content

Commit 17d65f9

Browse files
committed
fix(general): remove unused deps, cleanup schemas
1 parent 38f0a00 commit 17d65f9

File tree

5 files changed

+151
-145
lines changed

5 files changed

+151
-145
lines changed

CONTRIBUTING.md

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,23 @@ We strive for high-quality, maintainable code. Please adhere to the following pr
2020
- Use descriptive names for variables, functions, and classes.
2121
- Keep code focused and avoid unnecessary complexity.
2222

23-
2. **Strict Type Safety:**
23+
2. **Formatting, Linting & Type-Checking:**
2424

25-
- This project uses **strict type hinting**, enforced by **`pyright`**.
26-
- **All new code MUST include accurate type hints.**
25+
- Use [ruff](https://docs.astral.sh/ruff/) for formatting and linting, both settings are defined in `pyproject.toml`.
26+
- Use [pyright](https://github.com/microsoft/pyright) for type checking, all new code MUST include accurate type hints.
2727
- Avoid using `typing.Any` unless absolutely necessary and clearly justified in comments.
28-
- Ensure your code passes `pyright` checks without errors. (`uv run pyright`).
29-
30-
3. **Linting & Formatting:**
31-
- We use **`ruff`** for comprehensive linting and code formatting.
32-
- Your code must be free of `ruff` linting errors and warnings.
33-
- Run the linter and formatter before committing:
28+
- You can also install [Pylance](https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-pylance) into VSCode for an easier experience.
29+
- Ensure your code passes all checks locally without errors:
3430
```bash
35-
uv run lint
36-
uv run format
31+
uv run ruff format
32+
uv run ruff check --fix
33+
uv run pyright
3734
```
3835

36+
3. **Use dependencies sparingly:**
37+
- Every dependency added is a potential security risk.
38+
- If the dependency is required, it should live in under `[project.optional-dependencies]` with a key marking the high level function, e.g. `rag`, `consensus`.
39+
3940
## 🧪 Test Extensively
4041

4142
- New features **must** include appropriate unit and/or integration tests using `pytest`.

pyproject.toml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ license-files = ["LICENSE"]
88
authors = [
99
{ name = "Dinesh Pinto", email = "annual.fallout_0z@icloud.com" }
1010
]
11-
keywords = ["flare", "blockchain", "ai", "agent", "sdk", "confidential computing"]
11+
keywords = ["flare", "confidential-space", "blockchain", "ai", "agent", "sdk", "confidential computing"]
1212
classifiers = [
1313
"Development Status :: 3 - Alpha",
1414
"Intended Audience :: Developers",
@@ -19,20 +19,17 @@ classifiers = [
1919
"Programming Language :: Python :: 3.13",
2020
"Programming Language :: Python :: 3 :: Only",
2121
"Topic :: Software Development :: Libraries :: Python Modules",
22+
"Typing :: Typed"
2223
]
2324
requires-python = ">=3.12"
2425
dependencies = [
25-
"aiohttp>=3.11.14",
2626
"google-genai>=1.8.0",
2727
"httpx>=0.28.1",
2828
"pydantic>=2.11.1",
2929
"pydantic-ai>=0.0.46",
3030
"structlog>=25.2.0",
3131
"tenacity>=8.2.3,<9.0.0",
32-
"web3>=7.10.0",
33-
"pillow>=11.3.0",
34-
"pymupdf>=1.26.1",
35-
"pytesseract>=0.3.13",
32+
"web3>=7.10.0"
3633
]
3734

3835
[project.urls]
@@ -47,25 +44,28 @@ flare-ai-kit = "flare_ai_kit.main:start"
4744
[project.optional-dependencies]
4845
rag = [
4946
"qdrant-client>=1.13.3",
50-
"dulwich>=0.23.2",
47+
"dulwich>=0.23.2"
5148
]
5249
social = [
5350
"python-telegram-bot>=22.0",
5451
"tweepy>=4.15.0",
5552
"async_lru>=2.0.5",
5653
"slack-sdk>=3.26.2",
57-
"discord.py >=2.3.2",
58-
"httpx >=0.27.0"
54+
"discord.py>=2.3.2"
5955
]
6056
tee = [
6157
"cryptography>=44.0.2",
6258
"pyjwt>=2.10.1",
63-
"pyopenssl>=25.0.0",
64-
"python-dotenv >=1.0.1"
59+
"pyopenssl>=25.0.0"
6560
]
6661
a2a = [
6762
"fastapi[standard]>=0.116.1",
6863
]
64+
ingestion = [
65+
"pillow>=11.3.0",
66+
"pymupdf>=1.26.1",
67+
"pytesseract>=0.3.13"
68+
]
6969

7070
[build-system]
7171
requires = ["hatchling"]

src/flare_ai_kit/common/schemas.py

Lines changed: 81 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
from dataclasses import dataclass
44
from enum import Enum
5-
from typing import Literal, override
5+
from typing import Any, Literal, override
6+
7+
from pydantic import BaseModel
68

79

810
# --- Schemas for Text Chunking and Embeddings ---
@@ -182,4 +184,82 @@ class RedemptionRequest:
182184
recipient_underlying_address: str
183185

184186

187+
# --- Agents ---
188+
185189
AgentRole = Literal["user", "system", "assistant", "summarizer", "critic", "filter"]
190+
191+
# --- DA Layer ---
192+
# This uses Pydantic for stricter validation.
193+
194+
195+
class AttestationRequest(BaseModel):
196+
"""Represents an attestation request structure."""
197+
198+
attestation_type: str
199+
source_id: str
200+
message_integrity_code: str
201+
request_body: dict[str, Any]
202+
203+
204+
class AttestationResponse(BaseModel):
205+
"""Represents an attestation response structure."""
206+
207+
attestation_type: str
208+
source_id: str
209+
voting_round: int
210+
lowest_used_timestamp: int
211+
request_body: dict[str, Any]
212+
response_body: dict[str, Any]
213+
214+
215+
class MerkleProof(BaseModel):
216+
"""Represents a Merkle proof for attestation verification."""
217+
218+
merkle_proof: list[str]
219+
leaf_index: int
220+
total_leaves: int
221+
222+
223+
class AttestationData(BaseModel):
224+
"""Complete attestation data including response and proof."""
225+
226+
response: AttestationResponse
227+
proof: MerkleProof
228+
229+
230+
class VotingRoundData(BaseModel):
231+
"""Data for a specific voting round."""
232+
233+
voting_round: int
234+
merkle_root: str
235+
timestamp: int
236+
total_attestations: int
237+
finalized: bool
238+
239+
240+
class FTSOAnchorFeed(BaseModel):
241+
"""FTSO anchor feed data structure."""
242+
243+
id: str
244+
name: str
245+
decimals: int
246+
category: str
247+
description: str
248+
249+
250+
class FTSOAnchorFeedValue(BaseModel):
251+
"""FTSO anchor feed value with proof."""
252+
253+
id: str
254+
value: int
255+
timestamp: int
256+
decimals: int
257+
proof: MerkleProof
258+
259+
260+
class FTSOAnchorFeedsWithProof(BaseModel):
261+
"""FTSO anchor feeds with proof for a specific voting round."""
262+
263+
voting_round: int
264+
merkle_root: str
265+
feeds: list[FTSOAnchorFeedValue]

0 commit comments

Comments
 (0)