recipe-dsl 0.2.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.
- recipe_dsl-0.2.0/LICENSE +21 -0
- recipe_dsl-0.2.0/PKG-INFO +36 -0
- recipe_dsl-0.2.0/README.md +74 -0
- recipe_dsl-0.2.0/pyproject.toml +56 -0
- recipe_dsl-0.2.0/setup.cfg +4 -0
- recipe_dsl-0.2.0/src/recipe_dsl/__init__.py +3 -0
- recipe_dsl-0.2.0/src/recipe_dsl/__main__.py +6 -0
- recipe_dsl-0.2.0/src/recipe_dsl/ast/__init__.py +31 -0
- recipe_dsl-0.2.0/src/recipe_dsl/ast/nodes.py +1136 -0
- recipe_dsl-0.2.0/src/recipe_dsl/ast/visitors.py +170 -0
- recipe_dsl-0.2.0/src/recipe_dsl/cli.py +314 -0
- recipe_dsl-0.2.0/src/recipe_dsl/errors/__init__.py +5 -0
- recipe_dsl-0.2.0/src/recipe_dsl/errors/exceptions.py +81 -0
- recipe_dsl-0.2.0/src/recipe_dsl/grammar/__init__.py +5 -0
- recipe_dsl-0.2.0/src/recipe_dsl/grammar/parser.py +2482 -0
- recipe_dsl-0.2.0/src/recipe_dsl/runtime/__init__.py +1 -0
- recipe_dsl-0.2.0/src/recipe_dsl/runtime/backends/__init__.py +1 -0
- recipe_dsl-0.2.0/src/recipe_dsl/runtime/backends/browser.py +67 -0
- recipe_dsl-0.2.0/src/recipe_dsl/runtime/backends/http.py +89 -0
- recipe_dsl-0.2.0/src/recipe_dsl/runtime/backends/sqlalchemy.py +53 -0
- recipe_dsl-0.2.0/src/recipe_dsl/runtime/interpreter.py +2432 -0
- recipe_dsl-0.2.0/src/recipe_dsl.egg-info/PKG-INFO +36 -0
- recipe_dsl-0.2.0/src/recipe_dsl.egg-info/SOURCES.txt +37 -0
- recipe_dsl-0.2.0/src/recipe_dsl.egg-info/dependency_links.txt +1 -0
- recipe_dsl-0.2.0/src/recipe_dsl.egg-info/entry_points.txt +2 -0
- recipe_dsl-0.2.0/src/recipe_dsl.egg-info/requires.txt +32 -0
- recipe_dsl-0.2.0/src/recipe_dsl.egg-info/top_level.txt +1 -0
- recipe_dsl-0.2.0/tests/test_browser_ops.py +133 -0
- recipe_dsl-0.2.0/tests/test_complete_feature_audit.py +458 -0
- recipe_dsl-0.2.0/tests/test_control_flow.py +686 -0
- recipe_dsl-0.2.0/tests/test_examples_e2e.py +272 -0
- recipe_dsl-0.2.0/tests/test_extract.py +185 -0
- recipe_dsl-0.2.0/tests/test_integration.py +116 -0
- recipe_dsl-0.2.0/tests/test_interpreter.py +1740 -0
- recipe_dsl-0.2.0/tests/test_navigate.py +114 -0
- recipe_dsl-0.2.0/tests/test_parser.py +96 -0
- recipe_dsl-0.2.0/tests/test_rest_api.py +117 -0
- recipe_dsl-0.2.0/tests/test_sql.py +87 -0
- recipe_dsl-0.2.0/tests/test_string_ops.py +234 -0
recipe_dsl-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 deAI Network
|
|
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.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: recipe-dsl
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: RecipeDSL — domain-specific language for data gathering and transformations
|
|
5
|
+
License: MIT
|
|
6
|
+
Requires-Python: >=3.11
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Dist: lark>=1.1.0
|
|
9
|
+
Requires-Dist: click>=8.0.0
|
|
10
|
+
Requires-Dist: rich>=13.0.0
|
|
11
|
+
Requires-Dist: httpx>=0.27.0
|
|
12
|
+
Requires-Dist: lxml>=5.0.0
|
|
13
|
+
Requires-Dist: cssselect>=1.2.0
|
|
14
|
+
Requires-Dist: markdownify>=0.14.0
|
|
15
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
16
|
+
Requires-Dist: sqlalchemy>=2.0.0
|
|
17
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
18
|
+
Provides-Extra: browser
|
|
19
|
+
Requires-Dist: playwright>=1.40.0; extra == "browser"
|
|
20
|
+
Provides-Extra: mssql
|
|
21
|
+
Requires-Dist: python-tds>=1.17.0; extra == "mssql"
|
|
22
|
+
Requires-Dist: sqlalchemy-pytds>=1.0.0; extra == "mssql"
|
|
23
|
+
Provides-Extra: all
|
|
24
|
+
Requires-Dist: playwright>=1.40.0; extra == "all"
|
|
25
|
+
Requires-Dist: python-tds>=1.17.0; extra == "all"
|
|
26
|
+
Requires-Dist: sqlalchemy-pytds>=1.0.0; extra == "all"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-httpx>=0.34.0; extra == "dev"
|
|
31
|
+
Requires-Dist: responses>=0.23.0; extra == "dev"
|
|
32
|
+
Requires-Dist: pyyaml>=6.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pyinstaller>=6.0; extra == "dev"
|
|
34
|
+
Requires-Dist: flask>=3.0; extra == "dev"
|
|
35
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
36
|
+
Dynamic: license-file
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+

