bakefile 0.0.76__tar.gz → 0.0.78__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 (101) hide show
  1. {bakefile-0.0.76 → bakefile-0.0.78}/PKG-INFO +20 -1
  2. {bakefile-0.0.76 → bakefile-0.0.78}/README.md +4 -0
  3. {bakefile-0.0.76 → bakefile-0.0.78}/pyproject.toml +30 -3
  4. {bakefile-0.0.76 → bakefile-0.0.78}/pyproject.toml.orig +31 -6
  5. bakefile-0.0.78/src/bake/_typer_compat.py +33 -0
  6. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/bakebook/bakebook.py +1 -2
  7. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/bakebook/decorator.py +1 -1
  8. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/env.py +2 -2
  9. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/export.py +1 -1
  10. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/common/app.py +1 -1
  11. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/common/context.py +15 -54
  12. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/common/exception_handler.py +5 -4
  13. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/common/obj.py +1 -2
  14. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/common/params.py +4 -3
  15. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/run/__init__.py +9 -1
  16. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/run/main.py +278 -71
  17. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/run/script.py +7 -21
  18. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/run/splitter.py +51 -44
  19. bakefile-0.0.78/src/bake/ui/run/uv.py +45 -0
  20. bakefile-0.0.78/src/bakelib/_params.py +27 -0
  21. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/environ/base.py +5 -1
  22. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/refreshable_cache/cache.py +1 -1
  23. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/base.py +29 -5
  24. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/params.py +5 -0
  25. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/python.py +21 -5
  26. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/rust.py +78 -15
  27. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/utils.py +12 -2
  28. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/utils/clean.py +7 -1
  29. bakefile-0.0.76/src/bake/ui/run/uv.py +0 -80
  30. bakefile-0.0.76/src/bakelib/_params.py +0 -11
  31. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/__init__.py +0 -0
  32. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/_params.py +0 -0
  33. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/bakebook/__init__.py +0 -0
  34. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/bakebook/get.py +0 -0
  35. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/bakebook/utils.py +0 -0
  36. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/__init__.py +0 -0
  37. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bake/__init__.py +0 -0
  38. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bake/__main__.py +0 -0
  39. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bake/main.py +0 -0
  40. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/__init__.py +0 -0
  41. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/__main__.py +0 -0
  42. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/add_inline.py +0 -0
  43. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/find_python.py +0 -0
  44. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/init.py +0 -0
  45. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/lint.py +0 -0
  46. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/main.py +0 -0
  47. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/run.py +0 -0
  48. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/uv.py +0 -0
  49. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/venv.py +0 -0
  50. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/bakefile/which.py +0 -0
  51. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/common/__init__.py +0 -0
  52. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/common/reinvocation.py +0 -0
  53. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/utils/__init__.py +0 -0
  54. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/cli/utils/version.py +0 -0
  55. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/manage/__init__.py +0 -0
  56. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/manage/add_inline.py +0 -0
  57. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/manage/find_python.py +0 -0
  58. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/manage/lint.py +0 -0
  59. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/manage/run_uv.py +0 -0
  60. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/manage/write_bakefile.py +0 -0
  61. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/py.typed +0 -0
  62. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/samples/__init__.py +0 -0
  63. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/samples/simple.py +0 -0
  64. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/__init__.py +0 -0
  65. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/console.py +0 -0
  66. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/logger/__init__.py +0 -0
  67. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/logger/capsys.py +0 -0
  68. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/logger/gcp.py +0 -0
  69. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/logger/setup.py +0 -0
  70. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/logger/utils.py +0 -0
  71. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/params.py +0 -0
  72. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/run/batch.py +0 -0
  73. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/ui/style.py +0 -0
  74. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/utils/__init__.py +0 -0
  75. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/utils/constants.py +0 -0
  76. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/utils/exceptions.py +0 -0
  77. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/utils/settings.py +0 -0
  78. {bakefile-0.0.76 → bakefile-0.0.78}/src/bake/utils/unwrap.py +0 -0
  79. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/__init__.py +0 -0
  80. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/environ/__init__.py +0 -0
  81. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/environ/bakebook.py +0 -0
  82. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/environ/bakebooks.py +0 -0
  83. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/environ/get.py +0 -0
  84. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/environ/presets.py +0 -0
  85. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/publisher/__init__.py +0 -0
  86. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/publisher/crates.py +0 -0
  87. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/publisher/pypi.py +0 -0
  88. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/refreshable_cache/__init__.py +0 -0
  89. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/refreshable_cache/registry.py +0 -0
  90. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/refreshable_cache/utils.py +0 -0
  91. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/__init__.py +0 -0
  92. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/github.py +0 -0
  93. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/lib.py +0 -0
  94. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/python_lib.py +0 -0
  95. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/rust_lib.py +0 -0
  96. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/service.py +0 -0
  97. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/space/submodules.py +0 -0
  98. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/utils/__init__.py +0 -0
  99. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/utils/env_vars.py +0 -0
  100. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/utils/secret.py +0 -0
  101. {bakefile-0.0.76 → bakefile-0.0.78}/src/bakelib/utils/suppress.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bakefile
