schemez 1.2.2__tar.gz → 1.2.3__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 (25) hide show
  1. {schemez-1.2.2 → schemez-1.2.3}/PKG-INFO +1 -1
  2. {schemez-1.2.2 → schemez-1.2.3}/pyproject.toml +1 -1
  3. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/functionschema.py +7 -9
  4. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/helpers.py +5 -38
  5. {schemez-1.2.2 → schemez-1.2.3}/LICENSE +0 -0
  6. {schemez-1.2.2 → schemez-1.2.3}/README.md +0 -0
  7. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/__init__.py +0 -0
  8. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/bind_kwargs.py +0 -0
  9. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/code.py +0 -0
  10. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/convert.py +0 -0
  11. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/create_type.py +0 -0
  12. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/docstrings.py +0 -0
  13. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/executable.py +0 -0
  14. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/log.py +0 -0
  15. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/py.typed +0 -0
  16. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/pydantic_types.py +0 -0
  17. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/schema.py +0 -0
  18. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/schema_generators.py +0 -0
  19. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/schemadef/__init__.py +0 -0
  20. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/schemadef/schemadef.py +0 -0
  21. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/tool_executor/__init__.py +0 -0
  22. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/tool_executor/executor.py +0 -0
  23. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/tool_executor/helpers.py +0 -0
  24. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/tool_executor/types.py +0 -0
  25. {schemez-1.2.2 → schemez-1.2.3}/src/schemez/typedefs.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: schemez
3
- Version: 1.2.2
3
+ Version: 1.2.3
4
4
  Summary: Pydantic shim for config stuff
5
5
  Keywords:
6
6
  Author: Philipp Temminghoff
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "schemez"
3
- version = "1.2.2"
3
+ version = "1.2.3"
4
4
  description = "Pydantic shim for config stuff"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.13"
@@ -119,6 +119,9 @@ class FunctionSchema(pydantic.BaseModel):
119
119
  required = self.parameters.get("required", self.required)
120
120
 
121
121
  for name, details in properties.items():
122
+ if name.startswith("_"): # TODO: kwarg for renaming instead perhaps?
123
+ logger.debug("Skipping parameter %s due to leading underscore", name)
124
+ continue
122
125
  # Get base type
123
126
  if "enum" in details:
124
127
  values = tuple(details["enum"]) # type: ignore
@@ -246,19 +249,14 @@ class FunctionSchema(pydantic.BaseModel):
246
249
  RuntimeError: If datamodel-codegen is not available
247
250
  subprocess.CalledProcessError: If code generation fails
248
251
  """
252
+ import shutil
249
253
  import subprocess
250
254
  import tempfile
251
255
 
252
- try:
253
- # Check if datamodel-codegen is available
254
- subprocess.run(
255
- ["datamodel-codegen", "--version"],
256
- check=True,
257
- capture_output=True,
258
- )
259
- except (subprocess.CalledProcessError, FileNotFoundError) as e:
256
+ # Check if datamodel-codegen is available
257
+ if not shutil.which("datamodel-codegen"):
260
258
  msg = "datamodel-codegen not available"
261
- raise RuntimeError(msg) from e
259
+ raise RuntimeError(msg)
262
260
 
263
261
  name = class_name or f"{self.name.title()}Response"
264
262
 
@@ -6,6 +6,7 @@ import asyncio
6
6
  import importlib
7
7
  import os
8
8
  from pathlib import Path
9
+ import shutil
9
10
  import subprocess
10
11
  import sys
11
12
  import tempfile
@@ -177,42 +178,6 @@ def resolve_type_string(type_string: str, safe: bool = True) -> type:
177
178
  raise ValueError(msg) from e
178
179
 
179
180
 
180
- async def _detect_command(command: str, *, test_flag: str = "--version") -> list[str]:
181
- """Detect the correct command prefix for running a command.
182
-
183
- Tries 'uv run' first, then falls back to direct execution.
184
-
185
- Args:
186
- command: The command to detect
187
- test_flag: Flag to test command availability with
188
-
189
- Returns:
190
- Command prefix list (empty for direct execution)
191
-
192
- Raises:
193
- RuntimeError: If command is not available
194
- """
195
- cmd_prefixes = [["uv", "run"], []]
196
-
197
- for prefix in cmd_prefixes:
198
- try:
199
- proc = await asyncio.create_subprocess_exec(
200
- *prefix,
201
- command,
202
- test_flag,
203
- stdout=asyncio.subprocess.PIPE,
204
- stderr=asyncio.subprocess.PIPE,
205
- )
206
- await proc.communicate()
207
- if proc.returncode == 0:
208
- return prefix
209
- except FileNotFoundError:
210
- continue
211
-
212
- msg = f"{command} not available (tried both 'uv run' and direct execution)"
213
- raise RuntimeError(msg)
214
-
215
-
216
181
  async def model_to_python_code(
217
182
  model: type[BaseModel] | dict[str, Any],
218
183
  *,
@@ -236,7 +201,10 @@ async def model_to_python_code(
236
201
  RuntimeError: If datamodel-codegen is not available
237
202
  subprocess.CalledProcessError: If code generation fails
238
203
  """
239
- working_prefix = await _detect_command("datamodel-codegen")
204
+ # Check if datamodel-codegen is available
205
+ if not shutil.which("datamodel-codegen"):
206
+ msg = "datamodel-codegen not available"
207
+ raise RuntimeError(msg)
240
208
 
241
209
  if isinstance(model, dict):
242
210
  schema = model
@@ -271,7 +239,6 @@ async def model_to_python_code(
271
239
 
272
240
  try: # Generate model using datamodel-codegen
273
241
  proc = await asyncio.create_subprocess_exec(
274
- *working_prefix,
275
242
  "datamodel-codegen",
276
243
  *args,
277
244
  stdout=asyncio.subprocess.PIPE,
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