string-schema 0.1.3__tar.gz → 0.1.5__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.
Files changed (42) hide show
  1. {string_schema-0.1.3/string_schema.egg-info → string_schema-0.1.5}/PKG-INFO +1 -1
  2. {string_schema-0.1.3 → string_schema-0.1.5}/pyproject.toml +7 -1
  3. {string_schema-0.1.3 → string_schema-0.1.5}/setup.py +1 -1
  4. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/integrations/pydantic.py +13 -13
  5. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/utilities.py +3 -3
  6. {string_schema-0.1.3 → string_schema-0.1.5/string_schema.egg-info}/PKG-INFO +1 -1
  7. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema.egg-info/SOURCES.txt +19 -0
  8. {string_schema-0.1.3 → string_schema-0.1.5}/LICENSE +0 -0
  9. {string_schema-0.1.3 → string_schema-0.1.5}/MANIFEST.in +0 -0
  10. {string_schema-0.1.3 → string_schema-0.1.5}/README.md +0 -0
  11. {string_schema-0.1.3 → string_schema-0.1.5}/docs/README.md +0 -0
  12. {string_schema-0.1.3 → string_schema-0.1.5}/docs/advanced-usage.md +0 -0
  13. {string_schema-0.1.3 → string_schema-0.1.5}/docs/api-reference.md +0 -0
  14. {string_schema-0.1.3 → string_schema-0.1.5}/docs/examples.md +0 -0
  15. {string_schema-0.1.3 → string_schema-0.1.5}/docs/faq.md +0 -0
  16. {string_schema-0.1.3 → string_schema-0.1.5}/docs/getting-started.md +0 -0
  17. {string_schema-0.1.3 → string_schema-0.1.5}/docs/pydantic-utilities.md +0 -0
  18. {string_schema-0.1.3 → string_schema-0.1.5}/docs/string-syntax.md +0 -0
  19. {string_schema-0.1.3 → string_schema-0.1.5}/docs/troubleshooting.md +0 -0
  20. {string_schema-0.1.3 → string_schema-0.1.5}/examples/demo.py +0 -0
  21. {string_schema-0.1.3 → string_schema-0.1.5}/examples/pydantic_utility_demo.py +0 -0
  22. {string_schema-0.1.3 → string_schema-0.1.5}/setup.cfg +0 -0
  23. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/__init__.py +0 -0
  24. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/core/__init__.py +0 -0
  25. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/core/builders.py +0 -0
  26. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/core/fields.py +0 -0
  27. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/core/validators.py +0 -0
  28. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/examples/__init__.py +0 -0
  29. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/examples/presets.py +0 -0
  30. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/examples/recipes.py +0 -0
  31. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/integrations/__init__.py +0 -0
  32. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/integrations/json_schema.py +0 -0
  33. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/integrations/openapi.py +0 -0
  34. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/integrations/reverse.py +0 -0
  35. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/parsing/__init__.py +0 -0
  36. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/parsing/optimizer.py +0 -0
  37. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/parsing/string_parser.py +0 -0
  38. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/parsing/syntax.py +0 -0
  39. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema/py.typed +0 -0
  40. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema.egg-info/dependency_links.txt +0 -0
  41. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema.egg-info/requires.txt +0 -0
  42. {string_schema-0.1.3 → string_schema-0.1.5}/string_schema.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: string-schema
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: A simple, LLM-friendly schema definition library for converting string syntax to structured schemas
5
5
  Home-page: https://github.com/xychenmsn/string-schema
6
6
  Author: Michael Chen
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "string-schema"
7
- version = "0.1.3"
7
+ version = "0.1.5"
8
8
  description = "A simple, LLM-friendly schema definition library for converting string syntax to structured schemas"
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -64,6 +64,12 @@ include = ["string_schema*"]
64
64
  [tool.setuptools.package-data]
65
65
  string_schema = ["py.typed"]
66
66
 
67
+ [tool.setuptools]
68
+ include-package-data = true
69
+
70
+ [tool.setuptools.package-dir]
71
+ "" = "."
72
+
67
73
  [tool.black]
68
74
  line-length = 100
69
75
  target-version = ['py311', 'py312', 'py313']
@@ -9,7 +9,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
9
9
 
10
10
  setup(
11
11
  name="string-schema",
12
- version="0.1.3",
12
+ version="0.1.5",
13
13
  author="Michael Chen",
14
14
  author_email="xychen@msn.com",
15
15
  description="A simple, LLM-friendly schema definition library for converting string syntax to structured schemas",
@@ -111,41 +111,41 @@ def _simple_field_to_pydantic(field: SimpleField) -> tuple:
111
111
 
112
112
 
113
113
  # New consistent naming
114
- def json_schema_to_model(name: str, json_schema: Dict[str, Any]) -> Type[BaseModel]:
114
+ def json_schema_to_model(json_schema: Dict[str, Any], name: str) -> Type[BaseModel]:
115
115
  """
116
116
  Create Pydantic model from JSON Schema dictionary.
117
117
 
118
118
  Args:
119
- name: Name of the model class
120
119
  json_schema: JSON Schema dictionary
120
+ name: Name of the model class
121
121
 
122
122
  Returns:
123
123
  Dynamically created Pydantic model class
124
124
 
125
125
  Example:
126
- UserModel = json_schema_to_model('User', json_schema)
126
+ UserModel = json_schema_to_model(json_schema, 'User')
127
127
  """
128
- return create_pydantic_from_json_schema(name, json_schema)
128
+ return create_pydantic_from_json_schema(json_schema, name)
129
129
 
130
130
 
131
131
  # Legacy alias for backward compatibility
132
- def json_schema_to_pydantic(name: str, json_schema: Dict[str, Any]) -> Type[BaseModel]:
132
+ def json_schema_to_pydantic(json_schema: Dict[str, Any], name: str) -> Type[BaseModel]:
133
133
  """
134
134
  Create Pydantic model from JSON Schema dictionary.
135
135
 
136
136
  DEPRECATED: Use json_schema_to_model() instead for consistent naming.
137
137
  """
138
- return json_schema_to_model(name, json_schema)
138
+ return json_schema_to_model(json_schema, name)
139
139
 
140
140
 
141
- def create_pydantic_from_json_schema(name: str, json_schema: Dict[str, Any]) -> Type[BaseModel]:
141
+ def create_pydantic_from_json_schema(json_schema: Dict[str, Any], name: str) -> Type[BaseModel]:
142
142
  """
143
143
  Create Pydantic model from JSON Schema.
144
-
144
+
145
145
  Args:
146
- name: Name of the model class
147
146
  json_schema: JSON Schema dictionary
148
-
147
+ name: Name of the model class
148
+
149
149
  Returns:
150
150
  Dynamically created Pydantic model class
151
151
  """
@@ -184,7 +184,7 @@ def _json_schema_to_pydantic_field(field_schema: Dict[str, Any], required: bool
184
184
  python_type = TypingUnion[tuple(union_types)]
185
185
  elif field_schema.get('type') == 'object':
186
186
  # Handle nested objects by creating a nested Pydantic model
187
- nested_model = create_pydantic_from_json_schema(f"{parent_name}Nested", field_schema)
187
+ nested_model = create_pydantic_from_json_schema(field_schema, f"{parent_name}Nested")
188
188
  python_type = nested_model
189
189
  elif field_schema.get('type') == 'array':
190
190
  # Handle arrays
@@ -192,7 +192,7 @@ def _json_schema_to_pydantic_field(field_schema: Dict[str, Any], required: bool
192
192
  if items_schema.get('type') == 'object':
193
193
  # Array of objects
194
194
  from typing import List
195
- item_model = create_pydantic_from_json_schema(f"{parent_name}Item", items_schema)
195
+ item_model = create_pydantic_from_json_schema(items_schema, f"{parent_name}Item")
196
196
  python_type = List[item_model]
197
197
  else:
198
198
  # Array of primitives
@@ -441,7 +441,7 @@ def _string_to_model_with_name(name: str, schema_str: str) -> Type[BaseModel]:
441
441
 
442
442
  # Convert string to JSON Schema, then to Pydantic
443
443
  json_schema = parse_string_schema(schema_str)
444
- return create_pydantic_from_json_schema(name, json_schema)
444
+ return create_pydantic_from_json_schema(json_schema, name)
445
445
 
446
446
 
447
447
  # Legacy alias for backward compatibility
@@ -93,7 +93,7 @@ def string_to_model(schema_str: str, name: Optional[str] = None) -> Type[BaseMod
93
93
  if items_schema.get('type') == 'object':
94
94
  # Array of objects: create nested model for items
95
95
  from .integrations.pydantic import create_pydantic_from_json_schema
96
- ItemModel = create_pydantic_from_json_schema(f"{name}Item", items_schema)
96
+ ItemModel = create_pydantic_from_json_schema(items_schema, f"{name}Item")
97
97
 
98
98
  # Create the array model using RootModel
99
99
  class ArrayModel(RootModel[List[ItemModel]]):
@@ -125,7 +125,7 @@ def string_to_model(schema_str: str, name: Optional[str] = None) -> Type[BaseMod
125
125
  if items_schema.get('type') == 'object':
126
126
  # Array of objects: create nested model for items
127
127
  from .integrations.pydantic import create_pydantic_from_json_schema
128
- ItemModel = create_pydantic_from_json_schema(f"{name}Item", items_schema)
128
+ ItemModel = create_pydantic_from_json_schema(items_schema, f"{name}Item")
129
129
 
130
130
  # Create constraints for the array
131
131
  constraints = {}
@@ -159,7 +159,7 @@ def string_to_model(schema_str: str, name: Optional[str] = None) -> Type[BaseMod
159
159
  else:
160
160
  # Regular object schema
161
161
  from .integrations.pydantic import create_pydantic_from_json_schema
162
- return create_pydantic_from_json_schema(name, json_schema)
162
+ return create_pydantic_from_json_schema(json_schema, name)
163
163
 
164
164
  except Exception as e:
165
165
  raise ValueError(f"Failed to create model from schema '{schema_str}': {str(e)}") from e
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: string-schema
3
- Version: 0.1.3
3
+ Version: 0.1.5
4
4
  Summary: A simple, LLM-friendly schema definition library for converting string syntax to structured schemas
5
5
  Home-page: https://github.com/xychenmsn/string-schema
6
6
  Author: Michael Chen
@@ -3,6 +3,25 @@ MANIFEST.in
3
3
  README.md
4
4
  pyproject.toml
5
5
  setup.py
6
+ ./string_schema/__init__.py
7
+ ./string_schema/py.typed
8
+ ./string_schema/utilities.py
9
+ ./string_schema/core/__init__.py
10
+ ./string_schema/core/builders.py
11
+ ./string_schema/core/fields.py
12
+ ./string_schema/core/validators.py
13
+ ./string_schema/examples/__init__.py
14
+ ./string_schema/examples/presets.py
15
+ ./string_schema/examples/recipes.py
16
+ ./string_schema/integrations/__init__.py
17
+ ./string_schema/integrations/json_schema.py
18
+ ./string_schema/integrations/openapi.py
19
+ ./string_schema/integrations/pydantic.py
20
+ ./string_schema/integrations/reverse.py
21
+ ./string_schema/parsing/__init__.py
22
+ ./string_schema/parsing/optimizer.py
23
+ ./string_schema/parsing/string_parser.py
24
+ ./string_schema/parsing/syntax.py
6
25
  docs/README.md
7
26
  docs/advanced-usage.md
8
27
  docs/api-reference.md
File without changes
File without changes
File without changes
File without changes
File without changes