bakefile 0.0.3__py3-none-any.whl → 0.0.5__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.
- bake/__init__.py +9 -0
- bake/bakebook/bakebook.py +85 -0
- bake/bakebook/decorator.py +50 -0
- bake/bakebook/get.py +175 -0
- bake/cli/bake/__init__.py +3 -0
- bake/cli/bake/__main__.py +5 -0
- bake/cli/bake/main.py +74 -0
- bake/cli/bake/reinvocation.py +63 -0
- bake/cli/bakefile/__init__.py +3 -0
- bake/cli/bakefile/__main__.py +5 -0
- bake/cli/bakefile/add_inline.py +29 -0
- bake/cli/bakefile/find_python.py +18 -0
- bake/cli/bakefile/init.py +56 -0
- bake/cli/bakefile/lint.py +77 -0
- bake/cli/bakefile/main.py +41 -0
- bake/cli/bakefile/uv.py +146 -0
- bake/cli/common/app.py +54 -0
- bake/cli/common/callback.py +13 -0
- bake/cli/common/context.py +145 -0
- bake/cli/common/exception_handler.py +57 -0
- bake/cli/common/obj.py +214 -0
- bake/cli/common/params.py +72 -0
- bake/cli/utils/__init__.py +0 -0
- bake/cli/utils/version.py +18 -0
- bake/manage/__init__.py +0 -0
- bake/manage/add_inline.py +71 -0
- bake/manage/find_python.py +210 -0
- bake/manage/lint.py +101 -0
- bake/manage/run_uv.py +88 -0
- bake/manage/write_bakefile.py +20 -0
- bake/py.typed +0 -0
- bake/samples/__init__.py +0 -0
- bake/samples/simple.py +9 -0
- bake/ui/__init__.py +10 -0
- bake/ui/console.py +58 -0
- bake/ui/logger/__init__.py +33 -0
- bake/ui/logger/capsys.py +158 -0
- bake/ui/logger/setup.py +53 -0
- bake/ui/logger/utils.py +215 -0
- bake/ui/run/__init__.py +11 -0
- bake/ui/run/run.py +541 -0
- bake/ui/run/script.py +74 -0
- bake/ui/run/splitter.py +237 -0
- bake/ui/run/uv.py +83 -0
- bake/ui/style.py +2 -0
- bake/utils/__init__.py +11 -0
- bake/utils/constants.py +21 -0
- bake/utils/env.py +10 -0
- bake/utils/exceptions.py +17 -0
- {bakefile-0.0.3.dist-info → bakefile-0.0.5.dist-info}/METADATA +14 -2
- bakefile-0.0.5.dist-info/RECORD +61 -0
- {bakefile-0.0.3.dist-info → bakefile-0.0.5.dist-info}/WHEEL +1 -1
- bakefile-0.0.5.dist-info/entry_points.txt +5 -0
- bakelib/__init__.py +4 -0
- bakelib/space/__init__.py +0 -0
- bakelib/space/base.py +73 -0
- bakelib/space/python.py +42 -0
- bakelib/space/utils.py +55 -0
- bakefile/cli/bake/__init__.py +0 -3
- bakefile/cli/bake/main.py +0 -17
- bakefile/cli/bake/resolve_bakebook.py +0 -75
- bakefile/cli/bakefile.py +0 -8
- bakefile-0.0.3.dist-info/RECORD +0 -11
- bakefile-0.0.3.dist-info/entry_points.txt +0 -4
- {bakefile → bake/bakebook}/__init__.py +0 -0
- {bakefile → bake}/cli/__init__.py +0 -0
- /bakefile/py.typed → /bake/cli/common/__init__.py +0 -0
bakefile/cli/bake/main.py
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import typer
|
|
2
|
-
|
|
3
|
-
from bakefile.cli.bake.resolve_bakebook import resolve_bakebook
|
|
4
|
-
|
|
5
|
-
app = typer.Typer()
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
@app.command()
|
|
9
|
-
def main(
|
|
10
|
-
chdir: str = typer.Option(None, "-C", "--chdir", help="Change directory before running"),
|
|
11
|
-
file_name: str = typer.Option("bakefile.py", "--file-name", "-f", help="Path to bakefile.py"),
|
|
12
|
-
bakebook_name: str = typer.Option(
|
|
13
|
-
"bakebook", "--book-name", "-b", help="Name of bakebook object to retrieve"
|
|
14
|
-
),
|
|
15
|
-
) -> None:
|
|
16
|
-
bakebook = resolve_bakebook(file_name=file_name, bakebook_name=bakebook_name, chdir=chdir)
|
|
17
|
-
typer.echo(bakebook)
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import importlib.util
|
|
2
|
-
import os
|
|
3
|
-
import pathlib
|
|
4
|
-
import sys
|
|
5
|
-
import types
|
|
6
|
-
|
|
7
|
-
import typer
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def change_directory(path: str) -> None:
|
|
11
|
-
if not path or not path.strip():
|
|
12
|
-
typer.echo("Directory path cannot be empty", err=True)
|
|
13
|
-
raise SystemExit(1)
|
|
14
|
-
dir_path = pathlib.Path(path)
|
|
15
|
-
if not dir_path.exists():
|
|
16
|
-
typer.echo(f"Directory not found: {path}", err=True)
|
|
17
|
-
raise SystemExit(1)
|
|
18
|
-
if not dir_path.is_dir():
|
|
19
|
-
typer.echo(f"Not a directory: {path}", err=True)
|
|
20
|
-
raise SystemExit(1)
|
|
21
|
-
os.chdir(dir_path)
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
def validate_file_name(file_name: str) -> None:
|
|
25
|
-
if "/" in file_name or "\\" in file_name:
|
|
26
|
-
typer.echo(f"File name must not contain path separators: {file_name}", err=True)
|
|
27
|
-
raise SystemExit(1)
|
|
28
|
-
if not file_name.endswith(".py"):
|
|
29
|
-
typer.echo(f"File name must end with .py: {file_name}", err=True)
|
|
30
|
-
raise SystemExit(1)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def resolve_file_path(file_name: str) -> pathlib.Path:
|
|
34
|
-
path = pathlib.Path.cwd() / file_name
|
|
35
|
-
if not path.exists():
|
|
36
|
-
typer.echo(f"File not found: {file_name}", err=True)
|
|
37
|
-
raise SystemExit(1)
|
|
38
|
-
return path
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
def load_module(path: pathlib.Path) -> types.ModuleType:
|
|
42
|
-
module_name = "bakefile"
|
|
43
|
-
spec = importlib.util.spec_from_file_location(module_name, path)
|
|
44
|
-
if spec is None or spec.loader is None:
|
|
45
|
-
typer.echo(f"Failed to load: {path}", err=True)
|
|
46
|
-
raise SystemExit(1)
|
|
47
|
-
|
|
48
|
-
module: types.ModuleType = importlib.util.module_from_spec(spec)
|
|
49
|
-
sys.modules[module_name] = module
|
|
50
|
-
spec.loader.exec_module(module)
|
|
51
|
-
return module
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def get_bakebook(module: types.ModuleType, bakebook_name: str, path: pathlib.Path) -> str:
|
|
55
|
-
if not hasattr(module, bakebook_name):
|
|
56
|
-
typer.echo(f"No '{bakebook_name}' found in {path}", err=True)
|
|
57
|
-
raise SystemExit(1)
|
|
58
|
-
bakebook = getattr(module, bakebook_name)
|
|
59
|
-
if not isinstance(bakebook, str):
|
|
60
|
-
typer.echo(
|
|
61
|
-
f"Bakebook '{bakebook_name}' must be a string, got {type(bakebook).__name__}",
|
|
62
|
-
err=True,
|
|
63
|
-
)
|
|
64
|
-
raise SystemExit(1)
|
|
65
|
-
return bakebook
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def resolve_bakebook(file_name: str, bakebook_name: str, chdir: str | None = None) -> str:
|
|
69
|
-
if chdir:
|
|
70
|
-
change_directory(chdir)
|
|
71
|
-
|
|
72
|
-
validate_file_name(file_name)
|
|
73
|
-
path = resolve_file_path(file_name)
|
|
74
|
-
module = load_module(path)
|
|
75
|
-
return get_bakebook(module=module, bakebook_name=bakebook_name, path=path)
|
bakefile/cli/bakefile.py
DELETED
bakefile-0.0.3.dist-info/RECORD
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
bakefile/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
2
|
-
bakefile/cli/__init__.py,sha256=da1PTClDMl-IBkrSvq6JC1lnS-K_BASzCvxVhNxN5Ls,13
|
|
3
|
-
bakefile/cli/bake/__init__.py,sha256=ODwmoNPYI4nEjw0ac6DDu0uNcBSULA0nFVevdFGTdEE,58
|
|
4
|
-
bakefile/cli/bake/main.py,sha256=QV7Ug_5L6AoHCAcqO3iro_XYklCDeYfTOpcLOUr8aKE,580
|
|
5
|
-
bakefile/cli/bake/resolve_bakebook.py,sha256=c6-puofWBTvoqKcmZZKr0LiswzTSBa4EhNhYJLOzPdQ,2410
|
|
6
|
-
bakefile/cli/bakefile.py,sha256=KCuJFSJkn7ORlNUrT-xGhlttnhwgz1p2-P9i6A5UpCE,101
|
|
7
|
-
bakefile/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
|
-
bakefile-0.0.3.dist-info/WHEEL,sha256=ZyFSCYkV2BrxH6-HRVRg3R9Fo7MALzer9KiPYqNxSbo,79
|
|
9
|
-
bakefile-0.0.3.dist-info/entry_points.txt,sha256=9oSP-EtniU7OO52Nuto40-DsGYe5zZvoaXUULkYFs2M,85
|
|
10
|
-
bakefile-0.0.3.dist-info/METADATA,sha256=_2HxykBi-CYOCxCzdy57EwxRZe5XGJJ7KUBXUWqcE3I,1908
|
|
11
|
-
bakefile-0.0.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|