Sistema de Control de Instruccion por Comandos
Project description
SCIC 0.2.0
SCIC (Sistema de Control de Instrucción por Comandos) registra, organiza, resuelve y ejecuta funciones Python mediante instrucciones textuales.
context1 context2 function parameters...
Una función se implementa una vez y puede consumirse desde CLI, WebGUI, DesktopGUI, API, SDK, scripts o automatizaciones.
Principios
- El árbol sólo contiene
ContextyExecutable. - Los nombres son únicos dentro de su contexto padre.
- Una función registrada sigue siendo un
callablePython ordinario. Executabledeclara parámetros y resultados medianteDataValue.- Los contratos usan validación posicional explícita.
- El registro compartido no contiene estado de navegación.
- Cada consumidor utiliza su propia
SCICSession. - Las interfaces controlan ayuda, presentación, progreso y procesos compuestos.
- La API primaria de ejecución es asíncrona.
Dependencias
resourcetree >= 0.2.0, < 0.3.0
datavalue >= 0.2.0, < 0.3.0
Instalación
python3 -m pip install .
Para desarrollo:
python3 -m pip install -e ".[test]"
pytest
Uso
from datavalue import ComplexData, PrimitiveData, ValidationMode
from scic import Executable, SCIC
def primitive(data_type, name, **constraints):
return PrimitiveData(
data_type=data_type,
value=None,
name=name,
data_class=True,
**constraints,
)
def signature(name, *schemas):
return ComplexData(
data_type=list,
value=None,
name=name,
possible_values=schemas,
data_class=True,
validation_mode=ValidationMode.POSITIONAL,
)
def add(number_a: int, number_b: int) -> int:
return number_a + number_b
scic = SCIC()
math = scic.create_context("math")
adapter = Executable(
name="add",
description="Suma dos enteros.",
parameters=signature(
"parameters",
primitive(int, "number_a"),
primitive(int, "number_b"),
),
results=signature(
"results",
primitive(int, "sum"),
),
)
scic.register_function(
adapter=adapter,
function=add,
context=math,
)
scic.freeze()
session = scic.create_session()
results = await session.execute(
"math add 20 22"
)
assert results == [42]
Navegación relativa
await session.execute("math")
assert session.context_path == "scic/math"
results = await session.execute("add 10 5")
assert results == [15]
session.back()
session.reset()
El nombre de la raíz permite resolución absoluta sin modificar el contexto:
results = await session.execute(
"scic math add 7 8"
)
Sesiones independientes
cli = scic.create_session()
browser_a = scic.create_session()
browser_b = scic.create_session()
cli.enter("math")
browser_a.enter("user")
browser_b.enter("text")
Todos comparten el mismo árbol y las mismas funciones, pero conservan su propio contexto activo.
Autodescripción
session.describe()
session.describe("math add")
session.list_context()
scic.export_tree()
La salida es estructurada. Cada consumidor decide si la transforma en texto, HTML, JSON, widgets o documentación.
Ejemplos
CLI:
python3 examples/cli.py
WebGUI con una sesión independiente por navegador:
python3 examples/webgui.py
Abrir:
http://localhost:8080
Límites intencionales
El núcleo no administra:
- Presentación.
- Permisos o roles.
- Procesos interactivos compuestos.
- Progreso.
- HTTP.
- Qt o HTML.
- Persistencia.
- Logging.
- Ejecución remota.
Estas capacidades pertenecen a la aplicación o a sus consumidores.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scic_framework-0.2.3.tar.gz.
File metadata
- Download URL: scic_framework-0.2.3.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e73f9cad7431b6b2a3438c9243fdabe456bdd9bb9e592241a9c8ef7d6e12691
|
|
| MD5 |
d005a8638f0d79f22ffef3ed0a0309a4
|
|
| BLAKE2b-256 |
a986c2f4b5cd73615a659cb5122218b6304ec48e7a7dc19f78c004947848b7d5
|
File details
Details for the file scic_framework-0.2.3-py3-none-any.whl.
File metadata
- Download URL: scic_framework-0.2.3-py3-none-any.whl
- Upload date:
- Size: 10.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bdc750fe8e6656a13acde6ccba6193bfe5128ebceb82c7dd2cef7e5cdd25f72
|
|
| MD5 |
0f93f56901ee937b1b41154822d054ba
|
|
| BLAKE2b-256 |
f421b4720f7a939f176968158b724fe9053fabff1525908f3f218c2453112db3
|