Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: add CI, fix existing warnings, add other improvements #1095

Merged
merged 36 commits into from
Mar 21, 2023

Commits on Mar 21, 2023

  1. Configuration menu
    Copy the full SHA
    dd5e66d View commit details
    Browse the repository at this point in the history
  2. Update CI workflow to catch warnings in docs

    This uses a reusable workflow in the nextstrain/.github repo.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    b62ecb5 View commit details
    Browse the repository at this point in the history
  3. docs/faq/metadata: Convert page to rST

    rST is our standard doc format; Markdown is the legacy format.
    
    Initial conversion performed with:
    
        pandoc -f markdown-smart -t rst-smart docs/faq/metadata.md > docs/faq/metadata.rst
    
    and then I hand reviewed and made additional edits.
    
    This fixes a broken link to https://docs.nextstrain.org/en/latest/guides/bioinformatics/lat_longs.html.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    9227345 View commit details
    Browse the repository at this point in the history
  4. Update references to zika tutorial

    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    ce920ad View commit details
    Browse the repository at this point in the history
  5. Remove "Tests" section heading in docstring

    This was causing a warning when building the docs:
    
        Tests
        -----
        None:8: CRITICAL: Unexpected section title.
    
    Removing since docstrings in other files do not have this heading.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    2c8fdaa View commit details
    Browse the repository at this point in the history
  6. Use consistent table of contents

    In CLI pages with multiple headings.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    3aa9665 View commit details
    Browse the repository at this point in the history
  7. distance: Use JSON syntax highlighting

    Replace the literal blocks (introduced by the :: markers) with
    code-block directives for nice syntax highlighting.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    f331415 View commit details
    Browse the repository at this point in the history
  8. Fix augur.io docs warning

    Fixes this warning:
    
        augur/io/__init__.py:docstring of augur.io:1: WARNING: duplicate object description of augur.io, other instance in api/developer/augur.io, use :noindex: for one of them
    
    While :noindex: for Sphinx in general disables cross-referencing¹ and it
    is briefly mentioned in the "Options and advanced usage" section of
    automodule², there aren't any references anyways (as demonstrated by a
    lack of related warnings/errors).
    
    However, it's still unclear to me exactly why this shows on augur.io
    only. I assume it has something to do with the re-exporting of public
    API functions, which is currently specifi to augur.io.
    
    ¹ https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#basic-markup
    ² https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#directives
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    cbed8ef View commit details
    Browse the repository at this point in the history
  9. Replace section heading in docstring with bold text

    The section headings resulted in warnings:
    
        None:8: CRITICAL: Unexpected section title.
    
        Comparison methods
        ==================
        None:36: CRITICAL: Unexpected section title.
    
        Distance maps
        =============
    
    They rendered fine in the Development API page¹ but did not render on
    the CLI page².
    
    This seems like a bug with sphinx-argparse³. For now, use bold text to
    avoid the warnings and allow the text to render on the CLI page.
    
    ¹ https://docs.nextstrain.org/projects/augur/en/stable/api/developer/augur.distance.html
    ² https://docs.nextstrain.org/projects/augur/en/stable/usage/cli/distance.html
    ³ sphinx-doc/sphinx-argparse#31
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    844c10c View commit details
    Browse the repository at this point in the history
  10. docs: Build locally with nitpicky mode

    This makes local builds show the same warnings in CI without erroring.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    a310587 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    14bf620 View commit details
    Browse the repository at this point in the history
  12. fix: Add augur.types prefix for proper linking

    Without this prefix, a warning appears:
    
        WARNING: py:attr reference target not found: ValidationMode.SKIP
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    97e082d View commit details
    Browse the repository at this point in the history
  13. fix: Use Python type hints in doc generation

    The majority of the codebase uses numpydoc for type annotations.
    However, there are some usages of the newer PEP 484 type hints.
    
    For example, augur.dates.get_numerical_dates has `metadata:pd.DataFrame`
    in the function signature.
    
    Without sphinx-autodoc-typehints, this caused a warning:
    
        augur/augur/dates.py:docstring of augur.dates.get_numerical_dates:1: WARNING: py:class reference target not found: pandas.core.frame.DataFrame
    
    This commit fixes that warning.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    eb65cbb View commit details
    Browse the repository at this point in the history
  14. fix: Add external intersphinx mappings

    This enables proper reference resolution during the docs build, and
    provides useful links on the generated doc pages.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    bf2d133 View commit details
    Browse the repository at this point in the history
  15. fix: Add doc pages to resolve references

    Without these pages, there would be warnings such as:
    
        WARNING: py:class reference target not found: AugurError
        WARNING: py:class reference target not found: DataErrorMethod
    
    It's a good idea to have these doc pages regardless.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    862f749 View commit details
    Browse the repository at this point in the history
  16. Configuration menu
    Copy the full SHA
    9b896c2 View commit details
    Browse the repository at this point in the history
  17. fix: Correct type of pivots

    np.isscalar will return true for a float, but that is not valid input
    for np.linspace(num).
    
    Instead, allow native or numpy integers.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    445d73f View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    ee58907 View commit details
    Browse the repository at this point in the history
  19. fix numpydoc: Add an extra line between numpydoc and doctest

    Otherwise the doctest gets parsed as numpydoc.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    3071e37 View commit details
    Browse the repository at this point in the history
  20. fix numpydoc: Add Examples section for doctests

    Better than the previous commit since this section is made for doctest examples¹.
    
    ¹ https://numpydoc.readthedocs.io/en/v1.5.0/format.html#examples
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    cc77b51 View commit details
    Browse the repository at this point in the history
  21. fix numpydoc: Use numpydoc type hints

    The bracket notation is suggested by PyCharm¹ but is not standard
    numpydoc.
    
    ¹ https://www.jetbrains.com/help/pycharm/type-syntax-for-docstrings.html
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    cc52176 View commit details
    Browse the repository at this point in the history
  22. fix numpydoc: Correct type of label

    "label" is not a valid type; it should be "str".
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    9ac2386 View commit details
    Browse the repository at this point in the history
  23. fix numpydoc: Remove trailing colon from exception classes

    These resulted in nitpick "reference target not found" warnings.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    3a9c6ff View commit details
    Browse the repository at this point in the history
  24. Configuration menu
    Copy the full SHA
    2f87db7 View commit details
    Browse the repository at this point in the history
  25. Configuration menu
    Copy the full SHA
    3ad5369 View commit details
    Browse the repository at this point in the history
  26. fix numpydoc: Remove docstring from traits.register_parser

    Other register_parser functions don't have a docstring, and this one is
    out of date.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    5b37985 View commit details
    Browse the repository at this point in the history
  27. fix numpydoc: Remove "TYPE" placeholders

    These were causing nitpick warnings:
    
        WARNING: py:class reference target not found: TYPE
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    8865478 View commit details
    Browse the repository at this point in the history
  28. Configuration menu
    Copy the full SHA
    a8b1c5f View commit details
    Browse the repository at this point in the history
  29. Configuration menu
    Copy the full SHA
    cf1d935 View commit details
    Browse the repository at this point in the history
  30. fix numpydoc: Properly reference Bio.Phylo.BaseTree.Tree

    Bio.Phylo is the module, not the tree class.
    
    This could instead be something more specific like
    Bio.Phylo.Newick.Tree, but I opted for the more generic type.
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    f6435c6 View commit details
    Browse the repository at this point in the history
  31. fix numpydoc: Properly reference Bio.Phylo.BaseTree.Clade

    `Phylo.Node` is not a valid class. I believe the intention is
    `Bio.Phylo.BaseTree.Clade`, since that is the type of
    `Bio.Phylo.BaseTree.Tree.root`
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    64d8bc5 View commit details
    Browse the repository at this point in the history
  32. Configuration menu
    Copy the full SHA
    2c7c6ed View commit details
    Browse the repository at this point in the history
  33. Configuration menu
    Copy the full SHA
    30781e1 View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    ef70f10 View commit details
    Browse the repository at this point in the history
  35. fix numpydoc: Update reference of pandas TextFileReader

    This class lives at pandas.io.parsers.TextFileReader, however, there are
    no public docs for it and it isn't linked on pandas doc pages either¹.
    
    Use single backticks to disable linking while denoting that it is a class².
    
    ¹ https://pandas.pydata.org/pandas-docs/version/1.4/reference/api/pandas.read_csv.html
    ² https://numpydoc.readthedocs.io/en/latest/format.html#common-rest-concepts
    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    2ba5428 View commit details
    Browse the repository at this point in the history
  36. Update changelog

    victorlin committed Mar 21, 2023
    Configuration menu
    Copy the full SHA
    8e3705d View commit details
    Browse the repository at this point in the history