Skip to content

docs: make all RST code examples runnable in Python - #760

Open
wenddymacro wants to merge 1 commit into
igerber:mainfrom
wenddymacro:docs/fix-runnable-code-examples
Open

docs: make all RST code examples runnable in Python#760
wenddymacro wants to merge 1 commit into
igerber:mainfrom
wenddymacro:docs/fix-runnable-code-examples

Conversation

@wenddymacro

Copy link
Copy Markdown
Contributor

Several doc pages (index, triple_diff, mmm, business_report, practitioner_*) displayed Python examples referencing undefined data/columns, so copying them into a REPL raised NameError/ValueError. Make each snippet self-contained with the library's data generators, and extend the doc-snippet test to CI-cover these files so the examples stay runnable:

  • index.rst: define the hero example's data with generate_did_data
  • api/triple_diff.rst: build DDD/panel data with generate_ddd_data / generate_staggered_ddd_data; fix column names (group/partition/time)
  • api/mmm.rst: supply the experimental panels for the lift-test and Meridian prior examples
  • api/business_report.rst: construct a staggered store panel; drop the deprecated fit(aggregate=) kwarg
  • practitioner_decision_tree.rst: build concrete panels for the HAD universal-rollout and SurveyDesign examples
  • practitioner_getting_started.rst: mark the narrative summary block as context-dependent (it reads results/pt from earlier steps)
  • tests/test_doc_snippets.py: add the seven previously-uncovered RST files to RST_FILES so every doc example is smoke-tested in CI

Methodology references (required if estimator / math changes)

  • Method name(s):
  • Paper / source link(s):
  • Any intentional deviations from the source (and why):

Validation

  • Tests added/updated:
  • Backtest / simulation / notebook evidence (if applicable):

Security / privacy

  • Confirm no secrets/PII in this PR:

Several doc pages (index, triple_diff, mmm, business_report,
practitioner_*) displayed Python examples referencing undefined
data/columns, so copying them into a REPL raised NameError/ValueError.
Make each snippet self-contained with the library's data generators,
and extend the doc-snippet test to CI-cover these files so the
examples stay runnable:

- index.rst: define the hero example's data with generate_did_data
- api/triple_diff.rst: build DDD/panel data with generate_ddd_data /
  generate_staggered_ddd_data; fix column names (group/partition/time)
- api/mmm.rst: supply the experimental panels for the lift-test and
  Meridian prior examples
- api/business_report.rst: construct a staggered store panel; drop the
  deprecated fit(aggregate=) kwarg
- practitioner_decision_tree.rst: build concrete panels for the HAD
  universal-rollout and SurveyDesign examples
- practitioner_getting_started.rst: mark the narrative summary block
  as context-dependent (it reads results/pt from earlier steps)
- tests/test_doc_snippets.py: add the seven previously-uncovered RST
  files to RST_FILES so every doc example is smoke-tested in CI
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