blueprint-dsl 0.1.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.
- blueprint_dsl-0.1.0/LICENSE +21 -0
- blueprint_dsl-0.1.0/PKG-INFO +92 -0
- blueprint_dsl-0.1.0/README.md +70 -0
- blueprint_dsl-0.1.0/pyproject.toml +65 -0
- blueprint_dsl-0.1.0/src/blueprint_dsl/__init__.py +43 -0
- blueprint_dsl-0.1.0/src/blueprint_dsl/compiler.py +1168 -0
- blueprint_dsl-0.1.0/src/blueprint_dsl/py.typed +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Robert Sharp
|
|
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,92 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: blueprint-dsl
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A narrow DSL that compiles structured-output contracts to strict JSON Schema.
|
|
5
|
+
Keywords: ai,dsl,json-schema,structured-output
|
|
6
|
+
Author: Robert Sharp
|
|
7
|
+
Author-email: Robert Sharp <webmaster@sharpdesigndigital.com>
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Requires-Python: >=3.12
|
|
18
|
+
Project-URL: Homepage, https://github.com/siliconsociety/blueprint-dsl
|
|
19
|
+
Project-URL: Issues, https://github.com/siliconsociety/blueprint-dsl/issues
|
|
20
|
+
Project-URL: Repository, https://github.com/siliconsociety/blueprint-dsl
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Blueprint DSL
|
|
24
|
+
|
|
25
|
+
Blueprint is a small language for declaring the exact JSON object an AI model must return.
|
|
26
|
+
It compiles to strict JSON Schema and fails with line-oriented diagnostics when a contract is
|
|
27
|
+
invalid or exceeds common structured-output provider limits.
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
Schema Friend:
|
|
31
|
+
name: String(min=1)
|
|
32
|
+
closeness: Float(min=0.0, max=1.0)
|
|
33
|
+
|
|
34
|
+
Return Person:
|
|
35
|
+
name: String(min=1)
|
|
36
|
+
age: Optional[Integer]
|
|
37
|
+
address:
|
|
38
|
+
street: String
|
|
39
|
+
city: String
|
|
40
|
+
tags: List[String]
|
|
41
|
+
status: Enum["draft", "final"]
|
|
42
|
+
friends: List[Friend]
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
```python
|
|
46
|
+
from blueprint_dsl import compile_blueprint
|
|
47
|
+
|
|
48
|
+
compiled = compile_blueprint(source)
|
|
49
|
+
print(compiled.name)
|
|
50
|
+
print(compiled.schema)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Language
|
|
54
|
+
|
|
55
|
+
A Blueprint contains exactly one `Return Name:` declaration and may contain reusable
|
|
56
|
+
`Schema Name:` declarations. Every declared field is required. `Optional[T]` means the
|
|
57
|
+
field value may be null; it does not make the field absent.
|
|
58
|
+
|
|
59
|
+
Supported primitives are `String`, `Integer`, `Float`, and `Boolean`. `None` is available
|
|
60
|
+
for nullable unions. Formatted strings include `Date`, `Time`, `Datetime`, `Duration`,
|
|
61
|
+
`Email`, `Hostname`, `IPv4`, `IPv6`, and `Uuid`. Containers include `List[T]`, `Enum[...]`,
|
|
62
|
+
`Optional[T]`, and unions such as `String | None`.
|
|
63
|
+
|
|
64
|
+
String and formatted-string `min`/`max` arguments constrain length. Numeric types support
|
|
65
|
+
`min`, `max`, `exclusive_min`, `exclusive_max`, and `multiple_of`. Lists support `min` and
|
|
66
|
+
`max` item counts. Two-space-indented bare fields create inline objects; `List:` creates an
|
|
67
|
+
inline list of objects. Trailing comments become schema descriptions.
|
|
68
|
+
|
|
69
|
+
`blueprint_spec_card()` returns the complete compact language reference used by Blueprint
|
|
70
|
+
editors. `blueprint_editor_metadata()` and `blueprint_types_by_category()` expose the same
|
|
71
|
+
canonical type registry for UI tooling.
|
|
72
|
+
|
|
73
|
+
## Stability
|
|
74
|
+
|
|
75
|
+
Blueprint is intentionally narrow and feature complete. Version `0.1.0` establishes the
|
|
76
|
+
public package API and `blueprint/1` language semantics. Future releases are expected to be
|
|
77
|
+
bug fixes unless an actual language defect requires a documented change.
|
|
78
|
+
|
|
79
|
+
## Development
|
|
80
|
+
|
|
81
|
+
Blueprint supports Python 3.12 through 3.14 and has no runtime dependencies.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
./gate.sh
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
The gate runs linting, static analysis, the complete compiler suite with branch coverage,
|
|
88
|
+
and a distribution build. PyPI publication is a separate, deliberate release action.
|
|
89
|
+
|
|
90
|
+
## License
|
|
91
|
+
|
|
92
|
+
MIT
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
# Blueprint DSL
|
|
2
|
+
|
|
3
|
+
Blueprint is a small language for declaring the exact JSON object an AI model must return.
|
|
4
|
+
It compiles to strict JSON Schema and fails with line-oriented diagnostics when a contract is
|
|
5
|
+
invalid or exceeds common structured-output provider limits.
|
|
6
|
+
|
|
7
|
+
```text
|
|
8
|
+
Schema Friend:
|
|
9
|
+
name: String(min=1)
|
|
10
|
+
closeness: Float(min=0.0, max=1.0)
|
|
11
|
+
|
|
12
|
+
Return Person:
|
|
13
|
+
name: String(min=1)
|
|
14
|
+
age: Optional[Integer]
|
|
15
|
+
address:
|
|
16
|
+
street: String
|
|
17
|
+
city: String
|
|
18
|
+
tags: List[String]
|
|
19
|
+
status: Enum["draft", "final"]
|
|
20
|
+
friends: List[Friend]
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from blueprint_dsl import compile_blueprint
|
|
25
|
+
|
|
26
|
+
compiled = compile_blueprint(source)
|
|
27
|
+
print(compiled.name)
|
|
28
|
+
print(compiled.schema)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Language
|
|
32
|
+
|
|
33
|
+
A Blueprint contains exactly one `Return Name:` declaration and may contain reusable
|
|
34
|
+
`Schema Name:` declarations. Every declared field is required. `Optional[T]` means the
|
|
35
|
+
field value may be null; it does not make the field absent.
|
|
36
|
+
|
|
37
|
+
Supported primitives are `String`, `Integer`, `Float`, and `Boolean`. `None` is available
|
|
38
|
+
for nullable unions. Formatted strings include `Date`, `Time`, `Datetime`, `Duration`,
|
|
39
|
+
`Email`, `Hostname`, `IPv4`, `IPv6`, and `Uuid`. Containers include `List[T]`, `Enum[...]`,
|
|
40
|
+
`Optional[T]`, and unions such as `String | None`.
|
|
41
|
+
|
|
42
|
+
String and formatted-string `min`/`max` arguments constrain length. Numeric types support
|
|
43
|
+
`min`, `max`, `exclusive_min`, `exclusive_max`, and `multiple_of`. Lists support `min` and
|
|
44
|
+
`max` item counts. Two-space-indented bare fields create inline objects; `List:` creates an
|
|
45
|
+
inline list of objects. Trailing comments become schema descriptions.
|
|
46
|
+
|
|
47
|
+
`blueprint_spec_card()` returns the complete compact language reference used by Blueprint
|
|
48
|
+
editors. `blueprint_editor_metadata()` and `blueprint_types_by_category()` expose the same
|
|
49
|
+
canonical type registry for UI tooling.
|
|
50
|
+
|
|
51
|
+
## Stability
|
|
52
|
+
|
|
53
|
+
Blueprint is intentionally narrow and feature complete. Version `0.1.0` establishes the
|
|
54
|
+
public package API and `blueprint/1` language semantics. Future releases are expected to be
|
|
55
|
+
bug fixes unless an actual language defect requires a documented change.
|
|
56
|
+
|
|
57
|
+
## Development
|
|
58
|
+
|
|
59
|
+
Blueprint supports Python 3.12 through 3.14 and has no runtime dependencies.
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
./gate.sh
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
The gate runs linting, static analysis, the complete compiler suite with branch coverage,
|
|
66
|
+
and a distribution build. PyPI publication is a separate, deliberate release action.
|
|
67
|
+
|
|
68
|
+
## License
|
|
69
|
+
|
|
70
|
+
MIT
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "blueprint-dsl"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A narrow DSL that compiles structured-output contracts to strict JSON Schema."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
license = "MIT"
|
|
7
|
+
license-files = ["LICENSE"]
|
|
8
|
+
authors = [
|
|
9
|
+
{ name = "Robert Sharp", email = "webmaster@sharpdesigndigital.com" },
|
|
10
|
+
]
|
|
11
|
+
requires-python = ">=3.12"
|
|
12
|
+
keywords = ["ai", "dsl", "json-schema", "structured-output"]
|
|
13
|
+
classifiers = [
|
|
14
|
+
"Development Status :: 4 - Beta",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3.12",
|
|
18
|
+
"Programming Language :: Python :: 3.13",
|
|
19
|
+
"Programming Language :: Python :: 3.14",
|
|
20
|
+
"Topic :: Software Development :: Libraries",
|
|
21
|
+
]
|
|
22
|
+
dependencies = []
|
|
23
|
+
|
|
24
|
+
[project.urls]
|
|
25
|
+
Homepage = "https://github.com/siliconsociety/blueprint-dsl"
|
|
26
|
+
Repository = "https://github.com/siliconsociety/blueprint-dsl"
|
|
27
|
+
Issues = "https://github.com/siliconsociety/blueprint-dsl/issues"
|
|
28
|
+
|
|
29
|
+
[dependency-groups]
|
|
30
|
+
dev = [
|
|
31
|
+
"pyright>=1.1.411",
|
|
32
|
+
"pytest>=9.1",
|
|
33
|
+
"pytest-cov>=7.0",
|
|
34
|
+
"ruff>=0.14",
|
|
35
|
+
"twine>=6.2",
|
|
36
|
+
]
|
|
37
|
+
|
|
38
|
+
[build-system]
|
|
39
|
+
requires = ["uv_build>=0.9.11,<0.10.0"]
|
|
40
|
+
build-backend = "uv_build"
|
|
41
|
+
|
|
42
|
+
[tool.ruff]
|
|
43
|
+
line-length = 100
|
|
44
|
+
target-version = "py312"
|
|
45
|
+
|
|
46
|
+
[tool.ruff.lint]
|
|
47
|
+
select = ["E", "F", "W", "I", "UP", "B", "SIM"]
|
|
48
|
+
|
|
49
|
+
[tool.pyright]
|
|
50
|
+
include = ["src/blueprint_dsl", "tests"]
|
|
51
|
+
extraPaths = ["src"]
|
|
52
|
+
pythonVersion = "3.12"
|
|
53
|
+
typeCheckingMode = "standard"
|
|
54
|
+
|
|
55
|
+
[tool.pytest.ini_options]
|
|
56
|
+
testpaths = ["tests"]
|
|
57
|
+
filterwarnings = ["error"]
|
|
58
|
+
|
|
59
|
+
[tool.coverage.run]
|
|
60
|
+
source = ["src/blueprint_dsl"]
|
|
61
|
+
branch = true
|
|
62
|
+
|
|
63
|
+
[tool.coverage.report]
|
|
64
|
+
show_missing = true
|
|
65
|
+
fail_under = 88
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Compile Blueprint structured-output contracts to strict JSON Schema."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import version
|
|
4
|
+
|
|
5
|
+
from blueprint_dsl.compiler import (
|
|
6
|
+
BLUEPRINT_DECLARATION_KEYWORDS,
|
|
7
|
+
BLUEPRINT_SPEC_EXAMPLE,
|
|
8
|
+
BLUEPRINT_TYPE_REGISTRY,
|
|
9
|
+
BlueprintTypeInfo,
|
|
10
|
+
CompiledStructuredOutputSchema,
|
|
11
|
+
StructuredOutputDslError,
|
|
12
|
+
blueprint_editor_metadata,
|
|
13
|
+
blueprint_spec_card,
|
|
14
|
+
blueprint_types_by_category,
|
|
15
|
+
compile_structured_output_dsl,
|
|
16
|
+
)
|
|
17
|
+
|
|
18
|
+
__version__ = version("blueprint-dsl")
|
|
19
|
+
BLUEPRINT_LANGUAGE_VERSION = "blueprint/1"
|
|
20
|
+
BLUEPRINT_COMPILER_VERSION = __version__
|
|
21
|
+
|
|
22
|
+
BlueprintCompileError = StructuredOutputDslError
|
|
23
|
+
CompiledBlueprint = CompiledStructuredOutputSchema
|
|
24
|
+
compile_blueprint = compile_structured_output_dsl
|
|
25
|
+
|
|
26
|
+
__all__ = [
|
|
27
|
+
"BLUEPRINT_COMPILER_VERSION",
|
|
28
|
+
"BLUEPRINT_DECLARATION_KEYWORDS",
|
|
29
|
+
"BLUEPRINT_LANGUAGE_VERSION",
|
|
30
|
+
"BLUEPRINT_SPEC_EXAMPLE",
|
|
31
|
+
"BLUEPRINT_TYPE_REGISTRY",
|
|
32
|
+
"BlueprintCompileError",
|
|
33
|
+
"BlueprintTypeInfo",
|
|
34
|
+
"CompiledBlueprint",
|
|
35
|
+
"CompiledStructuredOutputSchema",
|
|
36
|
+
"StructuredOutputDslError",
|
|
37
|
+
"__version__",
|
|
38
|
+
"blueprint_editor_metadata",
|
|
39
|
+
"blueprint_spec_card",
|
|
40
|
+
"blueprint_types_by_category",
|
|
41
|
+
"compile_blueprint",
|
|
42
|
+
"compile_structured_output_dsl",
|
|
43
|
+
]
|