Skip to content

Commit 66f4dcd

Browse files
committed
refactor: remove plugin, compact llms-full.txt
- Remove python-binance-plugin/ directory - Switch llms-full.txt to compact format: one heading + description + params per method, no response examples (360KB -> 198KB) - Drop RST-to-Markdown conversion code (no longer needed) - Truncate long param descriptions to 80 chars
1 parent 21fca30 commit 66f4dcd

7 files changed

Lines changed: 2994 additions & 13252 deletions

File tree

.agents/skills/python-binance/SKILL.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description: >
88

99
# python-binance SDK
1010

11-
Unofficial Python SDK for the Binance cryptocurrency exchange. 798+ methods covering Spot, Margin, Futures, Options, Portfolio Margin, and WebSocket APIs.
11+
Unofficial Python SDK for the Binance cryptocurrency exchange. 797+ methods covering Spot, Margin, Futures, Options, Portfolio Margin, and WebSocket APIs.
1212

1313
## Setup
1414

@@ -190,6 +190,6 @@ except BinanceAPIException as e:
190190

191191
## Full Reference
192192

193-
For the complete method reference with all 798+ methods, signatures, and parameters, see:
193+
For the complete method reference with all 797+ methods, signatures, and parameters, see:
194194
- `llms-full.txt` in the repository root
195195
- `Endpoints.md` for endpoint-to-method mapping

.agents/skills/python-binance/references/REFERENCE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This reference points to the comprehensive auto-generated method documentation.
44

55
## Primary Reference
66

7-
The full method reference with all 798+ methods, their signatures, parameters, and response examples is available at:
7+
The full method reference with all 797+ methods, their signatures and parameters is available at:
88

99
**[llms-full.txt](../../../../llms-full.txt)**
1010

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ LLM & AI Agent Support
316316
This library includes resources to help AI coding assistants (Claude Code, Cursor, Copilot, etc.):
317317

318318
- ``llms.txt`` — Concise library overview for LLMs (`llmstxt.org <https://llmstxt.org>`_ standard)
319-
- ``llms-full.txt`` — Complete API reference for LLMs (all 798+ methods with signatures and parameters)
319+
- ``llms-full.txt`` — Complete API reference for LLMs (all 797+ methods with signatures and parameters)
320320
- ``.agents/skills/python-binance/`` — Agent Skill (works with any `Agent Skills <https://agentskills.io>`_ compatible tool)
321321
- ``generate_llms_txt.py`` — Script to regenerate the LLM files after library updates
322322

generate_llms_txt.py

