Skip to content

CI-1802: Expand and correct the SDK docstrings - #223

Open
sminot wants to merge 7 commits into
mainfrom
docstrings
Open

CI-1802: Expand and correct the SDK docstrings#223
sminot wants to merge 7 commits into
mainfrom
docstrings

Conversation

@sminot

@sminot sminot commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Users may want to automate interaction with Cirro using AI assistants via the python SDK. This PR expands the documentation provided with that library to streamline the process. There were also some errors that were caught in the process.

No code changes.

Written by Claude, reviewed by @sminot

sminot and others added 4 commits August 19, 2026 11:08
The `cirro` and `cirro.sdk` packages had no module docstrings, so the pdoc
landing page and `help(cirro)` -- the first place a reader lands -- said
nothing about how to authenticate or how the classes relate.

`DataPortal()` falls through to a device-code login that blocks on a browser
flow, which hangs in any non-interactive context. Neither the constructor nor
`DataPortalLogin` mentioned this or pointed at `ClientCredentialsAuth`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Four docstring examples opened with `from cirro import DataPortal()`, which is
a SyntaxError. Two `Returns:` blocks named an import statement rather than the
type returned.

`run_analysis` documented `params` only as "Analysis parameters", with no
pointer to `get_parameter_spec`, which is the only way to learn what keys a
process accepts. It also did not say that the call is asynchronous or how to
follow the resulting dataset.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Several properties return a snapshot that never updates, which reads as a hang
when polling a running analysis: `dataset.status` is fixed at construction, and
`dataset.logs` / `dataset.tasks` are `cached_property`, so an empty log read
before the job starts stays empty for the object's lifetime. Each now says to
re-fetch the dataset.

`dataset.logs`, `dataset.get_logs()` and `task.logs` are three different logs
with near-identical names; each now says which one it is and points at the
others. `list_files` and `samples` now state that they truncate silently, and
`force_refresh` says what it discards.

Also documents the members that had no docstring at all -- `file_count`,
`total_size_bytes`, `total_size`, `developer_helper`, `absolute_path`, the two
`get_by_id` overrides that only raise -- and the lookup helpers on
`DataPortalAssets`, which are what make every `list_*` result more than a list.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The corpus mixed three dialects -- Google sections, reStructuredText roles and
literals, and Markdown fences -- sometimes within one docstring. `make_docs.py`
sets `docformat="google"`, and raw `help()` output shows the RST verbatim, so
RST roles and ``literals`` are converted to Markdown backticks throughout.

`DataPortalDataset.read_files` / `read_file` deferred to their `DataPortal`
equivalents for the glob and pattern rules, leaving the docstring on the object
you actually hold nearly empty; both are now self-contained.

Fills in the Args, Returns and Raises sections still missing on the file-reading
mixin, file downloads, the developer helpers, and `CirroApi.__init__`.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sminot sminot changed the title Make the SDK docstrings usable as the SDK's instruction manual Expand and correct the SDK docstrings Aug 19, 2026
sminot and others added 2 commits August 19, 2026 11:29
The head node may be running Nextflow or Cromwell depending on the process
executor, so `dataset.logs` no longer calls it Nextflow's output. `get_logs`
reads the `WORKFLOW_LOGS` artifact for either. `get_trace` stays Nextflow-only,
since a Cromwell analysis produces no trace artifact -- now stated, along with
Cromwell as a reason the artifact can be missing.

`status` no longer enumerates the `Status` values. The list had omitted
`DELETE`, and hardcoding a generated enum into a docstring only invites drift;
it now points at `cirro_api_client.v1.models.Status` and names the values an
analysis actually moves through.

Restore the RST literals in `_pattern_to_captures_regex`. It is private, so pdoc
renders no member section for it and `help()` is never called on it -- the only
way anyone reads that docstring is as source, where the doubled delimiters mark
where a punctuation literal like `*` or `**` starts and ends.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Rendering the pages before and after the conversion produces byte-identical
HTML: pdoc already turns :func:`pandas.read_csv` into `pandas.read_csv()` and
``DataFrame`` into `DataFrame` under docformat="google", so the conversion was
reproducing by hand what pdoc does anyway. It also discarded semantic markup
that a Sphinx build would resolve into real links, and left `cirro/services`
inconsistent with `cirro/sdk`.

The docstrings rewritten for content keep the local style: RST for inline
literals, Markdown fences for code blocks, matching DataPortal.read_files.

task.py is no longer touched -- its whole diff was this churn.

Two cross-references drop the `~` prefix, which pdoc does not honour: it renders
":meth:`~cirro.sdk.portal.DataPortal.read_files`" with the tilde still in the
text, on main as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@sminot sminot changed the title Expand and correct the SDK docstrings CI-1802: Expand and correct the SDK docstrings Aug 24, 2026
# Conflicts:
#	cirro/sdk/file.py
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant