diff --git a/spcd/__init__.py b/spcd/__init__.py index 4cf789e..a6f35d0 100644 --- a/spcd/__init__.py +++ b/spcd/__init__.py @@ -19,7 +19,6 @@ COMMANDS_PREFIX = "spcd-" def clone_project_branch() -> None: - """Clone project on triggering branch into the current workspace.""" if not projects.environment.get("GITLAB_CI"): step("Clone project branch") log.info(projects) @@ -42,7 +41,6 @@ def clone_project_branch() -> None: def install_commands(path: str) -> None: - """Make commands callable in the operating system.""" step("Install commands") user = Path("/usr/local/bin") for command in [ @@ -56,13 +54,11 @@ def install_commands(path: str) -> None: def install_python_packages() -> None: - """Upgrade pip then install extra Python packages.""" step("Install Python packages") log.info("pip") run("pip", "install", "--upgrade", "pip") split() packages = [ - "hatch", "mypy", "pelican", "pytest", @@ -77,7 +73,6 @@ def install_python_packages() -> None: def list_environment_variables() -> None: - """List accessible variables and their public contents.""" step("List environment variables") for variable, value in sorted(projects.environment.items()): if variable not in ["SPCD", "SPCD_SSH_KEY"]: @@ -87,7 +82,6 @@ def list_environment_variables() -> None: def main(main: 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: environ["PATH"] = pathsep.join([env.SPCD_PYTHON_VENV_BINARIES, *paths]) @@ -105,7 +99,6 @@ def main(main: str) -> None: def set_ssh() -> None: - """Set things up to enable access to targets through SSH.""" step("Set SSH") # get variables ssh_hosts = projects.environment.get("SPCD_SSH_HOSTS") diff --git a/spcd/ci.py b/spcd/ci.py index 7417869..4e22f01 100644 --- a/spcd/ci.py +++ b/spcd/ci.py @@ -1,5 +1,3 @@ -"""Continuous Integration.""" - from spcd.project import Project from spcd.projects import Projects diff --git a/spcd/cmd.py b/spcd/cmd.py index a1108ee..7cf0a0e 100644 --- a/spcd/cmd.py +++ b/spcd/cmd.py @@ -1,5 +1,3 @@ -"""Commands available for workflows.""" - import os from pathlib import Path @@ -11,12 +9,10 @@ from spcd.util import browse def spcd_browse_workspace() -> None: - """Browse the current workspace for the project.""" browse(project.root) def spcd_build_project() -> None: - """Perform the actual building process.""" for extension in ["py", "sh"]: path = Path(project.root) / f"build.{extension}" if path.exists(): @@ -27,14 +23,12 @@ def spcd_build_project() -> None: def spcd_check_project() -> None: - """Check the project for anything wrong.""" ps.run("ruff", "check") def spcd_synchronize( target: str | None = None, source: str | None = None ) -> None: - """Synchronize output towards a target.""" if not target: user = "cd" host = env.SPCD_PROJECT_PATH diff --git a/spcd/project.py b/spcd/project.py index de8b164..f45303e 100644 --- a/spcd/project.py +++ b/spcd/project.py @@ -1,4 +1,4 @@ -"""Continuous Integration project.""" +"""CI project.""" from __future__ import annotations @@ -25,10 +25,7 @@ ROOT = [ class Project: - """Current project.""" - def __init__(self: Project, projects: Projects) -> None: - """Set projects, branch, name, root & url.""" self.projects = projects # branch for variable in BRANCH: @@ -46,7 +43,6 @@ class Project: self.url = add_url_path(projects.url, self.name) def __str__(self: Project) -> str: - """List branch, name, root & url.""" return f"""\ branch = {self.branch} name = {self.name} diff --git a/spcd/projects.py b/spcd/projects.py index c1f2403..ca5d9e1 100644 --- a/spcd/projects.py +++ b/spcd/projects.py @@ -1,4 +1,4 @@ -"""Continuous Integration projects.""" +"""CI projects.""" from __future__ import annotations @@ -18,10 +18,7 @@ SERVER_URL = [ class Projects: - """Other projects.""" - def __init__(self: Projects) -> None: - """Set environment, group, name & url.""" self.environment = os.environ # group, name for variable in GROUP_AND_NAME: @@ -35,7 +32,6 @@ class Projects: self.url = add_url_path(value, self.group) def __str__(self: Projects) -> str: - """List group, name & url.""" return f"""\ group = {self.group} name = {self.name} diff --git a/spcd/util.py b/spcd/util.py index 9ea9dca..a73b251 100644 --- a/spcd/util.py +++ b/spcd/util.py @@ -1,5 +1,3 @@ -"""Basic utilities.""" - import os from pathlib import Path from urllib.parse import urlparse, urlunparse @@ -10,14 +8,12 @@ from rwx.log import stream as log def add_url_path(url: str, extra_path: str) -> str: - """Append an extra segment to an existing URL.""" parts = urlparse(url) parts = parts._replace(path=str(Path(parts.path) / extra_path)) return urlunparse(parts) def browse(root: str) -> None: - """Frame the browsing of a root directory in the log output.""" paths = [] for directory, _, files in os.walk(root): for file in files: @@ -31,29 +27,24 @@ def browse(root: str) -> None: def cat(file: str) -> None: - """Frame the content of a file in the log output.""" frame(file) log.info(fs.read_file_text(file).rstrip()) shut(file) def frame(text: str) -> None: - """Open a new frame in the log output.""" log.info(f"{env.SPCD_OPEN}{text}") def shut(text: str) -> None: - """Close current frame in the log output.""" log.info(f"{env.SPCD_SHUT}{text}") def split() -> None: - """Separate previous log outputs from the ones following.""" log.info(env.SPCD_SPLT) def step(text: str) -> None: - """Increment the step number of the current build process.""" env.SPCD_STEP += 1 log.info(env.SPCD_DOWN) log.info(f"{env.SPCD_VERT} {env.SPCD_STEP} {text}")