hammad-python 0.0.12__py3-none-any.whl → 0.0.14__py3-none-any.whl

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 (78) hide show
  1. hammad/__init__.py +1 -180
  2. hammad/ai/__init__.py +0 -58
  3. hammad/ai/completions/__init__.py +3 -2
  4. hammad/ai/completions/client.py +84 -129
  5. hammad/ai/completions/create.py +33 -9
  6. hammad/ai/completions/settings.py +100 -0
  7. hammad/ai/completions/types.py +86 -5
  8. hammad/ai/completions/utils.py +112 -0
  9. hammad/ai/embeddings/__init__.py +2 -2
  10. hammad/ai/embeddings/client/fastembed_text_embeddings_client.py +1 -1
  11. hammad/ai/embeddings/client/litellm_embeddings_client.py +1 -1
  12. hammad/ai/embeddings/types.py +4 -4
  13. hammad/cache/__init__.py +13 -21
  14. hammad/cli/__init__.py +2 -2
  15. hammad/cli/animations.py +8 -39
  16. hammad/cli/styles/__init__.py +2 -2
  17. hammad/data/__init__.py +19 -2
  18. hammad/data/collections/__init__.py +2 -2
  19. hammad/data/collections/vector_collection.py +0 -7
  20. hammad/{configuration → data/configurations}/__init__.py +2 -2
  21. hammad/{configuration → data/configurations}/configuration.py +1 -1
  22. hammad/data/databases/__init__.py +2 -2
  23. hammad/data/models/__init__.py +44 -0
  24. hammad/{base → data/models/base}/__init__.py +3 -3
  25. hammad/{pydantic → data/models/pydantic}/__init__.py +28 -16
  26. hammad/{pydantic → data/models/pydantic}/converters.py +11 -2
  27. hammad/{pydantic → data/models/pydantic}/models/__init__.py +3 -3
  28. hammad/{pydantic → data/models/pydantic}/models/arbitrary_model.py +1 -1
  29. hammad/{pydantic → data/models/pydantic}/models/cacheable_model.py +1 -1
  30. hammad/{pydantic → data/models/pydantic}/models/fast_model.py +1 -1
  31. hammad/{pydantic → data/models/pydantic}/models/function_model.py +1 -1
  32. hammad/{pydantic → data/models/pydantic}/models/subscriptable_model.py +1 -1
  33. hammad/data/types/__init__.py +41 -0
  34. hammad/{types → data/types}/file.py +2 -2
  35. hammad/{multimodal → data/types/multimodal}/__init__.py +2 -2
  36. hammad/{multimodal → data/types/multimodal}/audio.py +2 -2
  37. hammad/{multimodal → data/types/multimodal}/image.py +2 -2
  38. hammad/{text → data/types}/text.py +4 -4
  39. hammad/formatting/__init__.py +38 -0
  40. hammad/{json → formatting/json}/__init__.py +3 -3
  41. hammad/{json → formatting/json}/converters.py +2 -2
  42. hammad/{text → formatting/text}/__init__.py +5 -24
  43. hammad/{text → formatting/text}/converters.py +2 -2
  44. hammad/{text → formatting/text}/markdown.py +1 -1
  45. hammad/{yaml → formatting/yaml}/__init__.py +3 -7
  46. hammad/formatting/yaml/converters.py +5 -0
  47. hammad/logging/__init__.py +2 -2
  48. hammad/mcp/__init__.py +50 -0
  49. hammad/mcp/client/__init__.py +1 -0
  50. hammad/mcp/client/client.py +523 -0
  51. hammad/mcp/client/client_service.py +393 -0
  52. hammad/mcp/client/settings.py +178 -0
  53. hammad/mcp/servers/__init__.py +1 -0
  54. hammad/mcp/servers/launcher.py +1161 -0
  55. hammad/performance/__init__.py +36 -0
  56. hammad/{_core/_utils/_import_utils.py → performance/imports.py} +125 -76
  57. hammad/performance/runtime/__init__.py +32 -0
  58. hammad/performance/runtime/decorators.py +142 -0
  59. hammad/performance/runtime/run.py +299 -0
  60. hammad/service/__init__.py +49 -0
  61. hammad/service/create.py +532 -0
  62. hammad/service/decorators.py +285 -0
  63. hammad/web/__init__.py +2 -2
  64. hammad/web/http/client.py +1 -1
  65. hammad/web/openapi/__init__.py +1 -0
  66. {hammad_python-0.0.12.dist-info → hammad_python-0.0.14.dist-info}/METADATA +35 -3
  67. hammad_python-0.0.14.dist-info/RECORD +99 -0
  68. hammad/_core/__init__.py +0 -1
  69. hammad/_core/_utils/__init__.py +0 -4
  70. hammad/multithreading/__init__.py +0 -304
  71. hammad/types/__init__.py +0 -11
  72. hammad/yaml/converters.py +0 -19
  73. hammad_python-0.0.12.dist-info/RECORD +0 -85
  74. /hammad/{base → data/models/base}/fields.py +0 -0
  75. /hammad/{base → data/models/base}/model.py +0 -0
  76. /hammad/{base → data/models/base}/utils.py +0 -0
  77. {hammad_python-0.0.12.dist-info → hammad_python-0.0.14.dist-info}/WHEEL +0 -0
  78. {hammad_python-0.0.12.dist-info → hammad_python-0.0.14.dist-info}/licenses/LICENSE +0 -0
