Skip to content

docs(py): add a documentation site for the Python package - #366

Merged
jat255 merged 30 commits into
mainfrom
jat255/3w6z-python-docs-site
Sep 14, 2026
Merged

jat255 merged 30 commits into
mainfrom
jat255/3w6z-python-docs-site

Conversation

@jat255

@jat255 jat255 commented Sep 12, 2026 •

Copy link
Copy Markdown
Collaborator

This PR adds a documentation site for the Python package at /py/: a quartodoc API reference, an introduction page, a security and governance page, and a page describing the feature parity with the R implementation. The landing page's Python button now points there rather than at the package README on GitHub.

You can see what these look like from the nifty new doc preview action from #370:

R changes

The changes are only in the documentation — no package code changes with this PR.

  • _pkgdown.yml gains a navbar item on the right that links to the new Python site at https://posit-dev.github.io/commons/py/
  • extra.css puts the R logo before the package name in the navbar via a .navbar-brand::before rule, matching how the Python site shows its logo, with the two logo SVGs added under pkgdown/assets/logos/ via the root-level asset syncing described in the next section

The logos and figures are handled by the existing root-artifact syncing:

  • A new root-level logos/ directory is the single source for the two language marks, and scripts/sync-shared.sh copies it into pkg-py/docs/assets/logos/ and pkg-r/pkgdown/assets/logos/; the Python site's provenance marker SVGs come from the already-shared www/commons-chat/figs, copied into pkg-py/docs/assets/figs/.
  • verify-shared-synced.yaml picks up the new source and destination paths so CI fails on a stale copy.

Screenshots

Python home page

Note the python logo in the top left, and a link to the R version of the package on the top right

image

API Reference built with quartodoc

image

R homepage, showing R logo in top left and link to python package in top right:

image
Agent-written details

Refs kata 3w6z.

The pages cover the ground the R vignettes cover, and leave out what the Python package does not have rather than describing the R behaviour: no code-execution row in the provenance-outcome table, no warehouse semantic layer section, no agent skill or trajectory review.

That matters most on the governance page. No tool runs model-written Python, so the sandboxing, network, and subprocess material has no counterpart, and the page says so plainly instead of leaving the question open. Going the other way, the SQL check parses with sqlglot and allowlists read-only statement shapes, so it catches writes hidden inside a read that a first-word test admits.

Two claims drafted from R behaviour were wrong for Python and were corrected before filing: definitions compile only for DuckDB, Snowflake, and Databricks, and the guard's allowlist is wider than SELECT plus the set operations.

The two deploy workflows now share one non-PR concurrency group, because both push to gh-pages and a release triggers both.

Verified: ruff, pyrefly, and the 1499 pytest cases pass; the site builds clean from a fresh venv using the workflow's own install command; all eight external links and three internal anchors resolve.

@jat255 jat255 added documentation Improvements or additions to documentation py Affects the Python implementation needs-manual-review Agent-created work that needs a human review labels Sep 12, 2026
@jat255
jat255 added this pull request to stack #367 September 12, 2026 15:51
@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployed to Connect (dogfood.team.pct.posit.it): https://dogfood.team.pct.posit.it/connect/#/apps/d7a36cae-8f27-448b-a478-61b81fbe3942/draft/370347

Deployed from commit a29f449.

@github-actions

github-actions Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployed to Connect (connect.staging.pct.posit.it): https://connect.staging.pct.posit.it/connect/#/apps/ad662e1b-5048-4acc-9ad7-f9478c92274e/draft/2905

Deployed from commit a29f449.

Base automatically changed from shared-site to main September 13, 2026 20:41
@simonpcouch
simonpcouch force-pushed the jat255/3w6z-python-docs-site branch from 6eb4e83 to 3677a7d Compare September 13, 2026 20:41
@jat255
jat255 force-pushed the jat255/3w6z-python-docs-site branch from 3677a7d to 8f6e2ee Compare September 13, 2026 21:29
@jat255 jat255 removed the needs-manual-review Agent-created work that needs a human review label Sep 13, 2026
Set up a Quarto project under pkg-py/docs that builds the API reference with
quartodoc. The reference sections match the ones the R site groups its topics
into, minus trajectories, which the Python package does not have.

The site renders in place, and the workflow copies it to docs/py before the
deploy, because Quarto warns and declines to clean its own output when the
output directory sits outside the project. The deploy reuses the pkgdown
workflow's action and its clean: false setting, so each site owns a
subdirectory of gh-pages without erasing the other.

griffe is held below 2 because quartodoc 0.11.1 passes it a docstring parser
option that griffe 2 removed.

