From c966e2d014f2c8baedfea8df0169262797b22767 Mon Sep 17 00:00:00 2001 From: Andreas Motl Date: Tue, 7 May 2024 22:44:33 +0200 Subject: [PATCH] Documentation: Serve docs via https://influxio.readthedocs.io/ --- .readthedocs.yml | 29 ++++++++++ CHANGES.rst | 6 +-- doc/.gitignore | 1 + doc/Makefile | 20 +++++++ doc/backlog.rst | 8 +-- doc/changes.rst | 1 + doc/conf.py | 125 ++++++++++++++++++++++++++++++++++++++++++++ doc/development.rst | 3 ++ doc/index.md | 116 ++++++++++++++++++++++++++++++++++++++++ doc/make.bat | 35 +++++++++++++ doc/readme.rst | 1 + pyproject.toml | 29 ++++++++++ 12 files changed, 367 insertions(+), 7 deletions(-) create mode 100644 .readthedocs.yml create mode 100644 doc/.gitignore create mode 100644 doc/Makefile create mode 120000 doc/changes.rst create mode 100644 doc/conf.py create mode 100644 doc/index.md create mode 100644 doc/make.bat create mode 120000 doc/readme.rst diff --git a/.readthedocs.yml b/.readthedocs.yml new file mode 100644 index 0000000..734f4ad --- /dev/null +++ b/.readthedocs.yml @@ -0,0 +1,29 @@ +# .readthedocs.yml +# Read the Docs configuration file + +# Details +# - https://docs.readthedocs.io/en/stable/config-file/v2.html + +# Required +version: 2 + +build: + os: "ubuntu-22.04" + tools: + python: "3.11" + +python: + install: + - method: pip + path: . + extra_requirements: + - docs + +sphinx: + configuration: doc/conf.py + builder: html + fail_on_warning: true + +# Optionally build your docs in additional formats such as PDF +#formats: +# - pdf diff --git a/CHANGES.rst b/CHANGES.rst index 320f5be..90db839 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -1,6 +1,6 @@ -################## -influxio changelog -################## +######### +Changelog +######### in progress diff --git a/doc/.gitignore b/doc/.gitignore new file mode 100644 index 0000000..a485625 --- /dev/null +++ b/doc/.gitignore @@ -0,0 +1 @@ +/_build diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 0000000..d4bb2cb --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,20 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/backlog.rst b/doc/backlog.rst index 7bf7e09..f34a6d6 100644 --- a/doc/backlog.rst +++ b/doc/backlog.rst @@ -1,6 +1,6 @@ -################ -influxio backlog -################ +####### +Backlog +####### ************ @@ -27,7 +27,7 @@ Iteration +2 ************ - [o] Fix ``cratedb_toolkit.sqlalchemy.patch_inspector()`` re. reflection of ``?schema=`` URL parameter - [o] Fix ``crate.client.sqlalchemy.dialect.DateTime`` re. ``TimezoneUnawareException`` -- [o] Support InfluxDB 1.x +- [o] Support InfluxDB 1.x and 3.x - [o] Add Docker Compose file for auxiliary services - [o] Refactor general purpose code to ``pueblo`` package - [o] Verify import and export of ILP and CSV files works well diff --git a/doc/changes.rst b/doc/changes.rst new file mode 120000 index 0000000..9d60ba9 --- /dev/null +++ b/doc/changes.rst @@ -0,0 +1 @@ +../CHANGES.rst \ No newline at end of file diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 0000000..c95e3dc --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,125 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "influxio" +copyright = "2018-2024, The Panodata Developers" +author = "The Panodata Developers" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + "myst_parser", + "sphinx_copybutton", + "sphinx_design", + "sphinx.ext.intersphinx", + "sphinx.ext.todo", + "sphinx.ext.ifconfig", + "sphinxcontrib.mermaid", + "sphinxext.opengraph", +] + +templates_path = ["_templates"] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +# The theme to use for HTML and HTML Help pages. See the documentation for +# a list of builtin themes. +# +html_theme = "furo" + +# Theme options are theme-specific and customize the look and feel of a theme +# further. For a list of options available for each theme, see the +# documentation. + +html_title = "influxio" + +html_theme_options = { + "sidebar_hide_name": False, + # https://github.com/pradyunsg/furo/blob/main/src/furo/assets/styles/variables/_colors.scss + # "light_logo": "influxio-logo-light.svg", + # "dark_logo": "influxio-logo-dark.svg", + "dark_css_variables": { + "color-brand-primary": "#436FCEFF", + "color-background-border": "#4743CE4F", + }, + "light_css_variables": { + "color-brand-primary": "#436FCEFF", + "color-background-border": "#4743CE4F", + }, +} + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ["_static"] + +# Custom sidebar templates, must be a dictionary that maps document names +# to template names. +# +# The default sidebars (for documents that don't match any pattern) are +# defined by theme itself. Builtin themes are using these templates by +# default: ``['localtoc.html', 'relations.html', 'sourcelink.html', +# 'searchbox.html']``. +# +# html_sidebars = {} + +html_show_sourcelink = True + + +# -- Intersphinx ---------------------------------------------------------- + +intersphinx_mapping = { + # "https://docs.python.org/": None, +} +linkcheck_ignore = [] + +# Disable caching remote inventories completely. +# http://www.sphinx-doc.org/en/stable/ext/intersphinx.html#confval-intersphinx_cache_limit +# intersphinx_cache_limit = 0 + + +# -- Extension configuration ------------------------------------------------- + +sphinx_tabs_valid_builders = ["linkcheck"] +todo_include_todos = True + +# Configure sphinx-copybutton +copybutton_remove_prompts = True +copybutton_line_continuation_character = "\\" +copybutton_prompt_text = r">>> |\.\.\. |\$ |sh\$ |PS> |cr> |mysql> |In \[\d*\]: | {2,5}\.\.\.: | {5,8}: " +copybutton_prompt_is_regexp = True + +# Configure sphinxext-opengraph +ogp_site_url = "https://influxio.readthedocs.io/" +ogp_enable_meta_description = True +# ogp_image = "http://example.org/image.png" +# ogp_description_length = 300 + + +# -- Options for MyST ------------------------------------------------- + +myst_heading_anchors = 3 +myst_enable_extensions = [ + "attrs_block", + "attrs_inline", + "colon_fence", + "deflist", + "fieldlist", + "html_admonition", + "html_image", + "linkify", + "replacements", + "strikethrough", + "substitution", + "tasklist", +] +myst_substitutions = {} diff --git a/doc/development.rst b/doc/development.rst index cdc0322..202e379 100644 --- a/doc/development.rst +++ b/doc/development.rst @@ -1,3 +1,6 @@ +.. _development: +.. _sandbox: + ########### Development ########### diff --git a/doc/index.md b/doc/index.md new file mode 100644 index 0000000..b5324f4 --- /dev/null +++ b/doc/index.md @@ -0,0 +1,116 @@ +(index)= +# influxio + +[![CI][badge-tests]][project-tests] +[![Coverage Status][badge-coverage]][project-codecov] +[![Documentation][badge-documentation]][project-documentation] +[![License][badge-license]][project-license] +[![Downloads per month][badge-downloads-per-month]][project-downloads] + +[![Supported Python versions][badge-python-versions]][project-pypi] +[![Status][badge-status]][project-pypi] +[![Package version][badge-package-version]][project-pypi] + +ยป [Documentation] +| [Changelog] +| [PyPI] +| [Issues] +| [Source code] +| [License] + + +## About + +Import and export data into/from InfluxDB, for humans and machines. + + +## Features + +- **Capable:** Connect to the InfluxDB HTTP API, or read from an InfluxDB + TSM data directory directly. + +- **Versatile:** Use it as a command-line program, pipeline element, + or as a library within your own applications. + +- **Polyglot:** Support I/O operations between InfluxDB, any SQL database + supported by SQLAlchemy, file formats supported by pandas/Dask, and + the native InfluxDB line protocol (ILP), on both import and export + directions. + + +## Synopsis + +```shell + +# Export from API to database. +influxio copy \ + "http://example:token@localhost:8086/testdrive/demo" \ + "sqlite://export.sqlite?table=demo" + +# Export from data directory to line protocol format. +influxio copy \ + "file:///path/to/influxdb/engine?bucket-id=372d1908eab801a6&measurement=demo" \ + "file://export.lp" +``` + + +## Documentation + +Please visit the [README](#readme) document to learn what you can do with +the `influxio` package. Effectively, it is all about the `influxio copy` +primitive, which accepts a range of variants on its `SOURCE` and `TARGET` +arguments, in URL formats. + + +## Development + +Contributions are very much welcome. Please visit the [](#sandbox) +documentation to learn about how to spin up a sandbox environment on your +workstation, or create a [ticket][Issues] to report a bug or share an idea +about a possible feature. + + + +```{toctree} +:maxdepth: 3 +:caption: Documentation +:hidden: + +README +``` + +```{toctree} +:maxdepth: 1 +:caption: Workbench +:hidden: + +changes +backlog +development +``` + + + +[Changelog]: https://github.com/daq-tools/influxio/blob/main/CHANGES.rst +[development documentation]: https://influxio.readthedocs.io/development.html +[Documentation]: https://influxio.readthedocs.io/ +[Issues]: https://github.com/daq-tools/influxio/issues +[License]: https://github.com/daq-tools/influxio/blob/main/LICENSE +[PyPI]: https://pypi.org/project/influxio/ +[Source code]: https://github.com/daq-tools/influxio +[influxio]: https://influxio.readthedocs.io/ + +[badge-coverage]: https://codecov.io/gh/daq-tools/influxio/branch/main/graph/badge.svg +[badge-documentation]: https://img.shields.io/readthedocs/influxio +[badge-downloads-per-month]: https://pepy.tech/badge/influxio/month +[badge-license]: https://img.shields.io/github/license/daq-tools/influxio.svg +[badge-package-version]: https://img.shields.io/pypi/v/influxio.svg +[badge-python-versions]: https://img.shields.io/pypi/pyversions/influxio.svg +[badge-status]: https://img.shields.io/pypi/status/influxio.svg +[badge-tests]: https://github.com/daq-tools/influxio/actions/workflows/tests.yml/badge.svg +[project-codecov]: https://codecov.io/gh/daq-tools/influxio +[project-documentation]: https://influxio.readthedocs.io/ +[project-downloads]: https://pepy.tech/project/influxio/ +[project-license]: https://github.com/daq-tools/influxio/blob/main/LICENSE +[project-pypi]: https://pypi.org/project/influxio +[project-tests]: https://github.com/daq-tools/influxio/actions/workflows/tests.yml diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 0000000..32bb245 --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/readme.rst b/doc/readme.rst new file mode 120000 index 0000000..89a0106 --- /dev/null +++ b/doc/readme.rst @@ -0,0 +1 @@ +../README.rst \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 78c0b4c..16b54dd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -62,12 +62,20 @@ classifiers = [ "Topic :: Database", "Topic :: Documentation", "Topic :: Education", + "Topic :: File Formats", "Topic :: Office/Business", "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Human Machine Interfaces", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Scientific/Engineering :: Interface Engine/Protocol Translator", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Testing", "Topic :: Software Development :: Version Control", "Topic :: System :: Archiving", + "Topic :: System :: Logging", + "Topic :: System :: Monitoring", + "Topic :: System :: Networking", + "Topic :: System :: Recovery Tools", "Topic :: System :: Systems Administration", "Topic :: Text Processing", "Topic :: Utilities", @@ -98,8 +106,18 @@ develop = [ "poethepoet<0.27", "pyproject-fmt<1.9", "ruff<0.5", + "sphinx-autobuild==2021.3.14", # Newer versions stopped "watching" appropriately? "validate-pyproject<0.17", ] +docs = [ + "furo", + "myst-parser[linkify]<3,>=0.18", + "sphinx<7", + "sphinx-copybutton", + "sphinx-design-elements<1", + "sphinxcontrib-mermaid<1", + "sphinxext-opengraph<1", +] release = [ "build<2", "twine<6", @@ -196,6 +214,7 @@ lint.extend-ignore = [ ] [tool.ruff.lint.per-file-ignores] +"doc/conf.py" = ["A001", "ERA001"] "tests/*" = ["S101"] # Use of `assert` detected "influxio/util/report.py" = ["T201"] @@ -214,6 +233,16 @@ check = [ "test", ] +docs-autobuild = [ + { cmd = "sphinx-autobuild --open-browser --watch influxio doc doc/_build" } +] +docs-html = [ + { cmd = "sphinx-build -W --keep-going doc doc/_build" } +] +docs-linkcheck = [ + { cmd = "sphinx-build -W --keep-going -b linkcheck doc doc/_build" } +] + format = [ { cmd = "black ." }, # Configure Ruff not to auto-fix (remove!) unused variables (F841) and `print` statements (T201).