@@ -1,7 +1,7 @@
1
1
  """hammad.data.collections"""
2
2
 
3
3
  from typing import TYPE_CHECKING
4
- from ..._core._utils._import_utils import _auto_create_getattr_loader
4
+ from ...performance.imports import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from .base_collection import BaseCollection
@@ -26,7 +26,7 @@ __all__ = (
26
26
  )
27
27
 
28
28
 
29
- __getattr__ = _auto_create_getattr_loader(__all__)
29
+ __getattr__ = create_getattr_importer(__all__)
30
30
 
31
31
 
32
32
  def __dir__() -> list[str]:
@@ -27,13 +27,6 @@ except ImportError as e:
27
27
  from .base_collection import BaseCollection, Object, Filters, Schema
28
28
  from ...ai.embeddings.create import (
29
29
  create_embeddings,
30
- async_create_embeddings,
31
- )
32
- from ...ai.embeddings.client.fastembed_text_embeddings_client import (
33
- FastEmbedTextEmbeddingModel,
34
- )
35
- from ...ai.embeddings.client.litellm_embeddings_client import (
36
- LiteLlmEmbeddingModel,
37
30
  )
38
31
 
39
32
  __all__ = ("VectorCollection",)
@@ -5,7 +5,7 @@ from various sources.
5
5
  """
6
6
 
7
7
  from typing import TYPE_CHECKING
8
- from .._core._utils._import_utils import _auto_create_getattr_loader
8
+ from ...performance.imports import create_getattr_importer
9
9
 
10
10
  if TYPE_CHECKING:
11
11
  from .configuration import (
@@ -28,7 +28,7 @@ __all__ = (
28
28
  )
29
29
 
30
30
 
31
- __getattr__ = _auto_create_getattr_loader(__all__)
31
+ __getattr__ = create_getattr_importer(__all__)
32
32
 
33
33
 
34
34
  def __dir__() -> list[str]:
@@ -10,7 +10,7 @@ import msgspec
10
10
  import yaml
11
11
 
12
12
  from ..types.file import File, FileSource
13
- from ..base.fields import field
13
+ from ..models.base.fields import field
14
14
 
15
15
  __all__ = (
16
16
  "Configuration",
@@ -1,7 +1,7 @@
1
1
  """hammad.data.databases"""
2
2
 
3
3
  from typing import TYPE_CHECKING
4
- from ..._core._utils._import_utils import _auto_create_getattr_loader
4
+ from ...performance.imports import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from .database import Database, create_database
@@ -13,7 +13,7 @@ __all__ = (
13
13
  )
14
14
 
15
15
 
16
- __getattr__ = _auto_create_getattr_loader(__all__)
16
+ __getattr__ = create_getattr_importer(__all__)
17
17
 
18
18
 
19
19
  def __dir__() -> list[str]:
@@ -0,0 +1,44 @@
1
+ """hammad.data.models
2
+
3
+ Contains **BOTH** resources contains predefined models or base class like
4
+ models, as well as modules & utilities specifically for various interfaces
5
+ of models such as `pydantic`."""
6
+
7
+ from typing import TYPE_CHECKING
8
+ from ...performance.imports import create_getattr_importer
9
+
10
+ if TYPE_CHECKING:
11
+ from .base import (
12
+ Model,
13
+ field,
14
+ validator,
15
+ is_field,
16
+ is_model,
17
+ model_settings
18
+ )
19
+ from .pydantic import (
20
+ convert_to_pydantic_model,
21
+ convert_to_pydantic_field
22
+ )
23
+
24
+
25
+ __all__ = (
26
+ # hammad.models.base
27
+ "Model",
28
+ "field",
29
+ "validator",
30
+ "is_field",
31
+ "is_model",
32
+ "model_settings",
33
+
34
+ # hammad.models.pydantic
35
+ "convert_to_pydantic_model",
36
+ "convert_to_pydantic_field",
37
+ )
38
+
39
+
40
+ __getattr__ = create_getattr_importer(__all__)
41
+
42
+
43
+ def __dir__() -> list[str]:
44
+ return list(__all__)
@@ -1,11 +1,11 @@
1
- """hammad.base
1
+ """hammad.models.base
2
2
 
3
3
  Contains the `Model` and `field` system along with an assortment
4
4
  of various utilities for interacting and managing these objects.
5
5
  """
