bakefile 0.0.6__tar.gz → 0.0.7__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 (63) hide show
  1. {bakefile-0.0.6 → bakefile-0.0.7}/PKG-INFO +1 -1
  2. {bakefile-0.0.6 → bakefile-0.0.7}/pyproject.toml +1 -1
  3. bakefile-0.0.7/src/bake/manage/write_bakefile.py +39 -0
  4. bakefile-0.0.6/src/bake/manage/write_bakefile.py +0 -20
  5. {bakefile-0.0.6 → bakefile-0.0.7}/README.md +0 -0
  6. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/__init__.py +0 -0
  7. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/bakebook/__init__.py +0 -0
  8. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/bakebook/bakebook.py +0 -0
  9. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/bakebook/decorator.py +0 -0
  10. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/bakebook/get.py +0 -0
  11. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/__init__.py +0 -0
  12. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bake/__init__.py +0 -0
  13. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bake/__main__.py +0 -0
  14. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bake/main.py +0 -0
  15. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bake/reinvocation.py +0 -0
  16. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/__init__.py +0 -0
  17. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/__main__.py +0 -0
  18. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/add_inline.py +0 -0
  19. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/export.py +0 -0
  20. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/find_python.py +0 -0
  21. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/init.py +0 -0
  22. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/lint.py +0 -0
  23. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/main.py +0 -0
  24. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/bakefile/uv.py +0 -0
  25. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/common/__init__.py +0 -0
  26. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/common/app.py +0 -0
  27. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/common/callback.py +0 -0
  28. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/common/context.py +0 -0
  29. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/common/exception_handler.py +0 -0
  30. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/common/obj.py +0 -0
  31. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/common/params.py +0 -0
  32. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/utils/__init__.py +0 -0
  33. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/cli/utils/version.py +0 -0
  34. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/manage/__init__.py +0 -0
  35. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/manage/add_inline.py +0 -0
  36. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/manage/find_python.py +0 -0
  37. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/manage/lint.py +0 -0
  38. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/manage/run_uv.py +0 -0
  39. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/py.typed +0 -0
  40. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/samples/__init__.py +0 -0
  41. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/samples/simple.py +0 -0
  42. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/__init__.py +0 -0
  43. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/console.py +0 -0
  44. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/logger/__init__.py +0 -0
  45. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/logger/capsys.py +0 -0
  46. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/logger/setup.py +0 -0
  47. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/logger/utils.py +0 -0
  48. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/params.py +0 -0
  49. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/run/__init__.py +0 -0
  50. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/run/run.py +0 -0
  51. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/run/script.py +0 -0
  52. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/run/splitter.py +0 -0
  53. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/run/uv.py +0 -0
  54. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/ui/style.py +0 -0
  55. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/utils/__init__.py +0 -0
  56. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/utils/constants.py +0 -0
  57. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/utils/env.py +0 -0
  58. {bakefile-0.0.6 → bakefile-0.0.7}/src/bake/utils/exceptions.py +0 -0
  59. {bakefile-0.0.6 → bakefile-0.0.7}/src/bakelib/__init__.py +0 -0
  60. {bakefile-0.0.6 → bakefile-0.0.7}/src/bakelib/space/__init__.py +0 -0
  61. {bakefile-0.0.6 → bakefile-0.0.7}/src/bakelib/space/base.py +0 -0
  62. {bakefile-0.0.6 → bakefile-0.0.7}/src/bakelib/space/python.py +0 -0
  63. {bakefile-0.0.6 → bakefile-0.0.7}/src/bakelib/space/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: bakefile
3
- Version: 0.0.6
3
+ Version: 0.0.7
4
4
  Summary: Add your description here
5
5
  Author: Wisaroot Lertthaweedech
6
6
  Author-email: Wisaroot Lertthaweedech <l.wisaroot@gmail.com>
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bakefile"
3
- version = "0.0.6" # use git tag
3
+ version = "0.0.7" # use git tag
4
4
  description = "Add your description here"
5
5
  readme = "README.md"
6
6
  authors = [
@@ -0,0 +1,39 @@
1
+ import types
2
+ from pathlib import Path
3
+
4
+ from bake.samples import simple
5
+ from bake.utils.constants import BAKEBOOK_NAME_IN_SAMPLES
6
+
7
+ # Allowed sample modules
8
+ # This dictionary acts as a whitelist for security - only these modules can be used
9
+ ALLOWED_SAMPLE_MODULES: dict[str, types.ModuleType] = {
10
+ simple.__name__: simple,
11
+ }
12
+
13
+
14
+ def write_bakefile(
15
+ bakefile_path: Path, bakebook_name: str, sample_module: types.ModuleType
16
+ ) -> None:
17
+ if not hasattr(sample_module, BAKEBOOK_NAME_IN_SAMPLES):
18
+ raise ValueError(
19
+ f"Module `{sample_module.__name__}` must have `{BAKEBOOK_NAME_IN_SAMPLES}` attribute"
20
+ )
21
+
22
+ module_name = sample_module.__name__
23
+ if module_name not in ALLOWED_SAMPLE_MODULES:
24
+ raise ValueError(
25
+ f"Module `{module_name}` is not in the allowed sample modules list. "
26
+ f"Allowed modules: {list(ALLOWED_SAMPLE_MODULES.keys())}"
27
+ )
28
+
29
+ allowed_module = ALLOWED_SAMPLE_MODULES[module_name]
30
+ if sample_module is not allowed_module:
31
+ raise ValueError(f"Module `{module_name}` does not match the allowed module object")
32
+
33
+ if allowed_module.__file__ is None:
34
+ raise ValueError(f"Could not find file for module `{module_name}`")
35
+
36
+ source_file_path = Path(allowed_module.__file__)
37
+ original_bakefile_content = source_file_path.read_text()
38
+ customized_content = original_bakefile_content.replace(BAKEBOOK_NAME_IN_SAMPLES, bakebook_name)
39
+ bakefile_path.write_text(customized_content)
@@ -1,20 +0,0 @@
1
- import types
2
- from pathlib import Path
3
-
4
- from bake.utils.constants import BAKEBOOK_NAME_IN_SAMPLES
5
-
6
-
7
- def write_bakefile(
8
- bakefile_path: Path, bakebook_name: str, sample_module: types.ModuleType
9
- ) -> None:
10
- if not hasattr(sample_module, BAKEBOOK_NAME_IN_SAMPLES):
11
- raise ValueError(
12
- f"Module `{sample_module.__name__}` must have `{BAKEBOOK_NAME_IN_SAMPLES}` attribute"
13
- )
14
-
15
- if sample_module.__file__ is None:
16
- raise ValueError(f"Could not find `{sample_module.__name__}`")
17
-
18
- original_bakefile_content = Path(sample_module.__file__).read_text()
19
- customized_content = original_bakefile_content.replace(BAKEBOOK_NAME_IN_SAMPLES, bakebook_name)
20
- bakefile_path.write_text(customized_content)
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes