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.2.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"),
GitClone("lib", f"{GITBASE}/lib.git", "dev"),
],
mk_volumes=["db"],
hosts=("PROJETO", "127.0.0.1 projeto.local"),
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.folderrelativo é resolvido a partir da pasta do projeto (pai deworkspace).GitClone.branchvazio clona a branch padrão do remoto.- Após clonar, roda
pre-commit installnos repositórios com.pre-commit-config.yaml. hosts=(nome, linha)adiciona a linha ao arquivo de hosts nosetup.compress_pluginsgrava emplugins_build_dir(relativo ao projeto; padrãoworkspace/build/plugins) com o nomeplugin_package_name(padrão{plugin}-{version}.zip).- 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, hosts,
plugins_build_dir, plugin_package_name.
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.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| kcm_workspace-0.2.0.tar.gz | 15.2 kB | With provenance | Details for kcm_workspace-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| kcm_workspace-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for kcm_workspace-0.2.0-py3-none-any.whl |
Total release size: 26.8 kB
Release files / kcm_workspace-0.2.0.tar.gz
| Download URL | kcm_workspace-0.2.0.tar.gz |
|---|---|
| Size | 15.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2027be99342bc4f3e009f88e24c260879a2f69a32027c6d86919e60505c2e260
|
|
BLAKE2b-256 checksum How to use checksums |
c9757f17380f47c9cc903515fb10c570b65bef487531501b3f92c0c223724577
|
| 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 logRelease files / kcm_workspace-0.2.0-py3-none-any.whl
| Download URL | kcm_workspace-0.2.0-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
82b5b20bc76bee0e39d62dfe2579968e2fb55c0b6ac61a8e869537de993dc609
|
|
BLAKE2b-256 checksum How to use checksums |
19d2e75d3c4019adbdc72181248455817ff8ae21350752e0aaf5ac0de975553e
|
| 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 logSecurity for kcm-workspace 0.2.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.
Attestation for kcm_workspace-0.2.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 logA 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.