From 4bd86a8880c18db24be1dbb0c944e196464e05b7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 11:36:14 +0200 Subject: [PATCH 01/18] shell/step --- spcd/shell.py | 5 +++++ spcd/util.py | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/spcd/shell.py b/spcd/shell.py index f9f9b33..f0c7f8c 100644 --- a/spcd/shell.py +++ b/spcd/shell.py @@ -3,3 +3,8 @@ import importlib env = importlib.import_module("env") + +try: + step = int(env.SPCD_STEP) +except AttributeError: + step = 1 diff --git a/spcd/util.py b/spcd/util.py index a77691a..76cb0f0 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -7,7 +7,7 @@ from urllib.parse import urlparse, urlunparse from rwx import fs from rwx.log import stream as log -from spcd.shell import env +from spcd import env, shell def add_url_path(url: str, extra_path: str) -> str: @@ -57,7 +57,7 @@ def split() -> None: def step(text: str) -> None: """Increment the step number of the current build process.""" - env.SPCD_STEP += 1 + shell.step += 1 log.info(env.SPCD_DOWN) - log.info(f"{env.SPCD_VERT} {env.SPCD_STEP} {text}") + log.info(f"{env.SPCD_VERT} {shell.step} {text}") log.info(env.SPCD___UP) From 400fefeecc8ad4335e3a8f908dab154943d2b890 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 15:55:12 +0200 Subject: [PATCH 02/18] self/:useless --- spcd/project.py | 4 ++-- spcd/projects.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spcd/project.py b/spcd/project.py index 709d554..6074e0d 100644 --- a/spcd/project.py +++ b/spcd/project.py @@ -27,7 +27,7 @@ ROOT = [ class Project: """Current project.""" - def __init__(self: Project, projects: Projects) -> None: + def __init__(self, projects: Projects) -> None: """Set projects, branch, name, root & url.""" self.projects = projects # branch @@ -45,7 +45,7 @@ class Project: # url self.url = add_url_path(projects.url, self.name) - def __str__(self: Project) -> str: + def __str__(self) -> str: """List branch, name, root & url.""" return f"""\ branch = {self.branch} diff --git a/spcd/projects.py b/spcd/projects.py index c1f2403..27b0334 100644 --- a/spcd/projects.py +++ b/spcd/projects.py @@ -20,7 +20,7 @@ SERVER_URL = [ class Projects: """Other projects.""" - def __init__(self: Projects) -> None: + def __init__(self) -> None: """Set environment, group, name & url.""" self.environment = os.environ # group, name @@ -34,7 +34,7 @@ class Projects: if value := self.environment.get(variable, None): self.url = add_url_path(value, self.group) - def __str__(self: Projects) -> str: + def __str__(self) -> str: """List group, name & url.""" return f"""\ group = {self.group} From c7cb8316e9997af4a0c9324393ebd3dd7dcedd76 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sat, 14 Sep 2024 21:48:38 +0200 Subject: [PATCH 03/18] pylint --- spcd/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spcd/__init__.py b/spcd/__init__.py index fbb64e7..e476484 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -66,6 +66,7 @@ def install_python_packages() -> None: "hatch", "mypy", "pelican", + "pylint", "pytest", "ruff", "sphinx", From 201ba91e004b891c40beeec748dc416734201410 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 00:03:48 +0200 Subject: [PATCH 04/18] rename --- spcd/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spcd/__init__.py b/spcd/__init__.py index e476484..13584c8 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -88,7 +88,7 @@ def list_environment_variables() -> None: log.info(f"{variable}") -def main(main: str) -> None: +def main(main_file: str) -> None: """Entry point to initialize environment or run a specific command.""" paths = environ["PATH"].split(pathsep) if env.SPCD_PYTHON_VENV_BINARIES not in paths: @@ -99,7 +99,7 @@ def main(main: str) -> None: list_environment_variables() clone_project_branch() set_ssh() - install_commands(main) + install_commands(main_file) install_python_packages() else: f = getattr(cmd, name.replace("-", "_")) From 10941ad0d8dd852ee4f896ae4055dcaee3ff8f86 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 00:09:47 +0200 Subject: [PATCH 05/18] step/upper --- spcd/shell.py | 4 ++-- spcd/util.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/spcd/shell.py b/spcd/shell.py index f0c7f8c..0a587e7 100644 --- a/spcd/shell.py +++ b/spcd/shell.py @@ -5,6 +5,6 @@ import importlib env = importlib.import_module("env") try: - step = int(env.SPCD_STEP) + STEP = int(env.SPCD_STEP) except AttributeError: - step = 1 + STEP = 1 diff --git a/spcd/util.py b/spcd/util.py index 76cb0f0..13b162d 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -57,7 +57,7 @@ def split() -> None: def step(text: str) -> None: """Increment the step number of the current build process.""" - shell.step += 1 + shell.STEP += 1 log.info(env.SPCD_DOWN) - log.info(f"{env.SPCD_VERT} {shell.step} {text}") + log.info(f"{env.SPCD_VERT} {shell.STEP} {text}") log.info(env.SPCD___UP) From 844543f7559091baec2e3a06258d5366938bea3f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 00:43:23 +0200 Subject: [PATCH 06/18] =?UTF-8?q?=C3=974=20cyclic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spcd/util.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spcd/util.py b/spcd/util.py index 13b162d..4148e93 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -7,7 +7,8 @@ from urllib.parse import urlparse, urlunparse from rwx import fs from rwx.log import stream as log -from spcd import env, shell +from spcd import shell +from spcd.shell import env def add_url_path(url: str, extra_path: str) -> str: From e0da3ad50c734ee38b656d608996b81acf2637b7 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 01:00:17 +0200 Subject: [PATCH 07/18] %s --- spcd/__init__.py | 10 +++++----- spcd/util.py | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/spcd/__init__.py b/spcd/__init__.py index 13584c8..c18166b 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -26,10 +26,10 @@ def clone_project_branch() -> None: split() log.info(project) split() - log.info(f"""\ -{project.url} + log.info("""\ +%s ↓ -""") +""", project.url) run( "git", "clone", @@ -83,9 +83,9 @@ def list_environment_variables() -> None: step("List environment variables") for variable, value in sorted(projects.environment.items()): if variable not in ["SPCD", "SPCD_SSH_KEY"]: - log.info(f"{variable} = {value}") + log.info("%s = %s", variable, value) else: - log.info(f"{variable}") + log.info("%s", variable) def main(main_file: str) -> None: diff --git a/spcd/util.py b/spcd/util.py index 4148e93..66fd269 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -43,12 +43,12 @@ def cat(file: Path) -> None: def frame(text: str) -> None: """Open a new frame in the log output.""" - log.info(f"{env.SPCD_OPEN}{text}") + log.info("%s%s", env.SPCD_OPEN, text) def shut(text: str) -> None: """Close current frame in the log output.""" - log.info(f"{env.SPCD_SHUT}{text}") + log.info("%s%s", env.SPCD_SHUT, text) def split() -> None: @@ -60,5 +60,5 @@ def step(text: str) -> None: """Increment the step number of the current build process.""" shell.STEP += 1 log.info(env.SPCD_DOWN) - log.info(f"{env.SPCD_VERT} {shell.STEP} {text}") + log.info("%s %s %s", env.SPCD_VERT, shell.STEP, text) log.info(env.SPCD___UP) From d3d09445a06ed48b8b46433e86dd150a638255ae Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 01:14:39 +0200 Subject: [PATCH 08/18] project/repr --- spcd/project.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spcd/project.py b/spcd/project.py index 6074e0d..89be501 100644 --- a/spcd/project.py +++ b/spcd/project.py @@ -45,6 +45,10 @@ class Project: # url self.url = add_url_path(projects.url, self.name) + def __repr__(self) -> str: + """List branch, name, root & url.""" + return f"Project(projects={self.projects!r})" + def __str__(self) -> str: """List branch, name, root & url.""" return f"""\ From 725bf8b981c24b7f2e5b50fea7e0a25278d2ca7b Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 01:19:51 +0200 Subject: [PATCH 09/18] projects/repr --- spcd/project.py | 2 +- spcd/projects.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/spcd/project.py b/spcd/project.py index 89be501..c295d57 100644 --- a/spcd/project.py +++ b/spcd/project.py @@ -46,7 +46,7 @@ class Project: self.url = add_url_path(projects.url, self.name) def __repr__(self) -> str: - """List branch, name, root & url.""" + """Represent project.""" return f"Project(projects={self.projects!r})" def __str__(self) -> str: diff --git a/spcd/projects.py b/spcd/projects.py index 27b0334..5185feb 100644 --- a/spcd/projects.py +++ b/spcd/projects.py @@ -34,6 +34,10 @@ class Projects: if value := self.environment.get(variable, None): self.url = add_url_path(value, self.group) + def __repr__(self) -> str: + """Represent projects.""" + return "Projects()" + def __str__(self) -> str: """List group, name & url.""" return f"""\ From b112043e1019733b5ea95f70b52c21aa4c2c1415 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 15:03:31 +0200 Subject: [PATCH 10/18] pyproject/pydoclint --- pyproject.toml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 3e5d6d7..06f8b3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,6 +31,11 @@ requires-python = ">= 3.11" [tool.hatch.version] path = "spcd/__init__.py" +[tool.pydoclint] +allow-init-docstring = true +skip-checking-short-docstrings = false +style = "sphinx" + [tool.ruff] line-length = 80 From 69b06db6adb68d3f1ab1ae91f8f0737c36758525 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 15:04:52 +0200 Subject: [PATCH 11/18] pydoclint --- spcd/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/spcd/__init__.py b/spcd/__init__.py index c18166b..85fa914 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -66,6 +66,7 @@ def install_python_packages() -> None: "hatch", "mypy", "pelican", + "pydoclint", "pylint", "pytest", "ruff", From ae015fdfc4fc00cce64b5cb760553f944ab44a94 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Sun, 15 Sep 2024 22:44:49 +0200 Subject: [PATCH 12/18] tasks/link --- readme.md | 1 + 1 file changed, 1 insertion(+) diff --git a/readme.md b/readme.md index df9ea36..bee7dab 100644 --- a/readme.md +++ b/readme.md @@ -286,6 +286,7 @@ Handle project workflows in a unified way: * automate versions fetching * gource, xvfb, xauth * handle openh264 repositories +* link from workspace to actions root * rpm fusion * tex * translate to french From ba8c9baa5413b844f131bd38a8562e5859e44d90 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 16 Sep 2024 01:03:41 +0200 Subject: [PATCH 13/18] doc/frame,shut,step --- spcd/util.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/spcd/util.py b/spcd/util.py index 66fd269..8dda359 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -42,12 +42,20 @@ def cat(file: Path) -> None: def frame(text: str) -> None: - """Open a new frame in the log output.""" + """Open a new frame in the log output. + + :param text: text to start the frame with + :type text: str + """ log.info("%s%s", env.SPCD_OPEN, text) def shut(text: str) -> None: - """Close current frame in the log output.""" + """Close current frame in the log output. + + :param text: text to shut the frame with + :type text: str + """ log.info("%s%s", env.SPCD_SHUT, text) @@ -57,7 +65,11 @@ def split() -> None: def step(text: str) -> None: - """Increment the step number of the current build process.""" + """Increment the step number of the current build process. + + :param text: text to display + :type text: str + """ shell.STEP += 1 log.info(env.SPCD_DOWN) log.info("%s %s %s", env.SPCD_VERT, shell.STEP, text) From 40bb13c39af534c0cf58084315465b7b68b5fe8f Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 16 Sep 2024 01:08:25 +0200 Subject: [PATCH 14/18] doc/browse,cat --- spcd/util.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spcd/util.py b/spcd/util.py index 8dda359..2f8a7ab 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -19,7 +19,11 @@ def add_url_path(url: str, extra_path: str) -> str: def browse(root: Path) -> None: - """Frame the browsing of a root directory in the log output.""" + """Frame the browsing of a root directory in the log output. + + :param root: directory to browse + :type root: Path + """ paths = [] for directory, _, files in os.walk(root): for file in files: @@ -34,7 +38,11 @@ def browse(root: Path) -> None: def cat(file: Path) -> None: - """Frame the content of a file in the log output.""" + """Frame the content of a file in the log output. + + :param file: file to read the content from + :type file: Path + """ text = str(file) frame(text) log.info(fs.read_file_text(file).rstrip()) From 7251ca35faf79202c0e98d71cae265bfd3664702 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 16 Sep 2024 01:13:18 +0200 Subject: [PATCH 15/18] format --- spcd/__init__.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/spcd/__init__.py b/spcd/__init__.py index 85fa914..0df38c4 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -26,10 +26,13 @@ def clone_project_branch() -> None: split() log.info(project) split() - log.info("""\ + log.info( + """\ %s ↓ -""", project.url) +""", + project.url, + ) run( "git", "clone", From ac72fb13315af418b48170073c2ee4caee237158 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 16 Sep 2024 01:14:52 +0200 Subject: [PATCH 16/18] doc/add_url_path --- spcd/util.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/spcd/util.py b/spcd/util.py index 2f8a7ab..73a5309 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -12,7 +12,15 @@ from spcd.shell import env def add_url_path(url: str, extra_path: str) -> str: - """Append an extra segment to an existing URL.""" + """Append an extra segment to an existing URL. + + :param url: base URL + :type url: str + :param extra_path: path to append + :type extra_path: str + :return: new URL + :rtype: str + """ parts = urlparse(url) parts = parts._replace(path=str(Path(parts.path) / extra_path)) return urlunparse(parts) From 0d1ad96295386732d4243fe55a878caed50416c5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 16 Sep 2024 01:18:03 +0200 Subject: [PATCH 17/18] doc/quiet --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 06f8b3b..103539a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,6 +33,7 @@ path = "spcd/__init__.py" [tool.pydoclint] allow-init-docstring = true +quiet = true skip-checking-short-docstrings = false style = "sphinx" From f0aa902904880dc72e52fe1d633b82940e6de1b5 Mon Sep 17 00:00:00 2001 From: Marc Beninca Date: Mon, 16 Sep 2024 01:40:27 +0200 Subject: [PATCH 18/18] doc/projects --- spcd/projects.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/spcd/projects.py b/spcd/projects.py index 5185feb..c64e3b3 100644 --- a/spcd/projects.py +++ b/spcd/projects.py @@ -35,11 +35,19 @@ class Projects: self.url = add_url_path(value, self.group) def __repr__(self) -> str: - """Represent projects.""" + """Represent projects. + + :return: representation + :rtype: str + """ return "Projects()" def __str__(self) -> str: - """List group, name & url.""" + """List group, name & url. + + :return: string + :rtype: str + """ return f"""\ group = {self.group} name = {self.name}