6
6
 
7
7
  from typing import TYPE_CHECKING
8
- from .._core._utils._import_utils import _auto_create_getattr_loader
8
+ from ....performance.imports import create_getattr_importer
9
9
 
10
10
  if TYPE_CHECKING:
11
11
  from .model import Model, model_settings
@@ -28,7 +28,7 @@ __all__ = (
28
28
  "get_field_info",
29
29
  )
30
30
 
31
- __getattr__ = _auto_create_getattr_loader(__all__)
31
+ __getattr__ = create_getattr_importer(__all__)
32
32
 
33
33
 
34
34
  def __dir__() -> list[str]:
@@ -1,43 +1,55 @@
1
- """hammad.pydantic
1
+ """hammad.models.pydantic
2
2
 
3
3
  Contains both models and pydantic **specific** utiltiies / resources
4
4
  meant for general case usage."""
5
5
 
6
6
  from typing import TYPE_CHECKING
7
- from .._core._utils._import_utils import _auto_create_getattr_loader
7
+ from ....performance.imports import create_getattr_importer
8
8
 
9
9
  if TYPE_CHECKING:
10
+ from .models import (
11
+ ArbitraryModel,
12
+ CacheableModel,
13
+ FastModel,
14
+ FunctionModel,
15
+ SubscriptableModel,
16
+ )
10
17
  from .converters import (
11
18
  convert_to_pydantic_model,
12
19
  convert_to_pydantic_field,
20
+ convert_dataclass_to_pydantic_model,
21
+ convert_dict_to_pydantic_model,
22
+ convert_function_to_pydantic_model,
23
+ convert_sequence_to_pydantic_model,
24
+ convert_type_to_pydantic_model,
13
25
  create_confirmation_pydantic_model,
14
26
  create_selection_pydantic_model,
15
27
  )
16
- from .models import (
17
- FastModel,
18
- FunctionModel,
19
- ArbitraryModel,
20
- CacheableModel,
21
- SubscriptableModel,
22
- )
23
28
 
24
29
 
25
30
  __all__ = (
31
+ # hammad.models.pydantic.models
32
+ "ArbitraryModel",
33
+ "CacheableModel",
34
+ "FastModel",
35
+ "FunctionModel",
36
+ "SubscriptableModel",
37
+ # hammad.models.pydantic.converters
26
38
  "convert_to_pydantic_model",
27
39
  "convert_to_pydantic_field",
40
+ "convert_dataclass_to_pydantic_model",
41
+ "convert_dict_to_pydantic_model",
42
+ "convert_function_to_pydantic_model",
43
+ "convert_sequence_to_pydantic_model",
44
+ "convert_type_to_pydantic_model",
28
45
  "create_confirmation_pydantic_model",
29
46
  "create_selection_pydantic_model",
30
- "FastModel",
31
- "FunctionModel",
32
- "ArbitraryModel",
33
- "CacheableModel",
34
- "SubscriptableModel",
35
47
  )
36
48
 
37
49
 
38
- __getattr__ = _auto_create_getattr_loader(__all__)
50
+ __getattr__ = create_getattr_importer(__all__)
39
51
 
40
52
 
41
53
  def __dir__() -> list[str]:
42
- """Get the attributes of the pydantic module."""
54
+ """Get the attributes of the models module."""
43
55
  return list(__all__)
@@ -1,4 +1,4 @@
1
- """hammad.utils.pydantic.converters
1
+ """hammad.data.models.pydantic.converters
2
2
 
3
3
  Contains various converters for converting various objects into
4
4
  a Pydantic model. These converters are used to convert
@@ -28,7 +28,10 @@ from typing import (
28
28
  )
29
29
  from pydantic import BaseModel, Field, create_model
30
30
 
31
- from ..cache.decorators import cached
31
+ from ....cache.decorators import cached
32
+
33
+ from typing import get_origin, get_args
34
+ from typing_inspect import is_generic_type
32
35
 
33
36
  logger = logging.getLogger(__name__)
34
37
 
@@ -518,6 +521,12 @@ def convert_to_pydantic_model(
518
521
  description=description,
519
522
  )
520
523
 
524
+ # Handle generic types (like list[str], dict[str, int], etc.)
525
+ if is_generic_type(target) or get_origin(target) is not None:
526
+ return convert_type_to_pydantic_model(
527
+ target, name, description, field_name, default
528
+ )
529
+
521
530
  # Handle standard Python types (int, str, etc.)
522
531
  if isinstance(target, type):
523
532
  return convert_type_to_pydantic_model(
@@ -1,7 +1,7 @@
1
- """hammad.pydantic.models"""
1
+ """hammad.data.models.pydantic.models"""
2
2
 
3
3
  from typing import TYPE_CHECKING
4
- from ..._core._utils._import_utils import _auto_create_getattr_loader
4
+ from .....performance.imports import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from .arbitrary_model import ArbitraryModel
@@ -20,7 +20,7 @@ __all__ = (
20
20
  )
21
21
 
22
22
 
23
- __getattr__ = _auto_create_getattr_loader(__all__)
23
+ __getattr__ = create_getattr_importer(__all__)
24
24
 
25
25
 
26
26
  def __dir__() -> list[str]:
@@ -1,4 +1,4 @@
1
- """hammad.pydantic.models.arbitrary_model"""
1
+ """hammad.data.models.pydantic.models.arbitrary_model"""
2
2
 
3
3
  from typing import Any, Dict
4
4
  from pydantic import ConfigDict
@@ -1,4 +1,4 @@
1
- """hammad.pydantic.models.cacheable_model"""
1
+ """hammad.data.models.pydantic.models.cacheable_model"""
2
2
 
3
3
  from typing import Any, Callable, Dict, Optional
4
4
  from functools import wraps
@@ -1,4 +1,4 @@
1
- """hammad.pydantic.models.fast_model"""
1
+ """hammad.data.models.pydantic.models.fast_model"""
2
2
 
3
3
  from typing import Any, Callable, Dict, List, Optional, Set, Tuple, TypeVar, Generic
4
4
  from pydantic import BaseModel, ConfigDict
@@ -1,4 +1,4 @@
1
- """hammad.pydantic.models.function_model"""
1
+ """hammad.data.models.pydantic.models.function_model"""
2
2
 
3
3
  from typing import Any, Callable, Dict, List, Optional, TypeVar, Generic, cast
4
4
  from pydantic import BaseModel
@@ -1,4 +1,4 @@
1
- """hammad.pydantic.models.subscriptable_model"""
1
+ """hammad.data.models.pydantic.models.subscriptable_model"""
2
2
 
3
3
  from pydantic import BaseModel
4
4
  from typing import Any
@@ -0,0 +1,41 @@
1
+ """hammad.data.types
2
+
3
+ Contains functional alias, or model-like objects that are meant to be used
4
+ by users as bases as well as for type hints. These objects define simple
5
+ interfaces for various types of common objects."""
6
+
7
+ from typing import TYPE_CHECKING
8
+ from ...performance.imports import create_getattr_importer
9
+
10
+
11
+ if TYPE_CHECKING:
12
+ from .text import (
13
+ BaseText,
14
+ Text,
15
+ )
16
+ from .file import File
17
+ from .multimodal import (
18
+ Audio,
19
+ Image,
20
+ )
21
+
22
+
23
+ __all__ = (
24
+ # hammad.data.types.text
25
+ "BaseText",
26
+ "Text",
27
+
28
+ # hammad.data.types.file
29
+ "File",
30
+
31
+ # hammad.data.types.multimodal
32
+ "Audio",
33
+ "Image",
34
+ )
35
+
36
+
37
+ __getattr__ = create_getattr_importer(__all__)
38
+
39
+
40
+ def __dir__() -> list[str]:
41
+ return list(__all__)
@@ -6,8 +6,8 @@ from typing import Any, Self
6
6
  import mimetypes
7
7
  from urllib.parse import urlparse
8
8
 
9
- from ..base.model import Model
10
- from ..base.fields import field
9
+ from ..models.base.model import Model
10
+ from ..models.base.fields import field
11
11
 
12
12
  __all__ = ("File", "FileSource")
13
13
 
@@ -4,7 +4,7 @@ Contains types and model like objects for working with various
4
4
  types of multimodal data."""
