tgblocks 0.2.0__tar.gz → 0.2.2__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.
Potentially problematic release.
This version of tgblocks might be problematic. Click here for more details.
- {tgblocks-0.2.0 → tgblocks-0.2.2}/CHANGELOG.md +29 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/GITHUB.md +2 -2
- {tgblocks-0.2.0 → tgblocks-0.2.2}/PKG-INFO +10 -11
- {tgblocks-0.2.0 → tgblocks-0.2.2}/README.md +7 -7
- {tgblocks-0.2.0 → tgblocks-0.2.2}/pyproject.toml +3 -4
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/botkit.py +41 -3
- {tgblocks-0.2.0 → tgblocks-0.2.2}//320/230/320/235/320/241/320/242/320/240/320/243/320/232/320/246/320/230/320/257.md +1 -1
- {tgblocks-0.2.0 → tgblocks-0.2.2}/.gitignore +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/LICENSE +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/examples/features.txt +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/examples/full.tg +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/examples/hello.tg +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/__init__.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/__main__.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/cli.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/convert.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/dsl/__init__.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/dsl/codegen.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/dsl/parser.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/model.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/network.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/runner.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/textlang.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/__init__.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/server.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/static/blocks.html +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/static/nodes.html +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/static/text.html +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/static/tgblocks-project.js +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/static/tgblocks-ui.js +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/src/tgblocks/visual/static/vendor/blockly.js +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/corpus.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/actions.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/conditions.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/events.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/hello.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/long-buttons.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/nested.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/patterns.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/proxy.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/text-actions.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/text-basic.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/golden/text-buttons.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_blockly.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_bots.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_clear.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_cli.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_dice.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_dsl.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_examples.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_features.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_filters.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_golden.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_hidden_filters.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_i18n.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_proxy.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_scaffold.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_security.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_server_ports.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_sync.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_ui.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_validation.py +0 -0
- {tgblocks-0.2.0 → tgblocks-0.2.2}/tests/test_whitespace.py +0 -0
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
Metadata, tests and documentation. The generated aiogram code is unchanged.
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- **Minimum Python is now 3.10.** `aiogram` itself requires 3.10, so on 3.9 the
|
|
10
|
+
`runtime` extra could only pull an old version that the suite could not cover. The
|
|
11
|
+
CI matrix is 3.10, 3.11 and 3.13 on Windows and Linux.
|
|
12
|
+
- The PyPI summary is the same sentence as the README: three visual editors, not one.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- The test poll payload is built from the installed aiogram, so a new release that adds
|
|
17
|
+
required `Poll` fields (3.31 added three) no longer turns the whole matrix red.
|
|
18
|
+
- `tools/qa_smoke.py` no longer hardcodes a Windows path: it works from any clone and on
|
|
19
|
+
Linux.
|
|
20
|
+
- `tools/check_markdown.py` and `tools/qa_smoke.py` write UTF-8, so the Windows runner
|
|
21
|
+
reports a failure instead of crashing on Russian output.
|
|
22
|
+
|
|
23
|
+
### Documentation
|
|
24
|
+
|
|
25
|
+
- README rewritten for a first-time visitor: a demo GIF, one install command, the three
|
|
26
|
+
views as sections with screenshots, actions and events as aligned code blocks instead
|
|
27
|
+
of wide tables, and a Russian section that reads like a person wrote it.
|
|
28
|
+
- `docs/` screenshots are taken from a demo project with a fake token.
|
|
29
|
+
- `GITHUB.md` is the full publishing guide (GitHub, tokens, CI, PyPI, releases,
|
|
30
|
+
troubleshooting).
|
|
31
|
+
|
|
3
32
|
## 0.2.0
|
|
4
33
|
|
|
5
34
|
The release that made the three editors agree with each other.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
**git** — отправлять код: <https://git-scm.com/download/win>
|
|
14
14
|
(при установке оставь галочки по умолчанию)
|
|
15
15
|
|
|
16
|
-
**Python 3.
|
|
16
|
+
**Python 3.10 или новее** — собирать пакет: <https://www.python.org/downloads/>
|
|
17
17
|
|
|
18
18
|
**Аккаунт PyPI** — чтобы работал `pip install`: <https://pypi.org/account/register/>
|
|
19
19
|
|
|
@@ -105,7 +105,7 @@ git push
|
|
|
105
105
|
|
|
106
106
|
1. Открой страницу репозитория — файлы на месте, README и `docs/demo.gif` видны.
|
|
107
107
|
2. Вкладка **Actions**: workflow **CI** должен стать зелёным. Он прогоняет 261 тест на
|
|
108
|
-
Windows и Linux (Python 3.
|
|
108
|
+
Windows и Linux (Python 3.10, 3.11, 3.13), проверяет JS редакторов, собирает пакет и
|
|
109
109
|
ставит его в чистое окружение.
|
|
110
110
|
3. Бейдж в README (вставь после заголовка):
|
|
111
111
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: tgblocks
|
|
3
|
-
Version: 0.2.
|
|
4
|
-
Summary:
|
|
3
|
+
Version: 0.2.2
|
|
4
|
+
Summary: Visual editor for building Telegram bots on aiogram 3
|
|
5
5
|
Project-URL: Homepage, https://github.com/Pupka228228/tgblocks
|
|
6
6
|
Project-URL: Repository, https://github.com/Pupka228228/tgblocks
|
|
7
7
|
Project-URL: Issues, https://github.com/Pupka228228/tgblocks/issues
|
|
@@ -17,7 +17,6 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
17
17
|
Classifier: Operating System :: OS Independent
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
19
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
20
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.10
|
|
22
21
|
Classifier: Programming Language :: Python :: 3.11
|
|
23
22
|
Classifier: Programming Language :: Python :: 3.12
|
|
@@ -25,7 +24,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
25
24
|
Classifier: Topic :: Communications :: Chat
|
|
26
25
|
Classifier: Topic :: Software Development :: Code Generators
|
|
27
26
|
Classifier: Topic :: Software Development :: User Interfaces
|
|
28
|
-
Requires-Python: >=3.
|
|
27
|
+
Requires-Python: >=3.10
|
|
29
28
|
Provides-Extra: dev
|
|
30
29
|
Requires-Dist: build>=1; extra == 'dev'
|
|
31
30
|
Requires-Dist: pytest>=7; extra == 'dev'
|
|
@@ -38,12 +37,12 @@ Description-Content-Type: text/markdown
|
|
|
38
37
|
|
|
39
38
|
**A tiny text DSL and three visual editors for Telegram bots on aiogram 3.**
|
|
40
39
|
|
|
41
|
-
Five lines of text — or five dragged blocks — and you get
|
|
40
|
+
Five lines of text — or five dragged blocks — and you get ordinary, editable aiogram
|
|
42
41
|
code. No account, no cloud, no lock-in: the editor is a local server on
|
|
43
|
-
|
|
42
|
+
127.0.0.1, and the result is a normal bot.py you can read, commit and deploy.
|
|
44
43
|
|
|
45
44
|
[](https://github.com/Pupka228228/tgblocks/actions/workflows/ci.yml)
|
|
46
|
-
[](https://www.python.org/)
|
|
47
46
|
[](LICENSE)
|
|
48
47
|
|
|
49
48
|

|
|
@@ -105,11 +104,11 @@ block names, field captions and hints change with it.
|
|
|
105
104
|
## Why
|
|
106
105
|
|
|
107
106
|
Paid bot constructors keep your bot inside their panel: you rent the hosting, you cannot
|
|
108
|
-
read the code, and leaving means starting again.
|
|
109
|
-
control, but the first hour is dispatcher, routers, filters, keyboards,
|
|
110
|
-
async entrypoint before anything answers.
|
|
107
|
+
read the code, and leaving means starting again. Writing aiogram 3 by hand is the
|
|
108
|
+
opposite — full control, but the first hour is dispatcher, routers, filters, keyboards,
|
|
109
|
+
callbacks and an async entrypoint before anything answers.
|
|
111
110
|
|
|
112
|
-
|
|
111
|
+
tgblocks is the middle: a language small enough to fit on a postcard, or an editor where
|
|
113
112
|
a bot is boxes with wires. Both produce the same readable aiogram code, and the code is
|
|
114
113
|
yours.
|
|
115
114
|
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
**A tiny text DSL and three visual editors for Telegram bots on aiogram 3.**
|
|
4
4
|
|
|
5
|
-
Five lines of text — or five dragged blocks — and you get
|
|
5
|
+
Five lines of text — or five dragged blocks — and you get ordinary, editable aiogram
|
|
6
6
|
code. No account, no cloud, no lock-in: the editor is a local server on
|
|
7
|
-
|
|
7
|
+
127.0.0.1, and the result is a normal bot.py you can read, commit and deploy.
|
|
8
8
|
|
|
9
9
|
[](https://github.com/Pupka228228/tgblocks/actions/workflows/ci.yml)
|
|
10
|
-
[](https://www.python.org/)
|
|
11
11
|
[](LICENSE)
|
|
12
12
|
|
|
13
13
|

|
|
@@ -69,11 +69,11 @@ block names, field captions and hints change with it.
|
|
|
69
69
|
## Why
|
|
70
70
|
|
|
71
71
|
Paid bot constructors keep your bot inside their panel: you rent the hosting, you cannot
|
|
72
|
-
read the code, and leaving means starting again.
|
|
73
|
-
control, but the first hour is dispatcher, routers, filters, keyboards,
|
|
74
|
-
async entrypoint before anything answers.
|
|
72
|
+
read the code, and leaving means starting again. Writing aiogram 3 by hand is the
|
|
73
|
+
opposite — full control, but the first hour is dispatcher, routers, filters, keyboards,
|
|
74
|
+
callbacks and an async entrypoint before anything answers.
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
tgblocks is the middle: a language small enough to fit on a postcard, or an editor where
|
|
77
77
|
a bot is boxes with wires. Both produce the same readable aiogram code, and the code is
|
|
78
78
|
yours.
|
|
79
79
|
|
|
@@ -4,10 +4,10 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "tgblocks"
|
|
7
|
-
version = "0.2.
|
|
8
|
-
description = "
|
|
7
|
+
version = "0.2.2"
|
|
8
|
+
description = "Visual editor for building Telegram bots on aiogram 3"
|
|
9
9
|
readme = "README.md"
|
|
10
|
-
requires-python = ">=3.
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
11
|
license = { text = "MIT" }
|
|
12
12
|
authors = [{ name = "tgblocks contributors" }]
|
|
13
13
|
keywords = ["telegram", "bot", "dsl", "blockly", "aiogram", "low-code", "codegen"]
|
|
@@ -17,7 +17,6 @@ classifiers = [
|
|
|
17
17
|
"License :: OSI Approved :: MIT License",
|
|
18
18
|
"Programming Language :: Python :: 3",
|
|
19
19
|
"Programming Language :: Python :: 3 :: Only",
|
|
20
|
-
"Programming Language :: Python :: 3.9",
|
|
21
20
|
"Programming Language :: Python :: 3.10",
|
|
22
21
|
"Programming Language :: Python :: 3.11",
|
|
23
22
|
"Programming Language :: Python :: 3.12",
|
|
@@ -14,6 +14,43 @@ from aiogram.types import Chat, Message
|
|
|
14
14
|
|
|
15
15
|
BOT_TOKEN = "42:TEST_TOKEN"
|
|
16
16
|
|
|
17
|
+
|
|
18
|
+
def _model_fields(model) -> set:
|
|
19
|
+
fields = getattr(model, "model_fields", None) # pydantic v2
|
|
20
|
+
if fields is None:
|
|
21
|
+
fields = getattr(model, "__fields__", {}) # pydantic v1
|
|
22
|
+
return set(fields)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def _poll_payload() -> dict:
|
|
26
|
+
"""A poll payload for the aiogram that is installed.
|
|
27
|
+
|
|
28
|
+
Telegram keeps adding required fields (3.31 brought `persistent_id`,
|
|
29
|
+
`allows_revoting` and `members_only`), and an old aiogram rejects what it does
|
|
30
|
+
not know. Asking the model which fields exist keeps the suite green on every
|
|
31
|
+
supported version.
|
|
32
|
+
"""
|
|
33
|
+
from aiogram.types import Poll, PollOption
|
|
34
|
+
|
|
35
|
+
option = {"text": "a", "voter_count": 0}
|
|
36
|
+
if "persistent_id" in _model_fields(PollOption):
|
|
37
|
+
option["persistent_id"] = "0"
|
|
38
|
+
|
|
39
|
+
payload = {
|
|
40
|
+
"id": "1",
|
|
41
|
+
"question": "q",
|
|
42
|
+
"options": [option],
|
|
43
|
+
"total_voter_count": 1,
|
|
44
|
+
"is_closed": False,
|
|
45
|
+
"is_anonymous": False,
|
|
46
|
+
"type": "regular",
|
|
47
|
+
"allows_multiple_answers": False,
|
|
48
|
+
}
|
|
49
|
+
for name, value in (("allows_revoting", False), ("members_only", False)):
|
|
50
|
+
if name in _model_fields(Poll):
|
|
51
|
+
payload[name] = value
|
|
52
|
+
return payload
|
|
53
|
+
|
|
17
54
|
# The smallest payload Telegram would accept for each kind of message content:
|
|
18
55
|
# aiogram validates the update before the dispatcher sees it, so a made-up
|
|
19
56
|
# "file_id only" object would fail for dice, polls, stickers and locations.
|
|
@@ -32,9 +69,10 @@ CONTENT = {
|
|
|
32
69
|
"duration": 1},
|
|
33
70
|
"location": {"latitude": 1.0, "longitude": 1.0},
|
|
34
71
|
"contact": {"phone_number": "+100", "first_name": "Tester"},
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
72
|
+
# Telegram grows required Poll fields over time (aiogram 3.31 added three).
|
|
73
|
+
# The payload is built for the aiogram that is installed, so the suite runs on
|
|
74
|
+
# any supported version instead of only the newest one.
|
|
75
|
+
"poll": _poll_payload(),
|
|
38
76
|
"dice": {"emoji": "🎲", "value": 3},
|
|
39
77
|
}
|
|
40
78
|
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
|
|
23
23
|
## 1. Что понадобится
|
|
24
24
|
|
|
25
|
-
- Python **3.
|
|
25
|
+
- Python **3.10+** (проверить: `python --version`).
|
|
26
26
|
- Терминал (PowerShell подойдёт).
|
|
27
27
|
- Токен бота — его выдаёт **@BotFather** в Telegram (раздел 4).
|
|
28
28
|
- Интернет: для `pip install`, для первой загрузки Blockly с CDN и для самого бота
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|