diff options
| author | Adam Janovsky | 2022-05-20 18:24:01 +0200 |
|---|---|---|
| committer | Adam Janovsky | 2022-05-20 18:24:01 +0200 |
| commit | 4fe5372ec385c3662a7a05d75ec40922d40c414e (patch) | |
| tree | 9183634ee1febe676e2517877f783434653d2599 /docs | |
| parent | 9db545dbb2b644a01b8e49b4b2506ea03ec36b00 (diff) | |
| download | sec-certs-4fe5372ec385c3662a7a05d75ec40922d40c414e.tar.gz sec-certs-4fe5372ec385c3662a7a05d75ec40922d40c414e.tar.zst sec-certs-4fe5372ec385c3662a7a05d75ec40922d40c414e.zip | |
Docs: automatically generate configuration page
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/Makefile | 7 | ||||
| -rwxr-xr-x | docs/generate_config_page.py | 20 | ||||
| -rw-r--r-- | docs/index.md | 3 |
3 files changed, 29 insertions, 1 deletions
diff --git a/docs/Makefile b/docs/Makefile index d4bb2cbb..0405fafe 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -17,4 +17,11 @@ help: # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile + @if [ "$@" = "html" ]; then \ + chmod +x ./generate_config_page.py ;\ + python3 ./generate_config_page.py ;\ + fi @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + @if [ "$@" = "html" ]; then \ + rm ./configuration.md ;\ + fi
\ No newline at end of file diff --git a/docs/generate_config_page.py b/docs/generate_config_page.py new file mode 100755 index 00000000..d928c178 --- /dev/null +++ b/docs/generate_config_page.py @@ -0,0 +1,20 @@ +# This will generate configuration.md page from `settings.yaml` in sec_certs.configuration file + +from sec_certs.config import configuration + + +def main(): + cfg = configuration.config + + with open("./configuration.md", "w") as handle: + handle.write("# Configuration\n\n") + handle.write( + "The configuration is stored in yaml file `settings.yaml` at `sec_certs.config`. These are the supported options, descriptions and default values.\n\n" + ) + for key in cfg.__dict__: + handle.write(f"`{key}`\n\n- Description: {cfg.get_desription(key)}\n") + handle.write(f"- Default value: `{cfg.__getattribute__(key)}`\n\n") + + +if __name__ == "__main__": + main() diff --git a/docs/index.md b/docs/index.md index 8949debe..61c39ec5 100644 --- a/docs/index.md +++ b/docs/index.md @@ -32,6 +32,7 @@ Seccerts PyPi <https://pypi.org/project/sec-certs/> installation.md quickstart.md tutorial.md +configuration.md ``` ```{toctree} @@ -44,7 +45,7 @@ notebooks/examples/model.ipynb ``` ```{toctree} -:caption: API +:caption: API reference :hidden: True :maxdepth: 1 api/sample.md |