Lines changed: 19 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
77
Outputs:
88
llms.txt - Concise LLM overview (~4-6KB)
9-
llms-full.txt - Comprehensive method reference (~200-300KB)
9+
llms-full.txt - Compact method reference
1010
"""
1111

1212
import inspect
@@ -84,7 +84,6 @@ def extract_docstring_info(method):
8484
# First non-empty line(s) before :param or https:// is the description
8585
desc_lines = []
8686
param_lines = []
87-
rest_lines = []
8887
in_params = False
8988
in_rest = False
9089

@@ -102,7 +101,7 @@ def extract_docstring_info(method):
102101
in_rest = True
103102

104103
if in_rest:
105-
rest_lines.append(line)
104+
continue
106105
elif in_params:
107106
param_lines.append(line)
108107
elif stripped.startswith("https://"):
@@ -129,47 +128,7 @@ def extract_docstring_info(method):
129128
# Continuation line for multi-line param descriptions
130129
current_param["desc"] += " " + stripped
131130

132-
# Extract response example from rest, converting RST to Markdown
133-
response_text = "\n".join(rest_lines)
134-
# Convert RST code blocks to Markdown fences
135-
response_text = re.sub(
136-
r"\.\. code-block:: (\w+)",
137-
r"```\1",
138-
response_text,
139-
)
140-
# Add closing fences: a code block ends when indentation returns to base level
141-
# after a ```lang line
142-
result_lines = []
143-
in_code_block = False
144-
for line in response_text.split("\n"):
145-
stripped = line.strip()
146-
if stripped.startswith("```") and not stripped == "```":
147-
in_code_block = True
148-
result_lines.append(stripped)
149-
elif in_code_block:
150-
if stripped == "" and result_lines and result_lines[-1] == "":
151-
# Skip double blank lines inside code blocks
152-
continue
153-
# RST code blocks are indented; unindented non-empty line ends the block
154-
if stripped and not line.startswith(" ") and not line.startswith("\t"):
155-
result_lines.append("```")
156-
result_lines.append("")
157-
in_code_block = False
158-
result_lines.append(line)
159-
else:
160-
# Remove one level of RST indentation (4 spaces), preserve inner indentation
161-
if line.startswith(" "):
162-
line = line[4:]
163-
result_lines.append(line)
164-
else:
165-
result_lines.append(line)
166-
if in_code_block:
167-
result_lines.append("```")
168-
response_text = "\n".join(result_lines)
169-
# Convert RST field markup to plain text
170-
response_text = re.sub(r":returns:\s*", "**Returns:** ", response_text)
171-
172-
return description, params, response_text
131+
return description, params, ""
173132

174133

175134
def generate_llms_txt(methods_by_category, total_count):
@@ -426,7 +385,11 @@ async def main():
426385

427386

428387
def generate_llms_full_txt(methods_by_category, total_count):
429-
"""Generate the comprehensive llms-full.txt content."""
388+
"""Generate a compact llms-full.txt method reference.
389+
390+
Uses a dense format: one heading + description + param list per method,
391+
no response examples. Keeps the file small enough to fit in LLM context.
392+
"""
430393
lines = []
431394
lines.append("# python-binance — Full Method Reference")
432395
lines.append("")
@@ -445,51 +408,30 @@ def generate_llms_full_txt(methods_by_category, total_count):
445408
lines.append(f"- [{cat}](#{anchor}) ({count} methods)")
446409
lines.append("")
447410

448-
# Method details by category
411+
# Method details by category — compact format
449412
for cat in sorted(methods_by_category.keys()):
450413
lines.append(f"## {cat}")
451414
lines.append("")
452415

453416
for name, method in methods_by_category[cat]:
454417
sig_str = get_signature_str(method)
455-
description, params, response_text = extract_docstring_info(method)
418+
description, params, _ = extract_docstring_info(method)
456419

420+
# Method heading with signature
457421
lines.append(f"### `client.{name}({sig_str})`")
458-
lines.append("")
459422
if description:
460-
lines.append(description)
461-
lines.append("")
423+
lines.append(f"> {description}")
462424

463425
if params:
464-
lines.append("**Parameters:**")
465426
for p in params:
466-
type_str = f" ({p['type']})" if p["type"] else ""
467-
desc_str = f" — {p['desc']}" if p["desc"] else ""
427+
type_str = f": {p['type']}" if p["type"] else ""
428+
# Truncate long descriptions to keep file compact
429+
desc = p["desc"]
430+
if len(desc) > 80:
431+
desc = desc[:77] + "..."
432+
desc_str = f" — {desc}" if desc else ""
468433
lines.append(f"- `{p['name']}`{type_str}{desc_str}")
469-
lines.append("")
470-
471-
# Include response examples if present (trimmed)
472-
if response_text.strip():
473-
# Extract just the returns and response example, skip raises
474-
resp_lines = response_text.strip().split("\n")
475-
filtered = []
476-
skip = False
477-
for rl in resp_lines:
478-
if rl.strip().startswith(":raises:"):
479-
skip = True
480-
continue
481-
if not skip:
482-
filtered.append(rl)
483-
if skip and rl.strip() and not rl.strip().startswith(":"):
484-
skip = False
485-
filtered.append(rl)
486-
487-
resp_text = "\n".join(filtered).strip()
488-
if resp_text:
489-
lines.append(resp_text)
490-
lines.append("")
491-
492-
lines.append("---")
434+
493435
lines.append("")
494436

495437
return "\n".join(lines)

0 commit comments

Comments
 (0)