Skip to main content

kcm-workspace

Classe base para os scripts de workspace baseados em docker compose (clone, setup, launch, shell, manage, git e outros).

Cada projeto tem, em <projeto>/workspace/<projeto>, um script que estende Workspace e informa no construtor o que é específico dele.

Uso

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.10"
# dependencies = ["kcm-workspace>=0.1.0"]
# ///
from kcm_workspace import GitClone, Workspace

GITBASE = "git@github.com:minha-org"


class Projeto(Workspace):
    def __init__(self):
        super().__init__(
            __file__,
            git_clones=[GitClone("app", f"{GITBASE}/app.git")],
            mk_volumes=["db"],
            cli_dict={"db": "psql"},
            shell_dict={"db": "sh"},
        )

    def collectstatic(self) -> int:
        """Coleta os estáticos. Aplica-se a: $services_names$"""
        return self._execute("docker compose exec web python manage.py collectstatic")


if __name__ == "__main__":
    Projeto.main()
  • GitClone.folder relativo é resolvido a partir da pasta do projeto (pai de workspace).
  • Um método vira comando quando a docstring termina com Aplica-se a: <escopos>.
  • Comandos desconhecidos são repassados para docker compose.
  • No Windows, use um wrapper <projeto>.ps1:
$nomeSemExtensao = (Get-Item $PSCommandPath).BaseName
uv run --script "$PSScriptRoot\$nomeSemExtensao" @args

Atributos disponíveis

project_name, project_dir, workspace_dir, volumes_dir, home, argv, git_clones, mk_volumes, moodle_plugins, cli_dict, shell_dict.

Métodos auxiliares

_execute(cmd, *args), _service_is_running(svc), _service_is_healthy(svc), _prefixed_envs(prefix), _resolve_django_service_and_args(), _verb.

Desenvolvimento

uv pip install -e ".[dev]"
pytest --cov=kcm_workspace

Metadata

Release files for kcm-workspace 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kcm-workspace 0.1.0
File Size Uploaded Provenance Actions
kcm_workspace-0.1.0.tar.gz 14.0 kB With provenance Details for kcm_workspace-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kcm-workspace 0.1.0
File Interpreter ABI Platform Actions
kcm_workspace-0.1.0-py3-none-any.whl Python 3 none any Details for kcm_workspace-0.1.0-py3-none-any.whl

Total release size: 24.9 kB

Release files / kcm_workspace-0.1.0.tar.gz

Download URL kcm_workspace-0.1.0.tar.gz
Size 14.0 kB
Tags Source
SHA-256 checksum
How to use checksums
5d2686af54d35a678ecf6b85e23913c6eae78a5bbbd624e67fcfcb94d6933709
BLAKE2b-256 checksum
How to use checksums
f8cf25d252649e2261edc07ad8204119f59c6a0c6de5b22e1426a94ac2d0c96f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / kcm_workspace-0.1.0-py3-none-any.whl

Download URL kcm_workspace-0.1.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2de977e6e96fa314895d0cdbf3628f0b96c02fc9cacef44096b5957f8362e34f
BLAKE2b-256 checksum
How to use checksums
9262aa04e5134892142b67114e3690489dab6112eb1205fed0829588e715328c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for kcm-workspace 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kcm_workspace-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page