diff --git a/.gitignore b/.gitignore index f461f88c5963..7b9144d93eed 100644 --- a/.gitignore +++ b/.gitignore @@ -134,3 +134,4 @@ ibis/examples/descriptions # automatically generated odbc file for ci ci/odbc/odbc.ini +*-citibike-tripdata.tar.xz diff --git a/docs/_renderer.py b/docs/_renderer.py index 77d2220026ff..79cd5c146402 100644 --- a/docs/_renderer.py +++ b/docs/_renderer.py @@ -28,8 +28,6 @@ def render(self, el: qd.ast.ExampleCode) -> str: lambda line: quartodoc_skip_doctest in line or skip_doctest in line ) - has_executed_chunks = False - for chunk in toolz.partitionby(chunker, lines): first, *rest = chunk @@ -39,11 +37,22 @@ def render(self, el: qd.ast.ExampleCode) -> str: # check whether to skip execution and if so, render the code # block as `python` (not `{python}`) if it's marked with # skip_doctest, expect_failure or quartodoc_skip_doctest - if any(map(should_skip, chunk)): + if skipped := any(map(should_skip, chunk)): start = end = "" else: - has_executed_chunks = True start, end = "{}" + result.append( + dedent( + """ + ```{python} + #| echo: false + + import ibis + ibis.options.interactive = True + ``` + """ + ) + ) result.append(f"```{start}python{end}") @@ -67,22 +76,16 @@ def render(self, el: qd.ast.ExampleCode) -> str: result.extend(rest) result.append("```\n") - examples = "\n".join(result) - - if has_executed_chunks: - # turn off interactive mode before rendering - return ( - dedent( - """ - ```{python} - #| echo: false - - import ibis - ibis.options.interactive = False - ``` - """ - ) - + examples - ) - else: - return examples + if not skipped: + result.append( + dedent( + """ + ```{python} + #| echo: false + ibis.options.interactive = False + ``` + """ + ) + ) + + return "\n".join(result) diff --git a/ibis/expr/api.py b/ibis/expr/api.py index b0e9ba4704fd..5b3ebd14b14b 100644 --- a/ibis/expr/api.py +++ b/ibis/expr/api.py @@ -326,8 +326,7 @@ def table( Create a table with no data backing it >>> import ibis - >>> ibis.options.interactive - False + >>> ibis.options.interactive = False >>> t = ibis.table(schema=dict(a="int", b="string"), name="t") >>> t UnboundTable: t diff --git a/ibis/selectors.py b/ibis/selectors.py index bd851d4c9def..9bc5f1a9e654 100644 --- a/ibis/selectors.py +++ b/ibis/selectors.py @@ -180,11 +180,8 @@ def numeric() -> Predicate: >>> import ibis >>> import ibis.selectors as s >>> t = ibis.table(dict(a="int", b="string", c="array"), name="t") - >>> t - UnboundTable: t - a int64 - b string - c array + >>> t.columns + ['a', 'b', 'c'] >>> expr = t.select(s.numeric()) # `a` has integer type, so it's numeric >>> expr.columns ['a']