bob-build 0.1.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.
@@ -0,0 +1,7 @@
1
+ Copyright 2026 Noam Zaks and Bob contributors.
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
+
5
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
+
7
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,62 @@
1
+ Metadata-Version: 2.4
2
+ Name: bob-build
3
+ Version: 0.1.0
4
+ Summary: The ergonomic Ninja-based build system.
5
+ Author: Noam Zaks
6
+ Author-email: Noam Zaks <noam@noamzaks.com>
7
+ License-Expression: MIT
8
+ License-File: LICENSE.md
9
+ Requires-Dist: ninja>=1.13.0
10
+ Requires-Dist: rich-click>=1.9.8
11
+ Requires-Python: >=3.12
12
+ Project-URL: Repository, https://github.com/bob-hq/bob
13
+ Description-Content-Type: text/markdown
14
+
15
+ <h1 align="center">
16
+ <img src="./resources/logo.png" height="300">
17
+ <br />
18
+ Bob the Builder
19
+ <br />
20
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg">
21
+ <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg">
22
+ </h1>
23
+
24
+ <h4 align="center">
25
+ The ergonomic Ninja-based build system.
26
+ </h4>
27
+
28
+ <p align="center">
29
+ 🏃 <a href="#getting-started">Getting Started</a>
30
+ &nbsp;&middot&nbsp;
31
+ ⌨️ <a href="#cli">CLI</a>
32
+ &nbsp;&middot&nbsp;
33
+ 🎯 <a href="#goals">Goals</a>
34
+ &nbsp;&middot&nbsp;
35
+ 🙏 <a href="#acknowledgements">Acknowledgements</a>
36
+ </p>
37
+
38
+ ## Getting Started
39
+
40
+ ```bash
41
+ uv tool install git+https://github.com/bob-hq/bob --with git+https://github.com/bob-hq/bob-std
42
+ ```
43
+
44
+ ## CLI
45
+
46
+
47
+
48
+ ## Goals
49
+
50
+ Sorted by priority:
51
+
52
+ - **Writing Bobfiles, writing plugins and rules, and composing Bobfiles** should all be easy and feel Pythonic.
53
+ - **Type safety** should allow for a smooth editing experience and easy-to-debug errors.
54
+ - **Plugins should be close to the actual commands** rather than lock you in to a specific paradigm.
55
+ - **Speed** should be fast.
56
+
57
+ ## Acknowledgements
58
+
59
+ - [Bake](https://github.com/nmraz/bake/)
60
+ - [Kbuild](https://docs.kernel.org/kbuild/)
61
+ - [Ninja's configure.py](https://github.com/ninja-build/ninja/blob/master/configure.py)
62
+ - Thanks to everyone who helped design Bob, in particular Noam Raz.
@@ -0,0 +1,48 @@
1
+ <h1 align="center">
2
+ <img src="./resources/logo.png" height="300">
3
+ <br />
4
+ Bob the Builder
5
+ <br />
6
+ <img src="https://img.shields.io/badge/license-MIT-blue.svg">
7
+ <img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg">
8
+ </h1>
9
+
10
+ <h4 align="center">
11
+ The ergonomic Ninja-based build system.
12
+ </h4>
13
+
14
+ <p align="center">
15
+ 🏃 <a href="#getting-started">Getting Started</a>
16
+ &nbsp;&middot&nbsp;
17
+ ⌨️ <a href="#cli">CLI</a>
18
+ &nbsp;&middot&nbsp;
19
+ 🎯 <a href="#goals">Goals</a>
20
+ &nbsp;&middot&nbsp;
21
+ 🙏 <a href="#acknowledgements">Acknowledgements</a>
22
+ </p>
23
+
24
+ ## Getting Started
25
+
26
+ ```bash
27
+ uv tool install git+https://github.com/bob-hq/bob --with git+https://github.com/bob-hq/bob-std
28
+ ```
29
+
30
+ ## CLI
31
+
32
+
33
+
34
+ ## Goals
35
+
36
+ Sorted by priority:
37
+
38
+ - **Writing Bobfiles, writing plugins and rules, and composing Bobfiles** should all be easy and feel Pythonic.
39
+ - **Type safety** should allow for a smooth editing experience and easy-to-debug errors.
40
+ - **Plugins should be close to the actual commands** rather than lock you in to a specific paradigm.
41
+ - **Speed** should be fast.
42
+
43
+ ## Acknowledgements
44
+
45
+ - [Bake](https://github.com/nmraz/bake/)
46
+ - [Kbuild](https://docs.kernel.org/kbuild/)
47
+ - [Ninja's configure.py](https://github.com/ninja-build/ninja/blob/master/configure.py)
48
+ - Thanks to everyone who helped design Bob, in particular Noam Raz.
@@ -0,0 +1,43 @@
1
+ [project]
2
+ name = "bob-build"
3
+ version = "0.1.0"
4
+ description = "The ergonomic Ninja-based build system."
5
+ readme = "README.md"
6
+ authors = [{ name = "Noam Zaks", email = "noam@noamzaks.com" }]
7
+ requires-python = ">=3.12"
8
+ license = "MIT"
9
+ license-files = ["LICENSE.md"]
10
+ dependencies = ["ninja>=1.13.0", "rich-click>=1.9.8"]
11
+
12
+ [project.urls]
13
+ Repository = "https://github.com/bob-hq/bob"
14
+
15
+ [project.scripts]
16
+ bob = "bob:main"
17
+
18
+ [build-system]
19
+ requires = ["uv_build>=0.8.0,<0.12.0"]
20
+ build-backend = "uv_build"
21
+
22
+ [dependency-groups]
23
+ dev = [
24
+ "mypy>=2.1.0",
25
+ "pre-commit>=4.6.0",
26
+ "pytest>=9.1.1",
27
+ "pytest-xdist>=3.8.0",
28
+ "ruff>=0.15.18",
29
+ "ty>=0.0.51",
30
+ ]
31
+
32
+ [tool.ruff.lint]
33
+ ignore = ["F403", "F405"]
34
+
35
+ [tool.mypy]
36
+ strict = true
37
+
38
+ # TODO: https://github.com/pallets/click/issues/3502
39
+ [tool.uv]
40
+ override-dependencies = ["click==8.3.0"]
41
+
42
+ [tool.uv.build-backend]
43
+ module-name = "bob"
@@ -0,0 +1,4 @@
1
+ def main() -> None:
2
+ from bob.cli import cli
3
+
4
+ cli()
@@ -0,0 +1,3 @@
1
+ from bob import main
2
+
3
+ main()
File without changes
@@ -0,0 +1,49 @@
1
+ import logging
2
+ from importlib.metadata import version as importlib_version
3
+ from typing import Literal, overload
4
+
5
+ from bob.core.context import Context
6
+
7
+
8
+ @overload
9
+ def config(
10
+ name: str, required: Literal[False] = False, default: None = None
11
+ ) -> None | str: ...
12
+
13
+
14
+ @overload
15
+ def config(name: str, required: Literal[False] = False, default: str = "") -> str: ...
16
+
17
+
18
+ @overload
19
+ def config(
20
+ name: str, required: Literal[True] = True, default: None | str = None
21
+ ) -> str: ...
22
+
23
+
24
+ def config(name: str, required: bool = False, default: None | str = None) -> None | str:
25
+ context = Context.current()
26
+
27
+ context.used_configs.add(name)
28
+
29
+ if name not in context.configs and not required:
30
+ logging.info(f'Unset config "{name}"')
31
+ return default
32
+
33
+ return context.configs[name]
34
+
35
+
36
+ def bob_required_version(version: str, bob_version: None | str = None) -> None:
37
+ if bob_version is None:
38
+ bob_version = importlib_version("bob")
39
+
40
+ if "." not in version:
41
+ raise ValueError(
42
+ f"Invalid required version {version} doesn't contain minor requirement!"
43
+ )
44
+
45
+ major, minor, *_ = map(int, version.split("."))
46
+ bob_major, bob_minor, *_ = map(int, bob_version.split("."))
47
+
48
+ if major != bob_major or bob_minor < minor or (major == 0 and bob_minor != minor):
49
+ raise Exception(f"Invalid bob version: need {version} but have {bob_version}")
@@ -0,0 +1,68 @@
1
+ from pathlib import Path
2
+ from typing import Literal, overload
3
+
4
+ from bob.api.rule import RuleInput
5
+ from bob.api.scope import AttributeScope, Scope
6
+ from bob.core.context import Context
7
+
8
+
9
+ def build_in(path: str | Path) -> Scope:
10
+ context = Context.current()
11
+ return AttributeScope(
12
+ context, {"current_build_subdir": context.current_build_subdir / path}
13
+ )
14
+
15
+
16
+ def src_in(path: str | Path) -> Scope:
17
+ context = Context.current()
18
+ return AttributeScope(
19
+ context, {"current_src_subdir": context.current_src_subdir / path}
20
+ )
21
+
22
+
23
+ def builddir() -> Path:
24
+ context = Context.current()
25
+ return context.current_build_subdir
26
+
27
+
28
+ def srcdir() -> Path:
29
+ context = Context.current()
30
+ return context.current_src_subdir
31
+
32
+
33
+ @overload
34
+ def read(path: RuleInput.Type, text: Literal[True] = True) -> str: ...
35
+ @overload
36
+ def read(path: RuleInput.Type, text: Literal[False] = False) -> bytes: ...
37
+
38
+
39
+ def read(path: RuleInput.Type, text: bool = False) -> str | bytes:
40
+ path = RuleInput.resolve(path, path_only=True)
41
+
42
+ context = Context.current()
43
+ context.configure_implicit_dependencies.add(path)
44
+
45
+ if text:
46
+ return path.read_text()
47
+
48
+ return path.read_bytes()
49
+
50
+
51
+ def glob(pattern: str, path: None | str | Path = None) -> list[Path]:
52
+ context = Context.current()
53
+
54
+ if path is None:
55
+ path = Path(".")
56
+
57
+ if isinstance(path, str):
58
+ path = Path(path)
59
+
60
+ context.configure_implicit_dependencies.add(path)
61
+ context.configure_implicit_dependencies.update(
62
+ p for p in path.rglob("*") if p.is_dir()
63
+ )
64
+
65
+ return sorted(
66
+ path.glob(pattern),
67
+ key=lambda p: str(p),
68
+ )