Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Split the Python `Commons` agent into a commons object and an agent

Abierto
#459 0 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@jat255 ya está trabajando en esto.

Desde el 28/10/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

enhancement py

#414 splits R's commons() into two parts. commons() gathers the data sources, semantic layer, and context layer into an object that code can call without a model, and agent() builds the agent around that object. In Python, commons.Commons is still the agent, so the same name means different things in the two packages, and Python has no way to call trusted calculations without an agent.

This issue is to give Python the same split, with the same methods and the same deprecation path for the old call form.

Agent-written details

What R has after #414

  • commons(data_sources=, semantic_layer=, context_layer=) returns an object with these methods: search(), measure(), metrics(), calculation(), context(), describe(), and run_sql(). The methods return plain values (data frames or text), without handles.
  • agent(client, commons=, ...) builds the agent from that object, and the agent exposes the object as agent$commons.
  • The old form, commons(client, ...), still builds an agent, with a deprecation warning.
  • metrics(where=) also accepts a SQL-like string ("region = 'EMEA' AND revenue > 0") or unnamed triples. A value parsed from a quoted literal stays a string, so '001' does not become the number 1.
  • The printed object lists its tables, its measures, and the signatures of its methods. It hides the calculation methods that have nothing to run.

Open questions for Python

  • What to call each part. Commons is the agent class today. One option is a new Agent class, with Commons becoming the data object. In that case, Commons(client, ...) can detect a chatlas.Chat as its first argument, warn, and return an agent, as R does.
  • Where shared behaviour goes. The where string grammar and the method names in the search text are behaviour users can see in both packages. They belong in tests/shared/ as fixtures, not as a copy for each language.

Reference

  • R implementation: pkg-r/R/commons.R and pkg-r/R/agent.R in #414.
  • Python agent today: pkg-py/src/commons/_agent.py.
  • Tracked in kata as r4tp.
Lenguaje dominante
Python
Estrellas
64
Forks
4
Merge medio
2 d 18 h
PR fusionados (30 d)
22

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de posit-dev/commons

Todos los issues de posit-dev/commons

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.