5
5
 
6
6
  from typing import TYPE_CHECKING
7
- from .._core._utils._import_utils import _auto_create_getattr_loader
7
+ from ....performance.imports import create_getattr_importer
8
8
 
9
9
  if TYPE_CHECKING:
10
10
  from .image import Image
@@ -17,7 +17,7 @@ __all__ = (
17
17
  )
18
18
 
19
19
 
20
- __getattr__ = _auto_create_getattr_loader(__all__)
20
+ __getattr__ = create_getattr_importer(__all__)
21
21
 
22
22
 
23
23
  def __dir__() -> list[str]:
@@ -3,8 +3,8 @@
3
3
  import httpx
4
4
  from typing import Self
5
5
 
6
- from ..types.file import File, FileSource
7
- from ..base.fields import field
6
+ from ...types.file import File, FileSource
7
+ from ...models.base.fields import field
8
8
 
9
9
  __all__ = ("Audio",)
10
10
 
@@ -3,8 +3,8 @@
3
3
  import httpx
4
4
  from typing import Self
5
5
 
6
- from ..types.file import File, FileSource
7
- from ..base.fields import field
6
+ from ...types.file import File, FileSource
7
+ from ...models.base.fields import field
8
8
 
9
9
  __all__ = ("Image",)
10
10
 
@@ -1,4 +1,4 @@
1
- """hammad.text
1
+ """hammad.types.text
2
2
 
3
3
  Contains the `BaseText` type, which is a functional type & object
4
4
  for created intelligently rendered strings and markdown strings
@@ -25,11 +25,11 @@ from typing import (
25
25
  Generic,
26
26
  )
27
27
 
28
- from .markdown import (
28
+ from ...formatting.text.markdown import (
29
29
  markdown_heading,
30
30
  markdown_code_block,
31
31
  )
32
- from .converters import convert_to_text
32
+ from ...formatting.text.converters import convert_to_text
33
33
 
34
34
 
35
35
  # -----------------------------------------------------------------------------
@@ -269,7 +269,7 @@ class BaseText(ABC):
269
269
  toc_headings.append((section.heading_level, section.title))
270
270
 
271
271
  if toc_headings:
272
- from .markdown import markdown_table
272
+ from ...formatting.text.markdown import markdown_table
273
273
 
274
274
  parts.append(markdown_table(toc_headings))
275
275
 
@@ -0,0 +1,38 @@
1
+ """hammad.formatting
2
+
3
+ Contains resources for working with various data structures and formats
4
+ such as JSON, YAML, and text / markdown formatting."""
5
+
6
+ from typing import TYPE_CHECKING
7
+ from ..performance.imports import create_getattr_importer
8
+
9
+
10
+ if TYPE_CHECKING:
11
+ from .json import (
12
+ convert_to_json_schema,
13
+ encode_json,
14
+ decode_json,
15
+ )
16
+ from .yaml import (
17
+ encode_yaml,
18
+ decode_yaml,
19
+ )
20
+
21
+
22
+ __all__ = (
23
+ # hammad.formatting.json
24
+ "convert_to_json_schema",
25
+ "encode_json",
26
+ "decode_json",
27
+ # hammad.formatting.yaml
28
+ "encode_yaml",
29
+ "decode_yaml",
30
+ )
31
+
32
+
33
+ __getattr__ = create_getattr_importer(__all__)
34
+
35
+
36
+ def __dir__() -> list[str]:
37
+ """Get the attributes of the formatting module."""
38
+ return list(__all__)
@@ -1,7 +1,7 @@
1
- """hammad.utils.json"""
1
+ """hammad.formatting.json"""
2
2
 
3
3
  from typing import TYPE_CHECKING
4
- from .._core._utils._import_utils import _auto_create_getattr_loader
4
+ from ...performance.imports import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from .converters import (
@@ -13,7 +13,7 @@ if TYPE_CHECKING:
13
13
  __all__ = ("convert_to_json_schema", "encode_json", "decode_json")
14
14
 
15
15
 
16
- __getattr__ = _auto_create_getattr_loader(__all__)
16
+ __getattr__ = create_getattr_importer(__all__)
17
17
 
18
18
 
19
19
  def __dir__() -> list[str]:
@@ -1,4 +1,4 @@
1
- """hammad.utils.json.utils
1
+ """hammad.formatting.json.utils
2
2
 
3
3
  Contains various utility functions used when working with JSON data."""
4
4
 
@@ -7,7 +7,7 @@ from typing import Any
7
7
  import msgspec
8
8
  from msgspec.json import encode as encode_json, decode as decode_json
9
9
 
10
- from ..typing import get_type_description, inspection
10
+ from ...typing import get_type_description, inspection # type: ignore
11
11
 
12
12
  __all__ = (
13
13
  "SchemaError",
@@ -1,7 +1,9 @@
1
- """hammad.text"""
1
+ """hammad.formatting.text
2
+
3
+ Contains resources for working with text / markdown formatting."""
2
4
 
3
5
  from typing import TYPE_CHECKING
4
- from .._core._utils._import_utils import _auto_create_getattr_loader
6
+ from ...performance.imports import create_getattr_importer
5
7
 
6
8
  if TYPE_CHECKING:
7
9
  from .converters import (
@@ -27,17 +29,6 @@ if TYPE_CHECKING:
27
29
  markdown_table,
28
30
  markdown_table_row,
29
31
  )
30
- from .text import (
31
- BaseText,
32
- Text,
33
- OutputText,
34
- OutputFormat,
35
- HeadingStyle,
36
- CodeSection,
37
- SimpleText,
38
- SchemaSection,
39
- UserResponse,
40
- )
41
32
 
42
33
 
43
34
  __all__ = (
@@ -62,20 +53,10 @@ __all__ = (
62
53
  "markdown_list_item",
63
54
  "markdown_table",
64
55
  "markdown_table_row",
65
- # hammad.text.text
66
- "BaseText",
67
- "Text",
68
- "OutputText",
69
- "OutputFormat",
70
- "HeadingStyle",
71
- "CodeSection",
72
- "SimpleText",
73
- "SchemaSection",
74
- "UserResponse",
75
56
  )
76
57
 
77
58
 
78
- __getattr__ = _auto_create_getattr_loader(__all__)
59
+ __getattr__ = create_getattr_importer(__all__)
79
60
 
80
61
 
81
62
  def __dir__() -> list[str]:
@@ -1,4 +1,4 @@
1
- """hammad.text.utils.converters"""
1
+ """hammad.formatting.text.converters"""
2
2
 
3
3
  import json
4
4
  import logging
@@ -15,7 +15,7 @@ from typing import (
15
15
  Union,
16
16
  )
17
17
 
18
- from ..typing import (
18
+ from ...typing import (
19
19
  inspection,
20
20
  is_pydantic_basemodel,
21
21
  is_msgspec_struct,
@@ -1,4 +1,4 @@
1
- """hammad.text.utils.markdown"""
1
+ """hammad.formatting.text.markdown"""
2
2
 
3
3
  from typing import (
4
4
  List,
@@ -1,28 +1,24 @@
1
- """hammad.yaml
1
+ """hammad.formatting.yaml
2
2
 
3
3
  Simply extends the `msgspec.yaml` submodule."""
4
4
 
5
5
  from typing import TYPE_CHECKING
6
- from .._core._utils._import_utils import _auto_create_getattr_loader
6
+ from ...performance.imports import create_getattr_importer
7
7
 
8
8
  if TYPE_CHECKING:
9
9
  from .converters import (
10
- Yaml,
11
10
  encode_yaml,
12
11
  decode_yaml,
13
- read_yaml_file,
14
12
  )
15
13
 
16
14
 
17
15
  __all__ = (
18
- "Yaml",
19
16
  "encode_yaml",
20
17
  "decode_yaml",
21
- "read_yaml_file",
22
18
  )
23
19
 
24
20
 
25
- __getattr__ = _auto_create_getattr_loader(__all__)
21
+ __getattr__ = create_getattr_importer(__all__)
26
22
 
27
23
 
28
24
  def __dir__() -> list[str]:
@@ -0,0 +1,5 @@
1
+ """hammad.formatting.yaml.converters"""
2
+
3
+ from msgspec.yaml import encode as encode_yaml, decode as decode_yaml
4
+
5
+ __all__ = ("encode_yaml", "decode_yaml")
@@ -1,7 +1,7 @@
1
1
  """hammad.logging"""
2
2
 
3
3
  from typing import TYPE_CHECKING
4
- from .._core._utils._import_utils import _auto_create_getattr_loader
4
+ from ..performance.imports import create_getattr_importer
5
5
 
6
6
  if TYPE_CHECKING:
7
7
  from .logger import Logger, create_logger, create_logger_level, LoggerLevelName
@@ -27,7 +27,7 @@ __all__ = (
27
27
  )
28
28
 
29
29
 
30
- __getattr__ = _auto_create_getattr_loader(__all__)
30
+ __getattr__ = create_getattr_importer(__all__)
31
31
 
32
32
 
33
33
  def __dir__() -> list[str]: