Skip to content

dizzy.generators.lib_python_uv

dizzy.generators.lib_python_uv

Python-uv runtime generator — generates lib/python-uv/ package structure.

render_element_pyproject_toml(kind, name)

Element package manifest — depends on the gen_def/gen_int workspace packages.

The implementation module lives at src/<name>.py and is shipped as the top-level module <name> ([tool.hatch.build] strips the src prefix).

Source code in dizzy/src/dizzy/generators/lib_python_uv.py
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
def render_element_pyproject_toml(kind: str, name: str) -> str:
    """Element package manifest — depends on the gen_def/gen_int workspace packages.

    The implementation module lives at ``src/<name>.py`` and is shipped as the
    top-level module ``<name>`` (``[tool.hatch.build]`` strips the ``src`` prefix).
    """
    return "\n".join(
        [
            "[project]",
            f'name = "{kind}-{name}"',
            'version = "0.1.0"',
            'requires-python = ">=3.11"',
            "dependencies = [",
            '    "gen_def",',
            '    "gen_int",',
            "]",
            "",
            "[tool.uv.sources]",
            "gen_def = { workspace = true }",
            "gen_int = { workspace = true }",
            "",
            "[build-system]",
            'requires = ["hatchling"]',
            'build-backend = "hatchling.build"',
            "",
            "[tool.hatch.build.targets.wheel]",
            'sources = ["src"]',
            f'include = ["src/{name}.py"]',
            "",
        ]
    )