3
- Version: 0.0.76
3
+ Version: 0.0.78
4
4
  Summary: An OOP task runner. Write tasks once, reuse everywhere. Like a Makefile, but reusable and in Python.
5
5
  Keywords: automation,build-tool,cli,makefile,task-runner
6
6
  Author: Wisaroot Lertthaweedech
@@ -36,6 +36,20 @@ Requires-Dist: keyring>=25.7.0 ; extra == 'lib'
36
36
  Requires-Dist: pathspec>=1.0.3 ; extra == 'lib'
37
37
  Requires-Dist: tenacity>=9.1.2 ; extra == 'lib'
38
38
  Requires-Dist: zerv-version>=0.8.0 ; extra == 'lib'
39
+ Requires-Dist: beautysh==6.4.3 ; extra == 'locked'
40
+ Requires-Dist: loguru==0.7.3 ; extra == 'locked'
41
+ Requires-Dist: orjson==3.12.0 ; extra == 'locked'
42
+ Requires-Dist: pydantic-settings==2.15.0 ; extra == 'locked'
43
+ Requires-Dist: pydantic==2.13.5 ; extra == 'locked'
44
+ Requires-Dist: python-dotenv==1.2.3 ; extra == 'locked'
45
+ Requires-Dist: pyyaml==6.0.3 ; extra == 'locked'
46
+ Requires-Dist: rich==15.0.0 ; extra == 'locked'
47
+ Requires-Dist: ruff==0.16.9 ; extra == 'locked'
48
+ Requires-Dist: tomli==2.4.1 ; python_full_version < '3.11' and extra == 'locked'
49
+ Requires-Dist: ty==0.0.84 ; extra == 'locked'
50
+ Requires-Dist: typer==0.27.2 ; extra == 'locked'
51
+ Requires-Dist: typing-extensions==4.16.0 ; extra == 'locked'
52
+ Requires-Dist: uv==0.12.21 ; extra == 'locked'
39
53
  Requires-Python: >=3.10
40
54
  Project-URL: Changelog, https://github.com/wislertt/bakefile/releases
41
55
  Project-URL: Documentation, https://bakefile.wisl.dev
@@ -43,6 +57,7 @@ Project-URL: Homepage, https://bakefile.wisl.dev
43
57
  Project-URL: Issues, https://github.com/wislertt/bakefile/issues
44
58
  Project-URL: Repository, https://github.com/wislertt/bakefile
45
59
  Provides-Extra: lib
60
+ Provides-Extra: locked
46
61
  Description-Content-Type: text/markdown
47
62
 
48
63
  [![tests](https://img.shields.io/github/actions/workflow/status/wislertt/bakefile/cd.yml?branch=main&label=tests&logo=github)](https://github.com/wislertt/bakefile/actions/workflows/cd.yml)
@@ -72,6 +87,10 @@ An OOP task runner. Write tasks once, reuse everywhere. Like a Makefile, but reu
72
87
 
73
88
  Documentation: **[bakefile.wisl.dev](https://bakefile.wisl.dev)**
74
89
 
90
+ <p align="center">
91
+ <img src="https://cdn.jsdelivr.net/gh/wislertt/bakefile@main/docs/img/preview/demo-app/bakefile-preview.gif" width="720" alt="Define tasks as Python methods, list them, and run them with bake">
92
+ </p>
93
+
75
94
  ## Why bakefile?
76
95
 
77
96
  - **Reusable** - Makefile and Justfile work well, but reusing tasks across projects is hard. bakefile makes tasks Python class methods, so you inherit and share them like any other code.
@@ -25,6 +25,10 @@ An OOP task runner. Write tasks once, reuse everywhere. Like a Makefile, but reu
25
25
 
26
26
  Documentation: **[bakefile.wisl.dev](https://bakefile.wisl.dev)**
27
27
 
28
+ <p align="center">
29
+ <img src="https://cdn.jsdelivr.net/gh/wislertt/bakefile@main/docs/img/preview/demo-app/bakefile-preview.gif" width="720" alt="Define tasks as Python methods, list them, and run them with bake">
30
+ </p>
31
+
28
32
  ## Why bakefile?
29
33
 
30
34
  - **Reusable** - Makefile and Justfile work well, but reusing tasks across projects is hard. bakefile makes tasks Python class methods, so you inherit and share them like any other code.
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "bakefile"
3
- version = "0.0.76"
3
+ version = "0.0.78"
4
4
  description = "An OOP task runner. Write tasks once, reuse everywhere. Like a Makefile, but reusable and in Python."
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -48,6 +48,22 @@ name = "Wisaroot Lertthaweedech"
48
48
  email = "l.wisaroot@gmail.com"
49
49
 
50
50
  [project.optional-dependencies]
51
+ locked = [
52
+ "beautysh==6.4.3",
53
+ "loguru==0.7.3",
54
+ "orjson==3.12.0",
55
+ "pydantic-settings==2.15.0",
56
+ "pydantic==2.13.5",
57
+ "python-dotenv==1.2.3",
58
+ "pyyaml==6.0.3",
59
+ "rich==15.0.0",
60
+ "ruff==0.16.9",
61
+ "tomli==2.4.1; python_version < '3.11'",
62
+ "ty==0.0.84",
63
+ "typer==0.27.2",
64
+ "typing-extensions==4.16.0",
65
+ "uv==0.12.21",
66
+ ]
51
67
  lib = [
52
68
  "keyring>=25.7.0",
53
69
  "pathspec>=1.0.3",
@@ -70,12 +86,16 @@ Repository = "https://github.com/wislertt/bakefile"
70
86
  [dependency-groups]
71
87
  dev = [
72
88
  "deptry>=0.24.0",
89
+ "packaging>=26.3",
73
90
  "pandas>=2.3.3",
91
+ "pillow>=12.1.0",
74
92
  "pre-commit>=4.5.1",
75
93
  "pytest-cov>=7.0.0",
94
+ "pytest-xdist>=3.8.0",
76
95
  "pytest>=9.0.2",
77
96
  "python-package",
78
97
  "toml-sort>=0.24.3",
98
+ "tomlkit>=0.15.1",
79
99
  ]
80
100
 
81
101
  [build-system]
@@ -88,7 +108,10 @@ known_first_party = [
88
108
  "bakelib",
89
109
  "python_package",
90
110
  ]
91
- extend_exclude = ["scripts"]
111
+ extend_exclude = [
112
+ "docs",
113
+ "scripts",
114
+ ]
92
115
 
93
116
  [tool.deptry.package_module_name_map]
94
117
  pydantic = [
@@ -98,6 +121,7 @@ pydantic = [
98
121
 
99
122
  [tool.pytest.ini_options]
100
123
  addopts = "--import-mode=importlib"
124
+ pythonpath = ["."]
101
125
 
102
126
  [tool.ruff]
103
127
  line-length = 100
@@ -120,7 +144,10 @@ select = [
120
144
  ]
121
145
 
122
146
  [tool.ty.src]
123
- exclude = ["scripts"]
147
+ exclude = [
148
+ "docs",
149
+ "scripts",
150
+ ]
124
151
 
125
152
  [tool.uv.build-backend]
126
153
  module-name = [
@@ -1,10 +1,10 @@
1
1
  [project]
2
2
  name = "bakefile"
3
- version = "0.0.76" # use git tag
3
+ version = "0.0.78" # use git tag
4
4
  description = "An OOP task runner. Write tasks once, reuse everywhere. Like a Makefile, but reusable and in Python."
5
5
  readme = "README.md"
6
6
  authors = [
7
- {name = "Wisaroot Lertthaweedech", email = "l.wisaroot@gmail.com"}
7
+ { name = "Wisaroot Lertthaweedech", email = "l.wisaroot@gmail.com" }
8
8
  ]
9
9
  requires-python = ">=3.10"
10
10
  license = "Apache-2.0"
@@ -41,6 +41,26 @@ dependencies = [
41
41
  ]
42
42
 
43
43
  [project.optional-dependencies]
44
+ # Exact pins for tool installs (uv tool / pipx / mise): `uv tool install
45
+ # "bakefile[locked]"`. Tested set, resolves reproducibly. Rewritten from
46
+ # uv.lock by `bake update`; keep pin >= base floor for every dep. To freeze
47
+ # a pin, add a trailing `# hold` comment to its line; `bake update` skips it.
48
+ locked = [
49
+ "beautysh==6.4.3",
50
+ "loguru==0.7.3",
51
+ "orjson==3.12.0",
52
+ "pydantic-settings==2.15.0",
53
+ "pydantic==2.13.5",
54
+ "python-dotenv==1.2.3",
55
+ "pyyaml==6.0.3",
56
+ "rich==15.0.0",
57
+ "ruff==0.16.9",
58
+ "tomli==2.4.1; python_version < '3.11'",
59
+ "ty==0.0.84",
60
+ "typer==0.27.2",
61
+ "typing-extensions==4.16.0",
62
+ "uv==0.12.21"
63
+ ]
44
64
  lib = [
45
65
  "keyring>=25.7.0",
46
66
  "pathspec>=1.0.3",
@@ -63,12 +83,16 @@ Repository = "https://github.com/wislertt/bakefile"
63
83
  [dependency-groups]
64
84
  dev = [
65
85
  "deptry>=0.24.0",
86
+ "packaging>=26.3",
66
87
  "pandas>=2.3.3",
88
+ "pillow>=12.1.0",
67
89
  "pre-commit>=4.5.1",
68
90
  "pytest-cov>=7.0.0",
91
+ "pytest-xdist>=3.8.0",
69
92
  "pytest>=9.0.2",
70
93
  "python-package",
71
- "toml-sort>=0.24.3"
94
+ "toml-sort>=0.24.3",
95
+ "tomlkit>=0.15.1"
72
96
  ]
73
97
 
74
98
  [build-system]
@@ -77,13 +101,14 @@ build-backend = "uv_build"
77
101
 
78
102
  [tool.deptry]
79
103
  known_first_party = ["bake", "bakelib", "python_package"]
80
- extend_exclude = ["scripts"]
104
+ extend_exclude = ["docs", "scripts"]
81
105
 
82
106
  [tool.deptry.package_module_name_map]
83
107
  pydantic = ["pydantic", "pydantic_core"]
84
108
 
85
109
  [tool.pytest.ini_options]
86
110
  addopts = "--import-mode=importlib"
111
+ pythonpath = ["."]
87
112
 
88
113
  [tool.ruff]
89
114
  line-length = 100
@@ -106,7 +131,7 @@ select = [
106
131
  ]
107
132
 
108
133
  [tool.ty.src]
109
- exclude = ["scripts"]
134
+ exclude = ["docs", "scripts"]
110
135
 
111
136
  [tool.uv.build-backend]
112
137
  module-name = ["bake", "bakelib"]
@@ -119,7 +144,7 @@ publish-url = "https://test.pypi.org/legacy/"
119
144
  explicit = true
120
145
 
121
146
  [tool.uv.sources]
122
- python-package = {path = "examples/python-package", editable = true}
147
+ python-package = { path = "examples/python-package", editable = true }
123
148
 
124
149
  # Debug with local zerv in editable mode
125
150
  # =============================================
@@ -0,0 +1,33 @@
1
+ # choke point for typer's private/vendored imports (typer._click, typer.core)
2
+
3
+ from typer import Abort, Exit, echo
4
+ from typer._click.core import Context as ClickContext
5
+ from typer._click.exceptions import (
6
+ BadArgumentUsage,
7
+ BadParameter,
8
+ ClickException,
9
+ NoSuchOption,
10
+ UsageError,
11
+ )
12
+ from typer._click.globals import get_current_context
13
+ from typer._click.utils import PacifyFlushWrapper, _expand_args
14
+ from typer.core import HAS_RICH, MarkupMode, TyperCommand, TyperGroup
15
+
16
+ __all__ = [
17
+ "HAS_RICH",
18
+ "Abort",
19
+ "BadArgumentUsage",
20
+ "BadParameter",
21
+ "ClickContext",
22
+ "ClickException",
23
+ "Exit",
24
+ "MarkupMode",
25
+ "NoSuchOption",
26
+ "PacifyFlushWrapper",
27
+ "TyperCommand",
28
+ "TyperGroup",
29
+ "UsageError",
30
+ "_expand_args",
31
+ "echo",
32
+ "get_current_context",
33
+ ]
@@ -12,11 +12,10 @@ from pydantic import BaseModel, Field, PrivateAttr, field_validator
12
12
  from pydantic.fields import FieldInfo
13
13
  from pydantic.warnings import PydanticDeprecationWarning
14
14
  from pydantic_settings import BaseSettings, SettingsConfigDict
15
- from typer._click.globals import get_current_context
16
- from typer.core import TyperCommand, TyperGroup
17
15
  from typer.main import get_command_name
18
16
  from typer.models import CommandFunctionType, Default
19
17
 
18
+ from bake._typer_compat import TyperCommand, TyperGroup, get_current_context
20
19
  from bake.cli.common.context import BakeCommand, Context
21
20
  from bake.utils.constants import (
22
21
  BAKE_COMMAND_KWARGS,
@@ -1,9 +1,9 @@
1
1
  from collections.abc import Callable
2
2
  from typing import Any
3
3
 
4
- from typer.core import TyperCommand
5
4
  from typer.models import CommandFunctionType
6
5
 
6
+ from bake._typer_compat import TyperCommand
7
7
  from bake.bakebook.bakebook import CommandKwargs
8
8
  from bake.cli.common.context import BakeCommand
9
9
  from bake.utils.constants import BAKE_COMMAND_KWARGS
@@ -3,8 +3,8 @@ from dataclasses import dataclass
3
3
  from typing import Annotated, Any
4
4
 
5
5
  import typer
6
- from typer._click.exceptions import BadArgumentUsage, NoSuchOption, UsageError
7
6
 
7
+ from bake._typer_compat import BadArgumentUsage, BadParameter, NoSuchOption, UsageError
8
8
  from bake.bakebook.bakebook import Bakebook
9
9
  from bake.cli.common.context import Context
10
10
  from bake.ui import console
@@ -21,7 +21,7 @@ def _lookup_field(data: dict[str, Any], field_name: str) -> Any:
21
21
  lookup = field_name.lower()
22
22
  if lookup not in lower_map:
23
23
  available = ", ".join(sorted(data.keys()))
24
- raise typer.BadParameter(f"Field '{field_name}' not found. Available fields: {available}")
24
+ raise BadParameter(f"Field '{field_name}' not found. Available fields: {available}")
25
25
  return data[lower_map[lookup]]
26
26
 
27
27
 
@@ -8,8 +8,8 @@ import typer
8
8
  import yaml
9
9
  from pydantic import SecretBytes, SecretStr
10
10
  from pydantic.fields import FieldInfo
11
- from typer._click.exceptions import BadParameter
12
11
 
12
+ from bake._typer_compat import BadParameter
13
13
  from bake.bakebook.bakebook import Bakebook
14
14
  from bake.cli.common.context import Context
15
15
  from bake.ui import console
@@ -6,8 +6,8 @@ from pathlib import Path
6
6
  from typing import Any
7
7
 
8
8
  import typer
9
- from typer.core import MarkupMode
10
9
 
10
+ from bake._typer_compat import MarkupMode
11
11
  from bake.cli.common.context import Context
12
12
  from bake.ui import console, style
13
13
 
@@ -5,12 +5,12 @@ from pathlib import Path
5
5
  from typing import TYPE_CHECKING, Literal, overload
6
6
 
7
7
  import typer
8
- from typer.core import TyperCommand
9
8
  from typing_extensions import Unpack
10
9
 
10
+ from bake._typer_compat import TyperCommand
11
11
  from bake.ui.run import CmdType, StrOrNoneCompletedProcess
12
12
  from bake.ui.run import run as _run
13
- from bake.ui.run.main import PopenKwargs
13
+ from bake.ui.run.main import DecodeErrors, PopenKwargs, RunKwargs
14
14
  from bake.ui.run.script import run_script as _run_script
15
15
 
16
16
  from .obj import BakefileObject
@@ -53,18 +53,7 @@ class Context(typer.Context):
53
53
  cmd: CmdType,
54
54
  *,
55
55
  capture_output: Literal[True] = True,
56
- check: bool = True,
57
- cwd: Path | str | None = None,
58
- stream: bool = True,
59
- shell: bool | None = None,
60
- echo: bool = True,
61
- echo_cmd: str | None = None,
62
- dry_run: bool | None = None,
63
- keep_temp_file: bool = False,
64
- env: dict[str, str] | None = None,
65
- timeout: float | None = None,
66
- _encoding: str | None = None,
67
- **kwargs: Unpack[PopenKwargs],
56
+ **kwargs: Unpack[RunKwargs],
68
57
  ) -> subprocess.CompletedProcess[str]: ...
69
58
 
70
59
  @overload
@@ -73,18 +62,7 @@ class Context(typer.Context):
73
62
  cmd: CmdType,
74
63
  *,
75
64
  capture_output: Literal[False],
76
- check: bool = True,
77
- cwd: Path | str | None = None,
78
- stream: bool = True,
79
- shell: bool | None = None,
80
- echo: bool = True,
81
- echo_cmd: str | None = None,
82
- dry_run: bool | None = None,
83
- keep_temp_file: bool = False,
84
- env: dict[str, str] | None = None,
85
- timeout: float | None = None,
86
- _encoding: str | None = None,
87
- **kwargs: Unpack[PopenKwargs],
65
+ **kwargs: Unpack[RunKwargs],
88
66
  ) -> subprocess.CompletedProcess[None]: ...
89
67
 
90
68
  def run(
@@ -92,35 +70,12 @@ class Context(typer.Context):
92
70
  cmd: CmdType,
93
71
  *,
94
72
  capture_output: bool = False,
95
- check: bool = True,
96
- cwd: Path | str | None = None,
97
- stream: bool = True,
98
- shell: bool | None = None,
99
- echo: bool = True,
100
- echo_cmd: str | None = None,
101
- dry_run: bool | None = None,
102
- keep_temp_file: bool = False,
103
- env: dict[str, str] | None = None,
104
- timeout: float | None = None,
105
- _encoding: str | None = None,
106
- **kwargs: Unpack[PopenKwargs],
73
+ **kwargs: Unpack[RunKwargs],
107
74
  ) -> StrOrNoneCompletedProcess:
108
- return _run(
109
- cmd,
110
- capture_output=capture_output,
111
- check=check,
112
- cwd=cwd,
113
- stream=stream,
114
- shell=shell,
115
- echo=echo,
116
- echo_cmd=echo_cmd,
117
- dry_run=self.obj.dry_run if dry_run is None else dry_run,
118
- keep_temp_file=keep_temp_file,
119
- env=env,
120
- timeout=timeout,
121
- _encoding=_encoding,
122
- **kwargs,
123
- )
75
+ # dry_run=None means "inherit from the bakefile context"
76
+ if kwargs.get("dry_run") is None:
77
+ kwargs["dry_run"] = self.obj.dry_run
78
+ return _run(cmd, capture_output=capture_output, **kwargs)
124
79
 
125
80
  def run_script(
126
81
  self,
@@ -135,6 +90,9 @@ class Context(typer.Context):
135
90
  dry_run: bool | None = None,
136
91
  keep_temp_file: bool = False,
137
92
  env: dict[str, str] | None = None,
93
+ timeout: float | None = None,
94
+ drain_timeout: float | None = 10.0,
95
+ decode_errors: DecodeErrors = "replace",
138
96
  **kwargs: Unpack[PopenKwargs],
139
97
  ) -> StrOrNoneCompletedProcess:
140
98
  return _run_script(
@@ -148,6 +106,9 @@ class Context(typer.Context):
148
106
  dry_run=self.obj.dry_run if dry_run is None else dry_run,
149
107
  keep_temp_file=keep_temp_file,
150
108
  env=env,
109
+ timeout=timeout,
110
+ drain_timeout=drain_timeout,
111
+ decode_errors=decode_errors,
151
112
  **kwargs,
152
113
  )
153
114
 
@@ -4,14 +4,15 @@ from contextlib import contextmanager
4
4
  from gettext import gettext
5
5
  from typing import TextIO, cast
6
6
 
7
- from typer._click import echo
8
- from typer._click.exceptions import (
7
+ from bake._typer_compat import (
8
+ HAS_RICH,
9
9
  Abort,
10
10
  ClickException,
11
11
  Exit,
12
+ MarkupMode,
13
+ PacifyFlushWrapper,
14
+ echo,
12
15
  )
13
- from typer._click.utils import PacifyFlushWrapper
14
- from typer.core import HAS_RICH, MarkupMode
15
16
 
16
17
 
17
18
  @contextmanager
@@ -10,10 +10,9 @@ from typing import TYPE_CHECKING, Any
10
10
  import typer
11
11
  from pydantic import ValidationError
12
12
  from rich.traceback import Traceback
13
- from typer._click.utils import _expand_args
14
- from typer.core import MarkupMode
15
13
  from typer.main import get_command_from_info
16
14
 
15
+ from bake._typer_compat import MarkupMode, _expand_args
17
16
  from bake.bakebook.get import (
18
17
  get_bakebook_from_target_dir_path,
19
18
  resolve_bakefile_path,
@@ -3,15 +3,16 @@ from typing import Annotated
3
3
 
4
4
  import typer
5
5
 
6
+ from bake._typer_compat import BadParameter
6
7
  from bake.cli.utils.version import make_version_callback
7
8
 
8
9
 
9
10
  def validate_file_name(value: str) -> str:
10
11
  """Validate file name for --file-name option."""
11
12
  if "/" in value or "\\" in value:
12
- raise typer.BadParameter(f"File name must not contain path separators: {value}")
13
+ raise BadParameter(f"File name must not contain path separators: {value}")
13
14
  if not value.endswith(".py"):
14
- raise typer.BadParameter(f"File name must end with .py: {value}")
15
+ raise BadParameter(f"File name must end with .py: {value}")
15
16
  return value
16
17
 
17
18
 
@@ -20,7 +21,7 @@ def verbosity_callback(
20
21
  ) -> int | None:
21
22
  """Validate verbosity level (max 3)."""
22
23
  if value is not None and (value < 0 or value > 3):
23
- raise typer.BadParameter("Maximum verbosity is -vvv")
24
+ raise BadParameter("Maximum verbosity is -vvv")
24
25
  return value
25
26
 
26
27
 
@@ -6,7 +6,14 @@ from bake.ui.run.batch import (
6
6
  SequentialCliTaskRunner,
7
7
  spawn_env,
8
8
  )
9
- from bake.ui.run.main import CmdType, OutputSplitter, PopenKwargs, StrOrNoneCompletedProcess, run
9
+ from bake.ui.run.main import (
10
+ CmdType,
11
+ DecodeErrors,
12
+ OutputSplitter,
13
+ PopenKwargs,
14
+ StrOrNoneCompletedProcess,
15
+ run,
16
+ )
10
17
  from bake.ui.run.script import run_script
11
18
  from bake.ui.run.uv import run_uv
12
19
 
@@ -14,6 +21,7 @@ __all__ = [
14
21
  "CliTask",
15
22
  "CmdType",
16
23
  "CompletedCliTask",
24
+ "DecodeErrors",
17
25
  "OutputSplitter",
18
26
  "ParallelCliTaskRunner",
19
27
  "PopenKwargs",