From d6f921eab65fa0d5f5cbd1aa5d018721ed43c786 Mon Sep 17 00:00:00 2001 From: Siarhei Siniak Date: Wed, 7 May 2025 17:44:01 +0300 Subject: [PATCH] [+] partially add pyproject.toml generation --- .../fxreader/pr34/commands_typed/cli.py | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/python/online/fxreader/pr34/commands_typed/cli.py b/python/online/fxreader/pr34/commands_typed/cli.py index fee6e21..a4095a2 100644 --- a/python/online/fxreader/pr34/commands_typed/cli.py +++ b/python/online/fxreader/pr34/commands_typed/cli.py @@ -556,6 +556,9 @@ class CLI(abc.ABC): # force: bool, argv: Optional[list[str]] = None, ) -> None: + import tomlkit + import tomlkit.items + from . import cli_bootstrap from . import argparse as pr34_argparse @@ -599,4 +602,36 @@ class CLI(abc.ABC): for o in pyproject.modules ] + modules: dict[ + str, + cli_bootstrap.PyProject.Module + ] = { + o.name : o + for o in pyproject.modules + } + + module = modules[options.module] + + with io.open(options.file, 'rb') as f: + pyproject2 = tomlkit.load(options.file) + + with io.open( + project.source_dir / 'pyproject.toml', + 'w', + ) as f: + p = pyproject2['project'] + assert isinstance(p, tomlkit.items.Item) + n = p['name'] + assert isinstance(n, tomlkit.items.Item) + n = module.name + + del n + del p + + tomlkit.dump( + pyproject2, + f + ) + del pyproject2 + raise NotImplementedError