|
|
2
|
+
|
|
3
|
+
# RecipeDSL
|
|
4
|
+
|
|
5
|
+
A domain-specific language for data gathering and transformations, designed for LLM code generation accuracy.
|
|
6
|
+
|
|
7
|
+
RecipeDSL combines data from multiple sources — SQL databases, REST APIs, local files, and web pages — then transforms it using tabular operations. Its constrained, explicit syntax reduces common LLM errors when generating data pipelines.
|
|
8
|
+
|
|
9
|
+
## Origin
|
|
10
|
+
|
|
11
|
+
RecipeDSL is forked from [Anka](https://github.com/BleBlo/Anka), a DSL that outperforms Python on multi-step data transformation tasks (+40% accuracy on complex pipelines). See the paper: [Anka: A Domain-Specific Language for Reliable LLM Code Generation](https://arxiv.org/abs/2512.23214).
|
|
12
|
+
|
|
13
|
+
We extend Anka with bridge operations for SQL databases, REST APIs, and web scraping, while preserving its tabular transformation core.
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```rdsl
|
|
18
|
+
PIPELINE enrich_users_from_api:
|
|
19
|
+
-- Query a database
|
|
20
|
+
QUERY "${DB_URL}" "SELECT id, name, email FROM users WHERE active = 1" INTO users
|
|
21
|
+
|
|
22
|
+
-- Fetch data from a REST API
|
|
23
|
+
REQUEST CONCAT("${API_BASE}", "/roles") METHOD "GET" INTO response
|
|
24
|
+
JSON_EXTRACT response PATH "data" INTO roles
|
|
25
|
+
|
|
26
|
+
-- Join the two sources — something SQL alone can't do
|
|
27
|
+
STEP enrich:
|
|
28
|
+
JOIN users WITH roles
|
|
29
|
+
ON users.id == roles.user_id
|
|
30
|
+
INTO enriched
|
|
31
|
+
|
|
32
|
+
STEP select_fields:
|
|
33
|
+
SELECT name, email, role_name FROM enriched INTO results
|
|
34
|
+
|
|
35
|
+
OUTPUT results
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Configuration comes from environment variables or a `.env` file. No input declarations needed.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install -e .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
For MSSQL (SQL Server) support:
|
|
47
|
+
```bash
|
|
48
|
+
pip install -e ".[mssql]"
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For everything (kitchensink):
|
|
52
|
+
```bash
|
|
53
|
+
pip install -e ".[all]"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Run
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Execute a recipe
|
|
60
|
+
DB_URL=sqlite:///mydata.db recipe-dsl run my_recipe.rdsl
|
|
61
|
+
|
|
62
|
+
# Output raw JSON
|
|
63
|
+
DB_URL=sqlite:///mydata.db recipe-dsl run my_recipe.rdsl --json
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Documentation
|
|
67
|
+
|
|
68
|
+
- **[Syntax Guide](docs/syntax-guide.md)** — Complete language reference
|
|
69
|
+
- **[Architecture Decisions](docs/architecture-decisions/)** — Design rationale
|
|
70
|
+
- **[Examples](examples/)** — Working recipes with end-to-end tests
|
|
71
|
+
|
|
72
|
+
## License
|
|
73
|
+
|
|
74
|
+
MIT — see [LICENSE](LICENSE) for details.
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "recipe-dsl"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "RecipeDSL — domain-specific language for data gathering and transformations"
|
|
9
|
+
license = {text = "MIT"}
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
dependencies = [
|
|
12
|
+
"lark>=1.1.0",
|
|
13
|
+
"click>=8.0.0",
|
|
14
|
+
"rich>=13.0.0",
|
|
15
|
+
"httpx>=0.27.0",
|
|
16
|
+
"lxml>=5.0.0",
|
|
17
|
+
"cssselect>=1.2.0",
|
|
18
|
+
"markdownify>=0.14.0",
|
|
19
|
+
"python-dateutil>=2.8.0",
|
|
20
|
+
"sqlalchemy>=2.0.0",
|
|
21
|
+
"python-dotenv>=1.0.0",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
browser = [
|
|
26
|
+
"playwright>=1.40.0",
|
|
27
|
+
]
|
|
28
|
+
mssql = [
|
|
29
|
+
"python-tds>=1.17.0",
|
|
30
|
+
"sqlalchemy-pytds>=1.0.0",
|
|
31
|
+
]
|
|
32
|
+
all = [
|
|
33
|
+
"playwright>=1.40.0",
|
|
34
|
+
"python-tds>=1.17.0",
|
|
35
|
+
"sqlalchemy-pytds>=1.0.0",
|
|
36
|
+
]
|
|
37
|
+
dev = [
|
|
38
|
+
"pytest>=8.0",
|
|
39
|
+
"pytest-asyncio>=0.23",
|
|
40
|
+
"pytest-httpx>=0.34.0",
|
|
41
|
+
"responses>=0.23.0",
|
|
42
|
+
"pyyaml>=6.0",
|
|
43
|
+
"pyinstaller>=6.0",
|
|
44
|
+
"flask>=3.0",
|
|
45
|
+
"twine>=5.0",
|
|
46
|
+
]
|
|
47
|
+
|
|
48
|
+
[project.scripts]
|
|
49
|
+
recipe-dsl = "recipe_dsl.cli:main"
|
|
50
|
+
|
|
51
|
+
[tool.setuptools.packages.find]
|
|
52
|
+
where = ["src"]
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
asyncio_mode = "auto"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""RecipeDSL AST module."""
|
|
2
|
+
|
|
3
|
+
from recipe_dsl.ast.nodes import (
|
|
4
|
+
ArithmeticOp,
|
|
5
|
+
ASTNode,
|
|
6
|
+
BinaryOp,
|
|
7
|
+
FieldDef,
|
|
8
|
+
Identifier,
|
|
9
|
+
Input,
|
|
10
|
+
Literal,
|
|
11
|
+
Output,
|
|
12
|
+
Pipeline,
|
|
13
|
+
SourceLocation,
|
|
14
|
+
TableType,
|
|
15
|
+
TypeName,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
"ASTNode",
|
|
20
|
+
"ArithmeticOp",
|
|
21
|
+
"BinaryOp",
|
|
22
|
+
"FieldDef",
|
|
23
|
+
"Identifier",
|
|
24
|
+
"Input",
|
|
25
|
+
"Literal",
|
|
26
|
+
"Output",
|
|
27
|
+
"Pipeline",
|
|
28
|
+
"SourceLocation",
|
|
29
|
+
"TableType",
|
|
30
|
+
"TypeName",
|
|
31
|
+
]
|