Init API

class projectutils.init.Tree(nodes: list[projectutils.init.Node])
create(directory: pathlib.Path | str)

Recursively create whole tree.

_abc_impl = <_abc._abc_data object>
class projectutils.init.Directory(path: str, childs: Optional[list[projectutils.init.Node]] = None)

Node that represents a directory with childs.

Creating a directory will recursively creat all childs.

create()
_get_direct_child_node(node, child_name)
_abc_impl = <_abc._abc_data object>
class projectutils.init.File(path: str, content: str, optional: bool = False, warning: Optional[str] = None)

Node that represents a file with content.

Additional optional and warning attributes may be passed to constructor. If optional is True (default) a FileNotFoundError will be rised if the file exists at creation time. If optional is False, only a warning (if any) will be printed to the screen.

create()
warn()
_abc_impl = <_abc._abc_data object>
class projectutils.init.Node(path: str)

Base class for nodes.

abstract create()
_abc_impl = <_abc._abc_data object>
class projectutils.init.chdir(path)

Non thread-safe context manager to change the current working directory. In the future replace with built-in version: https://github.com/python/cpython/pull/28271

_abc_impl = <_abc._abc_data object>