bale-xyz 1.0.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.
- bale_xyz-1.0.0/.github/ISSUE_TEMPLATE/bug_report.md +23 -0
- bale_xyz-1.0.0/.github/pull_request_template.md +9 -0
- bale_xyz-1.0.0/.github/workflows/ci.yml +91 -0
- bale_xyz-1.0.0/.github/workflows/pages.yml +43 -0
- bale_xyz-1.0.0/CHANGELOG.md +113 -0
- bale_xyz-1.0.0/CONTRIBUTING.md +92 -0
- bale_xyz-1.0.0/LICENSE +31 -0
- bale_xyz-1.0.0/MANIFEST.in +17 -0
- bale_xyz-1.0.0/PKG-INFO +471 -0
- bale_xyz-1.0.0/README.md +424 -0
- bale_xyz-1.0.0/docs/api-client.html +259 -0
- bale_xyz-1.0.0/docs/api-protocol.html +230 -0
- bale_xyz-1.0.0/docs/api-types.html +223 -0
- bale_xyz-1.0.0/docs/assets/app.js +336 -0
- bale_xyz-1.0.0/docs/assets/search-index.json +1 -0
- bale_xyz-1.0.0/docs/assets/style.css +618 -0
- bale_xyz-1.0.0/docs/auth.html +294 -0
- bale_xyz-1.0.0/docs/bots.html +201 -0
- bale_xyz-1.0.0/docs/chats.html +202 -0
- bale_xyz-1.0.0/docs/cli.html +161 -0
- bale_xyz-1.0.0/docs/conferences.html +285 -0
- bale_xyz-1.0.0/docs/contributing.html +186 -0
- bale_xyz-1.0.0/docs/enums.html +186 -0
- bale_xyz-1.0.0/docs/events.html +260 -0
- bale_xyz-1.0.0/docs/fa/api-client.html +258 -0
- bale_xyz-1.0.0/docs/fa/api-protocol.html +233 -0
- bale_xyz-1.0.0/docs/fa/api-types.html +223 -0
- bale_xyz-1.0.0/docs/fa/assets/app.js +336 -0
- bale_xyz-1.0.0/docs/fa/assets/search-index.json +1 -0
- bale_xyz-1.0.0/docs/fa/assets/style.css +618 -0
- bale_xyz-1.0.0/docs/fa/auth.html +294 -0
- bale_xyz-1.0.0/docs/fa/bots.html +201 -0
- bale_xyz-1.0.0/docs/fa/chats.html +200 -0
- bale_xyz-1.0.0/docs/fa/cli.html +161 -0
- bale_xyz-1.0.0/docs/fa/conferences.html +287 -0
- bale_xyz-1.0.0/docs/fa/contributing.html +186 -0
- bale_xyz-1.0.0/docs/fa/enums.html +186 -0
- bale_xyz-1.0.0/docs/fa/events.html +260 -0
- bale_xyz-1.0.0/docs/fa/fsm.html +206 -0
- bale_xyz-1.0.0/docs/fa/har-verification.html +200 -0
- bale_xyz-1.0.0/docs/fa/index.html +210 -0
- bale_xyz-1.0.0/docs/fa/install.html +225 -0
- bale_xyz-1.0.0/docs/fa/limitations.html +203 -0
- bale_xyz-1.0.0/docs/fa/messaging.html +346 -0
- bale_xyz-1.0.0/docs/fa/protocol.html +245 -0
- bale_xyz-1.0.0/docs/fa/quickstart.html +218 -0
- bale_xyz-1.0.0/docs/fa/raw-rpc.html +219 -0
- bale_xyz-1.0.0/docs/fsm.html +207 -0
- bale_xyz-1.0.0/docs/har-verification.html +200 -0
- bale_xyz-1.0.0/docs/index.html +210 -0
- bale_xyz-1.0.0/docs/install.html +225 -0
- bale_xyz-1.0.0/docs/limitations.html +203 -0
- bale_xyz-1.0.0/docs/messaging.html +345 -0
- bale_xyz-1.0.0/docs/protocol.html +245 -0
- bale_xyz-1.0.0/docs/quickstart.html +217 -0
- bale_xyz-1.0.0/docs/raw-rpc.html +218 -0
- bale_xyz-1.0.0/examples/conference.py +37 -0
- bale_xyz-1.0.0/examples/meet.py +95 -0
- bale_xyz-1.0.0/pyproject.toml +108 -0
- bale_xyz-1.0.0/scripts/build_docs.py +515 -0
- bale_xyz-1.0.0/scripts/build_protocol_index.py +138 -0
- bale_xyz-1.0.0/scripts/check_docs.py +175 -0
- bale_xyz-1.0.0/scripts/docs_pages.py +265 -0
- bale_xyz-1.0.0/scripts/docs_pages_a.py +846 -0
- bale_xyz-1.0.0/scripts/docs_pages_b.py +820 -0
- bale_xyz-1.0.0/scripts/docs_pages_c.py +1061 -0
- bale_xyz-1.0.0/scripts/docs_pages_fa.py +2747 -0
- bale_xyz-1.0.0/setup.cfg +4 -0
- bale_xyz-1.0.0/src/bale_xyz.egg-info/PKG-INFO +471 -0
- bale_xyz-1.0.0/src/bale_xyz.egg-info/SOURCES.txt +124 -0
- bale_xyz-1.0.0/src/bale_xyz.egg-info/dependency_links.txt +1 -0
- bale_xyz-1.0.0/src/bale_xyz.egg-info/entry_points.txt +2 -0
- bale_xyz-1.0.0/src/bale_xyz.egg-info/not-zip-safe +1 -0
- bale_xyz-1.0.0/src/bale_xyz.egg-info/requires.txt +20 -0
- bale_xyz-1.0.0/src/bale_xyz.egg-info/top_level.txt +1 -0
- bale_xyz-1.0.0/src/balexyz/__init__.py +85 -0
- bale_xyz-1.0.0/src/balexyz/__main__.py +130 -0
- bale_xyz-1.0.0/src/balexyz/botapi.py +217 -0
- bale_xyz-1.0.0/src/balexyz/client.py +1563 -0
- bale_xyz-1.0.0/src/balexyz/dispatcher.py +143 -0
- bale_xyz-1.0.0/src/balexyz/dynamic.py +601 -0
- bale_xyz-1.0.0/src/balexyz/enums.py +135 -0
- bale_xyz-1.0.0/src/balexyz/errors.py +78 -0
- bale_xyz-1.0.0/src/balexyz/events.py +407 -0
- bale_xyz-1.0.0/src/balexyz/filters.py +393 -0
- bale_xyz-1.0.0/src/balexyz/formatting.py +60 -0
- bale_xyz-1.0.0/src/balexyz/fsm.py +131 -0
- bale_xyz-1.0.0/src/balexyz/helpers.py +161 -0
- bale_xyz-1.0.0/src/balexyz/keyboards.py +149 -0
- bale_xyz-1.0.0/src/balexyz/models.py +380 -0
- bale_xyz-1.0.0/src/balexyz/peers.py +130 -0
- bale_xyz-1.0.0/src/balexyz/proto/__init__.py +37 -0
- bale_xyz-1.0.0/src/balexyz/proto/codec.py +103 -0
- bale_xyz-1.0.0/src/balexyz/proto/index.json +1 -0
- bale_xyz-1.0.0/src/balexyz/proto/protocol.json +104886 -0
- bale_xyz-1.0.0/src/balexyz/proto/py.typed +0 -0
- bale_xyz-1.0.0/src/balexyz/proto/recovered_pb2.py +570 -0
- bale_xyz-1.0.0/src/balexyz/proto/request_pb2.py +1535 -0
- bale_xyz-1.0.0/src/balexyz/proto/response_pb2.py +1176 -0
- bale_xyz-1.0.0/src/balexyz/proto/struct_pb2.py +1850 -0
- bale_xyz-1.0.0/src/balexyz/py.typed +0 -0
- bale_xyz-1.0.0/src/balexyz/rpc.py +107 -0
- bale_xyz-1.0.0/src/balexyz/rtc.py +318 -0
- bale_xyz-1.0.0/src/balexyz/session.py +448 -0
- bale_xyz-1.0.0/src/balexyz/transports/__init__.py +7 -0
- bale_xyz-1.0.0/src/balexyz/transports/base.py +34 -0
- bale_xyz-1.0.0/src/balexyz/transports/grpc.py +329 -0
- bale_xyz-1.0.0/src/balexyz/transports/websocket.py +332 -0
- bale_xyz-1.0.0/src/balexyz/types/__init__.py +117 -0
- bale_xyz-1.0.0/src/balexyz/types/base.py +79 -0
- bale_xyz-1.0.0/src/balexyz/types/chat.py +164 -0
- bale_xyz-1.0.0/src/balexyz/types/dialog.py +71 -0
- bale_xyz-1.0.0/src/balexyz/types/entities.py +38 -0
- bale_xyz-1.0.0/src/balexyz/types/events.py +303 -0
- bale_xyz-1.0.0/src/balexyz/types/keyboard.py +17 -0
- bale_xyz-1.0.0/src/balexyz/types/media.py +183 -0
- bale_xyz-1.0.0/src/balexyz/types/message.py +618 -0
- bale_xyz-1.0.0/src/balexyz/types/permissions.py +64 -0
- bale_xyz-1.0.0/src/balexyz/types/user.py +110 -0
- bale_xyz-1.0.0/src/balexyz/types/wallet.py +75 -0
- bale_xyz-1.0.0/tests/data/meet_har.json +50 -0
- bale_xyz-1.0.0/tests/test_client.py +192 -0
- bale_xyz-1.0.0/tests/test_core.py +118 -0
- bale_xyz-1.0.0/tests/test_dynamic.py +128 -0
- bale_xyz-1.0.0/tests/test_media.py +222 -0
- bale_xyz-1.0.0/tests/test_meet_capture.py +326 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug report
|
|
3
|
+
about: Something in bale xyz does not work as documented
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
**What I did**
|
|
8
|
+
<!-- the code you ran -->
|
|
9
|
+
|
|
10
|
+
**What I expected**
|
|
11
|
+
|
|
12
|
+
**What happened**
|
|
13
|
+
|
|
14
|
+
**Environment**
|
|
15
|
+
- bale xyz version:
|
|
16
|
+
- Python version:
|
|
17
|
+
- Connection type: user session / bot token
|
|
18
|
+
- OS:
|
|
19
|
+
|
|
20
|
+
**Sanity check**
|
|
21
|
+
<!-- please paste the output of: bale-xyz info -->
|
|
22
|
+
```
|
|
23
|
+
```
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
test:
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
python: ["3.10", "3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
|
|
21
|
+
- uses: actions/setup-python@v5
|
|
22
|
+
with:
|
|
23
|
+
python-version: ${{ matrix.python }}
|
|
24
|
+
|
|
25
|
+
- name: Install
|
|
26
|
+
run: |
|
|
27
|
+
python -m pip install --upgrade pip
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
|
|
30
|
+
- name: Test
|
|
31
|
+
run: python -m pytest tests/ -q
|
|
32
|
+
|
|
33
|
+
- name: Protocol index sanity
|
|
34
|
+
run: |
|
|
35
|
+
python -m balexyz info
|
|
36
|
+
python -m balexyz methods -s bale.meet.v1.Meet
|
|
37
|
+
|
|
38
|
+
build:
|
|
39
|
+
needs: test
|
|
40
|
+
runs-on: ubuntu-latest
|
|
41
|
+
steps:
|
|
42
|
+
- uses: actions/checkout@v4
|
|
43
|
+
- uses: actions/setup-python@v5
|
|
44
|
+
with:
|
|
45
|
+
python-version: "3.12"
|
|
46
|
+
- name: Build distributions
|
|
47
|
+
run: |
|
|
48
|
+
pip install build
|
|
49
|
+
python -m build
|
|
50
|
+
- name: Check the wheel installs cleanly
|
|
51
|
+
run: |
|
|
52
|
+
pip install dist/*.whl
|
|
53
|
+
python -c "import balexyz; print(balexyz.__version__, len(balexyz.dynamic.INDEX.all_methods()))"
|
|
54
|
+
- uses: actions/upload-artifact@v4
|
|
55
|
+
with:
|
|
56
|
+
name: dist
|
|
57
|
+
path: dist/
|
|
58
|
+
|
|
59
|
+
docs:
|
|
60
|
+
runs-on: ubuntu-latest
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
- uses: actions/setup-python@v5
|
|
64
|
+
with:
|
|
65
|
+
python-version: "3.12"
|
|
66
|
+
- name: Verify the docs match the code
|
|
67
|
+
run: |
|
|
68
|
+
pip install -e ".[dev]"
|
|
69
|
+
python scripts/check_docs.py
|
|
70
|
+
- uses: actions/upload-artifact@v4
|
|
71
|
+
with:
|
|
72
|
+
name: docs
|
|
73
|
+
path: docs/
|
|
74
|
+
|
|
75
|
+
publish:
|
|
76
|
+
needs: [build, docs]
|
|
77
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
78
|
+
runs-on: ubuntu-latest
|
|
79
|
+
permissions:
|
|
80
|
+
id-token: write
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v4
|
|
83
|
+
- uses: actions/setup-python@v5
|
|
84
|
+
with:
|
|
85
|
+
python-version: "3.12"
|
|
86
|
+
- name: Build
|
|
87
|
+
run: |
|
|
88
|
+
pip install build
|
|
89
|
+
python -m build
|
|
90
|
+
- name: Publish to PyPI
|
|
91
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
name: Deploy documentation
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
paths: ["docs/**", "scripts/build_docs.py", "scripts/docs_pages*.py"]
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
permissions:
|
|
10
|
+
contents: read
|
|
11
|
+
pages: write
|
|
12
|
+
id-token: write
|
|
13
|
+
|
|
14
|
+
concurrency:
|
|
15
|
+
group: pages
|
|
16
|
+
cancel-in-progress: true
|
|
17
|
+
|
|
18
|
+
jobs:
|
|
19
|
+
build:
|
|
20
|
+
runs-on: ubuntu-latest
|
|
21
|
+
steps:
|
|
22
|
+
- uses: actions/checkout@v4
|
|
23
|
+
- uses: actions/setup-python@v5
|
|
24
|
+
with:
|
|
25
|
+
python-version: "3.12"
|
|
26
|
+
- name: Rebuild the site
|
|
27
|
+
run: |
|
|
28
|
+
pip install -e ".[dev]"
|
|
29
|
+
python scripts/build_docs.py
|
|
30
|
+
- uses: actions/configure-pages@v5
|
|
31
|
+
- uses: actions/upload-pages-artifact@v3
|
|
32
|
+
with:
|
|
33
|
+
path: docs
|
|
34
|
+
|
|
35
|
+
deploy:
|
|
36
|
+
needs: build
|
|
37
|
+
runs-on: ubuntu-latest
|
|
38
|
+
environment:
|
|
39
|
+
name: github-pages
|
|
40
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
41
|
+
steps:
|
|
42
|
+
- id: deployment
|
|
43
|
+
uses: actions/deploy-pages@v4
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
|
|
5
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## [Unreleased]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- The documentation site is now bilingual: all 20 pages have a full Persian
|
|
14
|
+
translation under `docs/fa/`, with RTL layout, translated navigation and
|
|
15
|
+
pager, a Persian search index, and `hreflang` alternates on every page.
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
- Sidebar mirrored to the right on RTL pages (an incorrect `row-reverse`
|
|
19
|
+
override was undoing the writing-direction mirroring).
|
|
20
|
+
- Long API signatures in `.api-head` now wrap instead of overflowing.
|
|
21
|
+
- Filename labels were clipped by a negative margin.
|
|
22
|
+
- Copy buttons overlapped the first line of code on narrow screens; space is
|
|
23
|
+
now reserved in `pre` on mobile.
|
|
24
|
+
- Removed the invalid `[rdl="rtl"]` CSS selector.
|
|
25
|
+
- Asset and cross-language links in `docs/fa/` now resolve relative to the
|
|
26
|
+
page, so the site works on GitHub Pages project paths.
|
|
27
|
+
- Stale repository URLs updated from `iliasync` to `iloveforduck`.
|
|
28
|
+
- `build_docs.py --check` now actually detects stale output.
|
|
29
|
+
|
|
30
|
+
## [1.0.0] — 2026-12-02
|
|
31
|
+
|
|
32
|
+
First public release.
|
|
33
|
+
|
|
34
|
+
### Added
|
|
35
|
+
|
|
36
|
+
**Protocol layer**
|
|
37
|
+
- Complete reconstruction of Bale's internal protocol from the official web
|
|
38
|
+
bundle: **683 RPC methods** across **52 services**, with a typed request and
|
|
39
|
+
response message for each — 1,366 protobuf types in total.
|
|
40
|
+
- **5,520 typed fields** and **1,960 wire codecs**, built at import time from
|
|
41
|
+
`proto/index.json` in about 0.08 s. No generated `_pb2.py` files to maintain.
|
|
42
|
+
- `dynamic.encode` / `decode` / `describe` / `to_dict` / `request_type` /
|
|
43
|
+
`response_type` for working with any RPC without a connection.
|
|
44
|
+
- `bale-xyz` CLI: `info`, `services`, `methods`, `search`, `describe`.
|
|
45
|
+
|
|
46
|
+
**Client**
|
|
47
|
+
- One `Client` class covering both connection modes — user sessions and bot
|
|
48
|
+
tokens — with automatic credential detection.
|
|
49
|
+
- **84 public methods**: messaging, media, chats, groups, users, calls and raw
|
|
50
|
+
RPC.
|
|
51
|
+
- Three authentication paths: session string (`<user_id>:<jwt>`), browser
|
|
52
|
+
cookie import (Firefox, Chromium family, across all platforms), and phone +
|
|
53
|
+
SMS with optional two-factor.
|
|
54
|
+
- Full Meet coverage: all **30** `bale.meet.v1.Meet` RPCs wrapped, with
|
|
55
|
+
voice as the default and video opt-in.
|
|
56
|
+
- File upload and media sending: `upload_file`, `send_file`, `send_photo`,
|
|
57
|
+
`send_video`, `send_voice`, `send_audio`, `send_document`, `download_file`,
|
|
58
|
+
`get_file_url`, `get_upload_limits`.
|
|
59
|
+
- Events, filters, dispatcher and a small FSM with pluggable storage, in both
|
|
60
|
+
Telethon and Pyrogram styles.
|
|
61
|
+
- `BotApi` for `https://tapi.bale.ai`, including long polling and webhooks.
|
|
62
|
+
|
|
63
|
+
**Documentation**
|
|
64
|
+
- A 20-page static documentation site under `docs/`: searchable, dark-mode
|
|
65
|
+
aware, responsive, and free of any build step or CDN dependency.
|
|
66
|
+
- `scripts/check_docs.py` verifies that the documentation matches the code —
|
|
67
|
+
every referenced method must exist, every link and anchor must resolve, and
|
|
68
|
+
the headline numbers must still be accurate.
|
|
69
|
+
|
|
70
|
+
### Fixed
|
|
71
|
+
|
|
72
|
+
Issues found by verifying payloads byte-for-byte against a real browser
|
|
73
|
+
capture (a `.har` file with 105 WebSocket frames):
|
|
74
|
+
|
|
75
|
+
- **WebSocket metadata** — `browser_version` is a string (`"158.0.0.0"`), not
|
|
76
|
+
a `fixed64`. The six `mt_*` keys and `language` were missing entirely. All
|
|
77
|
+
12 keys now match the browser exactly.
|
|
78
|
+
- **Inconsistent key casing** — `to_dict()` returned camelCase at the top
|
|
79
|
+
level and snake_case deeper down. Because `create_conference` looked up
|
|
80
|
+
`call["id"]`, it never found it and silently skipped link generation. Every
|
|
81
|
+
level is now normalised to snake_case.
|
|
82
|
+
- **`documentMessage` field types** — `fileId` and `accessHash` are bare
|
|
83
|
+
`int64` fields rather than `{value: …}` wrappers, and the caption field is
|
|
84
|
+
singular (`caption`, not `captions`).
|
|
85
|
+
- **Empty media variants were dropped** — protobuf 3 does not serialise a
|
|
86
|
+
sub-message whose fields are all default, so a media `ext` variant with no
|
|
87
|
+
dimensions or duration vanished on the wire. The builder now emits
|
|
88
|
+
non-default metadata so the variant survives.
|
|
89
|
+
|
|
90
|
+
### Known limitations
|
|
91
|
+
|
|
92
|
+
- The authenticated paths were verified by construction and by live handshake
|
|
93
|
+
(the socket rejects an invalid token with code `4401`; gRPC-web returns a
|
|
94
|
+
real `transactionHash`; the Bot API returns a real `401`), but not by a full
|
|
95
|
+
logged-in session.
|
|
96
|
+
- The protocol index is pinned to web build **5.5.1**. Regenerate it with
|
|
97
|
+
`scripts/build_protocol_index.py` when Bale ships a new build.
|
|
98
|
+
- LiveKit room control requires the optional `voice` extra.
|
|
99
|
+
|
|
100
|
+
### Verification
|
|
101
|
+
|
|
102
|
+
Release 1.0.0 was checked end to end before publishing:
|
|
103
|
+
|
|
104
|
+
- `pytest` — 73 tests passed.
|
|
105
|
+
- `scripts/check_docs.py` — 40 pages (20 English + 20 Persian), 66 client
|
|
106
|
+
methods and 7 dynamic helpers verified against the source.
|
|
107
|
+
- `ruff check src tests` — clean.
|
|
108
|
+
- The wheel installs into an empty virtualenv, imports, and round-trips an RPC
|
|
109
|
+
(`encode` → `decode`); the `bale-xyz` CLI reports 52 services, 683 RPCs and
|
|
110
|
+
1,960 codecs from the installed copy.
|
|
111
|
+
- The sdist unpacks standalone and passes the same test and docs checks.
|
|
112
|
+
|
|
113
|
+
[1.0.0]: https://github.com/iloveforduck/bale-xyz/releases/tag/v1.0.0
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Contributing to bale xyz
|
|
2
|
+
|
|
3
|
+
Thanks for taking the time. This document is short on purpose — the
|
|
4
|
+
[documentation site](docs/contributing.html) has the long version.
|
|
5
|
+
|
|
6
|
+
## Setup
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
git clone https://github.com/iloveforduck/bale-xyz.git
|
|
10
|
+
cd bale-xyz
|
|
11
|
+
python -m venv .venv
|
|
12
|
+
source .venv/bin/activate # Windows: .venv\Scripts\activate
|
|
13
|
+
pip install -e ".[dev]"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## The two gates
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
python -m pytest tests/ -q # 73 tests
|
|
20
|
+
python scripts/check_docs.py # docs must match the code
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Both must pass before a pull request can be merged. The second one is unusual
|
|
24
|
+
and worth explaining: it parses every documentation page and verifies that
|
|
25
|
+
each `client.something()` it mentions still exists, that internal links and
|
|
26
|
+
anchors resolve, and that the numbers quoted in the prose (683 RPCs, 52
|
|
27
|
+
services, the test count) are still accurate.
|
|
28
|
+
|
|
29
|
+
That means renaming a public method fails CI until the docs are updated —
|
|
30
|
+
which is the point.
|
|
31
|
+
|
|
32
|
+
## Conventions
|
|
33
|
+
|
|
34
|
+
- **Snake_case everywhere in Python.** Payload dicts may be built with either
|
|
35
|
+
spelling; anything *returned* to the caller is normalised to snake_case.
|
|
36
|
+
- **No network in tests.** Fake the transport, or replay captured bytes.
|
|
37
|
+
- **Pin wire formats with real bytes.** If you touch encoding, add a fixture
|
|
38
|
+
from a capture — not a hand-written dict literal. A dict literal only proves
|
|
39
|
+
the library agrees with itself.
|
|
40
|
+
- **One concern per commit.** Protocol regeneration goes in its own commit so
|
|
41
|
+
a regression stays bisectable.
|
|
42
|
+
- **Type hints on public methods.** `ruff` line length is 100.
|
|
43
|
+
|
|
44
|
+
## Adding a wrapper for an RPC
|
|
45
|
+
|
|
46
|
+
1. Find it: `bale-xyz search topic`
|
|
47
|
+
2. Read its signature: `bale-xyz describe SERVICE METHOD`
|
|
48
|
+
3. Write the method on `Client`, returning `dynamic.to_dict(response)`.
|
|
49
|
+
4. Test it with a stubbed `client.call` that records the payload.
|
|
50
|
+
5. Document it in the matching `scripts/docs_pages_*.py` file, then run
|
|
51
|
+
`python scripts/build_docs.py`.
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
async def my_new_thing(self, chat_id: str | int | Peer) -> dict[str, Any]:
|
|
55
|
+
"""One-line summary of what the user gets."""
|
|
56
|
+
response = await self.call(
|
|
57
|
+
"bale.some.v1.Service",
|
|
58
|
+
"SomeMethod",
|
|
59
|
+
{"peer": Peer.parse(chat_id).to_dict()},
|
|
60
|
+
)
|
|
61
|
+
return dynamic.to_dict(response)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Regenerating the protocol index
|
|
65
|
+
|
|
66
|
+
Only when Bale ships a new web build:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python scripts/build_protocol_index.py
|
|
70
|
+
python -m pytest tests/ -q
|
|
71
|
+
bale-xyz info
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The index is deterministic — the same input always produces the same output —
|
|
75
|
+
so a rebuild that produces a diff means the input changed.
|
|
76
|
+
|
|
77
|
+
## Writing style
|
|
78
|
+
|
|
79
|
+
- Short sentences. Concrete numbers.
|
|
80
|
+
- Say what is verified and what is not. The limitations page exists because
|
|
81
|
+
that distinction matters.
|
|
82
|
+
- Every snippet should run as written, or say plainly why it cannot.
|
|
83
|
+
|
|
84
|
+
## Security
|
|
85
|
+
|
|
86
|
+
- Never commit a session string, JWT, or HAR capture. They grant full account
|
|
87
|
+
access.
|
|
88
|
+
- If you report a bug involving credentials, scrub them first.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT. By contributing you agree that your work is released under the same terms.
|
bale_xyz-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 bale xyz contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
Third-party notice
|
|
26
|
+
|
|
27
|
+
This project is an independent, unofficial client. It is not affiliated with,
|
|
28
|
+
endorsed by, or supported by Bale (بله) or its parent company. "Bale" and
|
|
29
|
+
related marks are the property of their respective owners. Protocol
|
|
30
|
+
descriptions here were derived by inspecting the public web client; use of this
|
|
31
|
+
library is subject to Bale's own terms of service.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include CHANGELOG.md
|
|
4
|
+
include CONTRIBUTING.md
|
|
5
|
+
include pyproject.toml
|
|
6
|
+
|
|
7
|
+
recursive-include src/balexyz *.py *.pyi
|
|
8
|
+
recursive-include src/balexyz/proto *.json
|
|
9
|
+
include src/balexyz/py.typed
|
|
10
|
+
|
|
11
|
+
recursive-include docs *.html *.css *.js *.md *.svg *.png *.json
|
|
12
|
+
recursive-include examples *.py
|
|
13
|
+
recursive-include scripts *.py
|
|
14
|
+
recursive-include tests *.py *.json
|
|
15
|
+
recursive-include .github *.yml *.yaml *.md
|
|
16
|
+
|
|
17
|
+
global-exclude __pycache__ *.py[cod] *.so .DS_Store
|