diff --git a/docs/conf.py b/docs/conf.py index 7608b8b..640be57 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,6 +22,7 @@ # -- General configuration extensions = [ + "myst_parser", "sphinx.ext.autodoc", "sphinx_copybutton", "sphinx.ext.doctest", @@ -37,8 +38,13 @@ } intersphinx_disabled_domains = ["std"] -copybutton_prompt_text = r">>> |\$ " -copybutton_only_copy_prompt_lines = True +# Copied these settings from the copybutton's config +# https://github.com/executablebooks/sphinx-copybutton/blob/master/docs/conf.py +copybutton_prompt_text = r">>> |\.\.\. |\$ |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " +copybutton_prompt_is_regexp = True +copybutton_line_continuation_character = "\\" +copybutton_here_doc_delimiter = "EOT" +copybutton_selector = "div:not(.no-copybutton) > div.highlight > pre" templates_path = ["_templates"] @@ -48,9 +54,6 @@ # Test code blocks only when explicitly specified doctest_test_doctest_blocks = "" -# Only look for source files in the docs directory -# include_patterns = ["**/docs"] - # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_static_path = ["_static"] @@ -74,6 +77,15 @@ "light_logo": "cladetime_logo_light_mode.png", "dark_logo": "cladetime_logo_dark_mode.png", "navigation_with_keys": True, + "source_repository": "https://github.com/reichlab/cladetime/", +} + +html_context = { + # Enable the "Edit in GitHub link within the header of each page. + "display_github": True, + "github_user": "reichlab", + "github_repo": "cladetime", + "github_version": "main/source/", } # from https://myst-parser.readthedocs.io/en/latest/syntax/optional.html diff --git a/docs/index.rst b/docs/index.rst index a2db187..6d8ca7d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -37,14 +37,14 @@ daily workflow pipeline. >>> ct = CladeTime() >>> filtered_sequence_metadata = ( - ct.sequence_metadata.select(["country", "division", "date", "host", "clade_nextstrain"]) - .filter( - pl.col("country") == "USA", - pl.col("date").is_not_null(), - pl.col("host") == "Homo sapiens", - ) - .cast({"date": pl.Date}, strict=False) - ) + ... ct.sequence_metadata.select(["country", "division", "date", "host", "clade_nextstrain"]) + ... .filter( + ... pl.col("country") == "USA", + ... pl.col("date").is_not_null(), + ... pl.col("host") == "Homo sapiens", + ... ) + ... .cast({"date": pl.Date}, strict=False) + ...) >>> filtered_sequence_metadata.head(5).collect() diff --git a/docs/user-guide.rst b/docs/user-guide.rst index 4189455..3087bc1 100644 --- a/docs/user-guide.rst +++ b/docs/user-guide.rst @@ -77,8 +77,8 @@ a Python datetime object. Both will be treated as UTC dates/times. # ct operations now reference the version of the sequence metadata # that was available at midnight UTC on August 2, 2024. >>> ct.sequence_metadata \ - .cast({"date": pl.Date}, strict=False) \ - .select(pl.max("date")).collect() + ... .cast({"date": pl.Date}, strict=False) \ + ... .select(pl.max("date")).collect() shape: (1, 1) ┌────────────┐