yumly 0.8.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.
yumly-0.8.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rubanana
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.
yumly-0.8.0/PKG-INFO ADDED
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: yumly
3
+ Version: 0.8.0
4
+ Summary: A cute, declarative config language with fail-fast behavior and optional type safety.
5
+ Author-email: Yumene <yumene@yume.dev.br>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 rubanana
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/Creeper011/Yumly
28
+ Project-URL: Bug Tracker, https://github.com/Creeper011/Yumly/issues
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Dynamic: license-file
@@ -0,0 +1,4 @@
1
+ from .yumly import Yumly
2
+ from .yumly_error import YumlyError
3
+
4
+ __all__ = ["Yumly", "YumlyError"]
@@ -0,0 +1,90 @@
1
+ from pathlib import Path
2
+ from typing import Any, Union, IO
3
+ from contextlib import contextmanager
4
+ from . import libyumly # type: ignore
5
+ from .yumly_error import YumlyError
6
+
7
+ __all__ = ["Yumly", "YumlyError"]
8
+
9
+ FALLBACK_MESSAGE = "Oh no.. an unexpected error occurred.. :( the Yumly parser failed"
10
+ FALLBACK_VALUE_MESSAGE = "Oh no.. an unexpected error occurred.. :( invalid result structure"
11
+
12
+ class Yumly():
13
+ """Yumly is a configuration file format designed to be a mix of YAML and JSON with type safety."""
14
+
15
+ def load(self, path: Union[str, Path]) -> dict[str, Any]:
16
+ """Load data from a yumly file"""
17
+ path_obj = Path(path)
18
+ return self._parse_file(path_obj)
19
+
20
+ def loads(self, yuml_data: str, working_dir: str = ".") -> dict[str, Any]:
21
+ """Load data from a yumly content string"""
22
+ return self._parse_content(yuml_data, working_dir)
23
+
24
+ def validate_content(self, yuml_data: str) -> bool:
25
+ """Validate raw yumly content string (this skips the resolving of env vars and includes)"""
26
+ try:
27
+ msg = libyumly.validateContentMsg(yuml_data)
28
+ if msg:
29
+ raise YumlyError(msg)
30
+ except YumlyError:
31
+ raise
32
+ except Exception as exc:
33
+ msg = str(exc).strip() or FALLBACK_MESSAGE
34
+ raise YumlyError(msg) from exc
35
+
36
+ return True
37
+
38
+ def validate_file(self, path: Union[str, Path]) -> bool:
39
+ """Validate a yumly file (this skips the resolving of env vars and includes)"""
40
+ path_str = str(Path(path).resolve())
41
+ try:
42
+ msg = libyumly.validateFileMsg(path_str)
43
+ if msg:
44
+ raise YumlyError(msg)
45
+ except YumlyError:
46
+ raise
47
+ except Exception as exc:
48
+ msg = str(exc).strip() or FALLBACK_MESSAGE
49
+ raise YumlyError(msg) from exc
50
+
51
+ return True
52
+
53
+ def _parse_file(self, path: Path) -> dict[str, Any]:
54
+ path_str = str(Path(path).resolve())
55
+ try:
56
+ value = libyumly.loadYumlyPy(path_str)
57
+ except Exception as exc:
58
+ msg = str(exc).strip() or FALLBACK_MESSAGE
59
+ raise YumlyError(msg) from exc
60
+
61
+ if not isinstance(value, dict):
62
+ raise YumlyError(FALLBACK_VALUE_MESSAGE)
63
+
64
+ return value
65
+
66
+ def _parse_content(self, yuml_data: str, working_dir: str = ".") -> dict[str, Any]:
67
+ try:
68
+ value = libyumly.loadYumlyContentPy(yuml_data, working_dir)
69
+ except Exception as exc:
70
+ msg = str(exc).strip() or FALLBACK_MESSAGE
71
+ raise YumlyError(msg) from exc
72
+
73
+ if not isinstance(value, dict):
74
+ raise YumlyError(FALLBACK_VALUE_MESSAGE)
75
+
76
+ return value
77
+
78
+ def dumps(self, data: dict[str, Any]) -> str:
79
+ """Dump data to a yumly content string"""
80
+ try:
81
+ return libyumly.dumpPy(data)
82
+ except Exception as exc:
83
+ raise YumlyError(str(exc) or FALLBACK_MESSAGE) from exc
84
+
85
+ def dump(self, data: dict[str, Any], stream: IO[str]) -> None:
86
+ """Dump data to a yumly content stream"""
87
+ try:
88
+ stream.write(libyumly.dumpPy(data))
89
+ except Exception as exc:
90
+ raise YumlyError(str(exc) or FALLBACK_MESSAGE) from exc
@@ -0,0 +1,7 @@
1
+ """Module for custom exceptions in Yumly."""
2
+
3
+ class YumlyError(Exception):
4
+ """Base class for exceptions in this module."""
5
+ def __init__(self, message: str):
6
+ self.message = message
7
+ super().__init__(self.message)
@@ -0,0 +1,32 @@
1
+ Metadata-Version: 2.4
2
+ Name: yumly
3
+ Version: 0.8.0
4
+ Summary: A cute, declarative config language with fail-fast behavior and optional type safety.
5
+ Author-email: Yumene <yumene@yume.dev.br>
6
+ License: MIT License
7
+
8
+ Copyright (c) 2026 rubanana
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+ Project-URL: Homepage, https://github.com/Creeper011/Yumly
28
+ Project-URL: Bug Tracker, https://github.com/Creeper011/Yumly/issues
29
+ Requires-Python: >=3.10
30
+ Description-Content-Type: text/markdown
31
+ License-File: LICENSE
32
+ Dynamic: license-file
@@ -0,0 +1,11 @@
1
+ LICENSE
2
+ pyproject.toml
3
+ setup.py
4
+ lib/python/yumly/__init__.py
5
+ lib/python/yumly/yumly.py
6
+ lib/python/yumly/yumly_error.py
7
+ lib/python/yumly.egg-info/PKG-INFO
8
+ lib/python/yumly.egg-info/SOURCES.txt
9
+ lib/python/yumly.egg-info/dependency_links.txt
10
+ lib/python/yumly.egg-info/not-zip-safe
11
+ lib/python/yumly.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ yumly
@@ -0,0 +1,23 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "yumly"
7
+ version = "0.8.0"
8
+ description = "A cute, declarative config language with fail-fast behavior and optional type safety."
9
+ readme = "README.md"
10
+ authors = [{ name = "Yumene", email = "yumene@yume.dev.br" }]
11
+ license = { file = "LICENSE" }
12
+ requires-python = ">=3.10"
13
+
14
+ [tool.setuptools]
15
+ packages = ["yumly"]
16
+ package-dir = {"" = "lib/python"}
17
+
18
+ [tool.setuptools.package-data]
19
+ yumly = ["libyumly.so", "libyumly.pyd"]
20
+
21
+ [project.urls]
22
+ "Homepage" = "https://github.com/Creeper011/Yumly"
23
+ "Bug Tracker" = "https://github.com/Creeper011/Yumly/issues"
yumly-0.8.0/setup.cfg ADDED
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
yumly-0.8.0/setup.py ADDED
@@ -0,0 +1,67 @@
1
+ import subprocess
2
+ import sys
3
+ from pathlib import Path
4
+ from setuptools import setup # type: ignore
5
+ from setuptools.command.build_py import build_py # type: ignore
6
+
7
+ try:
8
+ from wheel.bdist_wheel import bdist_wheel as _bdist_wheel # type: ignore
9
+
10
+ class bdist_wheel(_bdist_wheel):
11
+ """Force the wheel to be tagged as platform-specific."""
12
+ def run(self):
13
+ self.run_command("build_py")
14
+ _bdist_wheel.run(self)
15
+
16
+ def finalize_options(self):
17
+ _bdist_wheel.finalize_options(self)
18
+ self.root_is_pure = False
19
+ except ImportError:
20
+ bdist_wheel = None
21
+
22
+ NIM_SOURCE_PATH = "src/Yumly/libyumly.nim"
23
+ MODULE_NAME = "libyumly"
24
+
25
+ def _extension_suffix():
26
+ return ".pyd" if sys.platform.startswith("win") else ".so"
27
+
28
+ SHARED_LIB_PATH = Path("lib/python/yumly") / f"{MODULE_NAME}{_extension_suffix()}"
29
+
30
+ class BuildNim(build_py):
31
+ """Custom build command to compile Nim code."""
32
+ def run(self):
33
+
34
+ output_path = SHARED_LIB_PATH
35
+ output_path.parent.mkdir(parents=True, exist_ok=True)
36
+ nimcache_path = Path("build/nimcache")
37
+ nimcache_path.mkdir(parents=True, exist_ok=True)
38
+ command = [
39
+ "nim", "c",
40
+ "-d:release",
41
+ "-d:python",
42
+ "--app:lib",
43
+ "--lineTrace:off",
44
+ "--debuginfo:off",
45
+ f"--nimcache:{nimcache_path}",
46
+ f"--out:{output_path}",
47
+ NIM_SOURCE_PATH,
48
+ ]
49
+ try:
50
+ print("=" * 20)
51
+ print("Compiling Nim code...")
52
+ subprocess.check_call(command)
53
+ print("Nim code compiled successfully.")
54
+ print("=" * 20)
55
+ except subprocess.CalledProcessError as e:
56
+ print(f"Error compiling Nim code: {e}")
57
+ raise
58
+ except FileNotFoundError:
59
+ print("Error: 'nim' not found. Please ensure Nim is installed and in your PATH.")
60
+ raise
61
+ super().run()
62
+
63
+ cmdclass = {"build_py": BuildNim}
64
+ if bdist_wheel is not None:
65
+ cmdclass["bdist_wheel"] = bdist_wheel
66
+
67
+ setup(cmdclass=cmdclass, zip_safe=False)