doc path renamed to "api"
This commit is contained in:
parent
38709c03ac
commit
dd86a1a83a
2
.flake8
2
.flake8
|
@ -14,7 +14,7 @@ exclude =
|
||||||
dist,
|
dist,
|
||||||
.conda,
|
.conda,
|
||||||
tests/autogenerated_*,
|
tests/autogenerated_*,
|
||||||
docs/source/_autogenerated
|
docs/source/api
|
||||||
.venv,
|
.venv,
|
||||||
venv
|
venv
|
||||||
|
|
||||||
|
|
|
@ -41,6 +41,8 @@ jobs:
|
||||||
rm ./source/*.rst
|
rm ./source/*.rst
|
||||||
make html
|
make html
|
||||||
touch ./build/html/.nojekyll
|
touch ./build/html/.nojekyll
|
||||||
|
mkdir -p ./build/html/_autogenerated
|
||||||
|
cp ./build/html/api/* ./build/html/_autogenerated/
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
uses: actions/upload-pages-artifact@v3
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
|
|
|
@ -9,7 +9,7 @@ __pycache__
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
tests/autogenerated_*.py
|
tests/autogenerated_*.py
|
||||||
docs/build/
|
docs/build/
|
||||||
docs/source/_autogenerated/
|
docs/source/api/
|
||||||
venv/
|
venv/
|
||||||
.venv/
|
.venv/
|
||||||
thermo_data/combined_data.yaml
|
thermo_data/combined_data.yaml
|
||||||
|
|
|
@ -27,7 +27,7 @@ def write_classes(f: TextIOWrapper, patterns: list[str], module_name: str, title
|
||||||
write_dochtree(f, title, classes)
|
write_dochtree(f, title, classes)
|
||||||
|
|
||||||
for cls in classes:
|
for cls in classes:
|
||||||
with open(f'docs/source/_autogenerated/{cls}.md', 'w') as f2:
|
with open(f'docs/source/api/{cls}.md', 'w') as f2:
|
||||||
f2.write(f'# {module_name}.{cls}\n')
|
f2.write(f'# {module_name}.{cls}\n')
|
||||||
f2.write('```{eval-rst}\n')
|
f2.write('```{eval-rst}\n')
|
||||||
f2.write(f'.. autoclass:: {module_name}.{cls}\n')
|
f2.write(f'.. autoclass:: {module_name}.{cls}\n')
|
||||||
|
@ -43,7 +43,7 @@ def write_functions(f: TextIOWrapper, patterns: list[str], module_name: str, tit
|
||||||
module = importlib.import_module(module_name)
|
module = importlib.import_module(module_name)
|
||||||
|
|
||||||
functions = [
|
functions = [
|
||||||
name for name, obj in inspect.getmembers(module, inspect.isfunction)
|
name for name, _ in inspect.getmembers(module, inspect.isfunction)
|
||||||
if (any(fnmatch.fnmatch(name, pat) for pat in patterns if pat not in exclude))
|
if (any(fnmatch.fnmatch(name, pat) for pat in patterns if pat not in exclude))
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ def write_functions(f: TextIOWrapper, patterns: list[str], module_name: str, tit
|
||||||
|
|
||||||
for func in functions:
|
for func in functions:
|
||||||
if not func.startswith('_'):
|
if not func.startswith('_'):
|
||||||
with open(f'docs/source/_autogenerated/{func}.md', 'w') as f2:
|
with open(f'docs/source/api/{func}.md', 'w') as f2:
|
||||||
f2.write(f'# {module_name}.{func}\n')
|
f2.write(f'# {module_name}.{func}\n')
|
||||||
f2.write('```{eval-rst}\n')
|
f2.write('```{eval-rst}\n')
|
||||||
f2.write(f'.. autofunction:: {module_name}.{func}\n')
|
f2.write(f'.. autofunction:: {module_name}.{func}\n')
|
||||||
|
@ -74,9 +74,9 @@ def write_dochtree(f: TextIOWrapper, title: str, items: list[str]):
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# Ensure the output directory exists
|
# Ensure the output directory exists
|
||||||
os.makedirs('docs/source/_autogenerated', exist_ok=True)
|
os.makedirs('docs/source/api', exist_ok=True)
|
||||||
|
|
||||||
with open('docs/source/_autogenerated/index.md', 'w') as f:
|
with open('docs/source/api/index.md', 'w') as f:
|
||||||
f.write('# Classes and functions\n\n')
|
f.write('# Classes and functions\n\n')
|
||||||
|
|
||||||
write_classes(f, ['*'], 'gaspype', title='Classes')
|
write_classes(f, ['*'], 'gaspype', title='Classes')
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
```{toctree}
|
```{toctree}
|
||||||
:maxdepth: 1
|
:maxdepth: 1
|
||||||
:hidden:
|
:hidden:
|
||||||
_autogenerated/index
|
api/index
|
||||||
_autogenerated/examples
|
api/examples
|
||||||
```
|
```
|
||||||
|
|
||||||
```{include} ../../README.md
|
```{include} ../../README.md
|
||||||
|
|
|
@ -51,7 +51,7 @@ def render_examples(filter: str, example_file: str):
|
||||||
f.write('## Download Jupyter Notebooks\n\n')
|
f.write('## Download Jupyter Notebooks\n\n')
|
||||||
for path, name in zip(files, names):
|
for path, name in zip(files, names):
|
||||||
if name.lower() != 'readme':
|
if name.lower() != 'readme':
|
||||||
run_rendering(path, 'docs/source/_autogenerated')
|
run_rendering(path, 'docs/source/api')
|
||||||
notebook = name + '.ipynb'
|
notebook = name + '.ipynb'
|
||||||
f.write(f'- [{notebook}]({notebook})\n\n')
|
f.write(f'- [{notebook}]({notebook})\n\n')
|
||||||
|
|
||||||
|
@ -63,4 +63,4 @@ def render_examples(filter: str, example_file: str):
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
render_examples('examples/*.md', 'docs/source/_autogenerated/examples.md')
|
render_examples('examples/*.md', 'docs/source/api/examples.md')
|
||||||
|
|
|
@ -11,11 +11,11 @@ The conversion is done like the following automated by the
|
||||||
[docs/source/render_examples.py](../docs/source/render_examples.py) script:
|
[docs/source/render_examples.py](../docs/source/render_examples.py) script:
|
||||||
``` bash
|
``` bash
|
||||||
# Converting markdown with code sections to Jupyter Notebook and run it:
|
# Converting markdown with code sections to Jupyter Notebook and run it:
|
||||||
notedown examples/soec_methane.md --to notebook --output docs/source/_autogenerated/soec_methane.ipynb --run
|
notedown examples/soec_methane.md --to notebook --output docs/source/api/soec_methane.ipynb --run
|
||||||
|
|
||||||
# Converting the Jupyter Notebook to Markdown and a folder with image
|
# Converting the Jupyter Notebook to Markdown and a folder with image
|
||||||
# files placed in docs/source/_autogenerated/:
|
# files placed in docs/source/api/:
|
||||||
jupyter nbconvert --to markdown docs/source/_autogenerated/soec_methane.ipynb --output soec_methane.md
|
jupyter nbconvert --to markdown docs/source/api/soec_methane.ipynb --output soec_methane.md
|
||||||
```
|
```
|
||||||
|
|
||||||
A new example Markdown file can be created from a Jupyter Notebook running
|
A new example Markdown file can be created from a Jupyter Notebook running
|
||||||
|
|
Loading…
Reference in New Issue