Building the reference surfaced a docstring defect in commons.ui.server(): a
closing paragraph sat inside the numpydoc Parameters block, so its words were
parsed as parameter names. Moved it above the block.
The introduction covers the ground the R vignette covers: the trust flow and
where each provenance outcome comes from, the semantic and context layers,
data sources and dictionaries, and the chat UI. It leaves out what the Python
package does not have, rather than describing the R behaviour: there is no
code-execution path in the outcome table, no warehouse semantic layer section,
and no agent skill or trajectory review.

The governance page answers the same questions for Python. Two differences
from the R page carry weight. The SQL check parses the statement with sqlglot
and allowlists read-only shapes, so it catches writes hidden inside a read
that a first-word test admits. And no tool runs model-written code, so the
sandboxing, network, and subprocess material has no counterpart; the page says
so plainly instead of leaving the question open.

The landing page's Python button and get-started paragraph now point at the
site rather than at the package README on GitHub.
Both site workflows push to gh-pages, and a release or a change under docs/
triggers both. With a concurrency group each, the two runs could push at the
same time and one site's update would be lost. One shared group for non-PR
runs makes the second wait instead.
The introduction said definitions compile to the dialect of the source, with
no limit. Only DuckDB, Snowflake, and Databricks have an emitter, so a
PostgreSQL engine carrying a dictionary with definitions fails at
construction. The page now states that alongside the other construction
errors.

The governance page enumerated the SQL guard's allowlist and got the
enumeration short: _READ_ONLY also holds Subquery, Values, and Pivot. It now
gives SELECT and the set operations as examples rather than as the whole set,
and describes the rejected forms as the tree search the guard performs instead
of as a flat keyword list.
Move the two navbar language marks to logos/ at the repository root and
sync them into both documentation sites, like the other shared sources.
The copies are served as they stand, so destinations marked :bare skip
the generated README.
Show the R logo beside the package name and a Python-logo link to the
Quarto site in the navbar, mirroring the Python site. The link is
absolute because the dev-mode site builds under /r/dev/. The R logo is
the synced copy under pkgdown/assets/logos/.
Mirror the R docs structure: the root page is a general introduction
with installation instructions, and Introduction to commons moves to
its own Get started page.
Sync the shared provenance-marker figs into the docs assets, port the
vignette's inline-marker CSS rule, and mark the example verified answer
in the blockquote, as the R vignette does.
Add the provenance markers to the outcomes table, rewrite the
measure-parameter paragraph in plainer English with an example, give
examples for table selection and warehouse catalogs, and use named
client=/data_sources= arguments in every user-facing Commons() call,
as the constructor names them.
@jat255
jat255 force-pushed the jat255/3w6z-python-docs-site branch from ff748d9 to a3c12bf Compare September 13, 2026 22:09
@jat255
jat255 marked this pull request as ready for review September 13, 2026 22:09
@jat255 jat255 added the r Affects the R implementation label Sep 13, 2026
@jat255
jat255 force-pushed the jat255/3w6z-python-docs-site branch from b58767a to 4ca7918 Compare September 13, 2026 22:45
@jat255
jat255 removed this pull request from stack #367 September 13, 2026 22:47
@jat255
jat255 added this pull request to stack #371 September 13, 2026 22:47
@posit-dev posit-dev deleted a comment from github-actions Bot Sep 13, 2026
@posit-dev posit-dev deleted a comment from github-actions Bot Sep 13, 2026
The sticker becomes a synced root artifact so the landing page and the
Python site share one source, rather than each carrying its own copy.
The R site keeps taking it from man/figures/logo.png, pkgdown's
convention.
The root README already linked it; the landing page and the Python site
named PyPI without linking it.
Documentation in [project.urls] puts the site in PyPI's sidebar, which
had only the repository and the issue tracker.

@simonpcouch simonpcouch left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, looks good!

FYI, the pkgdown Action to publish the production version of https://posit-dev.github.io/commons/r/ (e.g. 0.1.0) will not push to the main site after merging here since the R DESCRIPTION version is now dev 0.1.0.9000. It's a bit fiddly to get this right; I can make it happen after merge.

@jat255
jat255 merged commit c667bbb into main Sep 14, 2026
20 checks passed
@github-actions

Copy link
Copy Markdown
Contributor

Cleaned up 10 preview bundle(s) on https://dogfood.team.pct.posit.it: 370328, 370331, 370334, 370338, 370339, 370340, 370342, 370343, 370346, 370347

@github-actions

Copy link
Copy Markdown
Contributor

Cleaned up 10 preview bundle(s) on https://connect.staging.pct.posit.it: 2893, 2894, 2895, 2898, 2899, 2900, 2901, 2902, 2904, 2905

@jat255
jat255 deleted the jat255/3w6z-python-docs-site branch September 14, 2026 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation py Affects the Python implementation r Affects the R implementation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants