Skip to content

Commit e0d8607

Browse files
committed
Update readme
1 parent a02b528 commit e0d8607

9 files changed

Lines changed: 19 additions & 132 deletions

generator/README.md

Lines changed: 5 additions & 119 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ This script generates and updates a number of markdown pages for the documentati
66

77
### How to regenerate documentation
88

9-
Generate all files → save to [/_output](_output)
10-
More details for each script can be found in the docstrings.
9+
Generate files → save to [_output](_output):
10+
_More details for each script can be found in the docstrings._
1111

1212
```
1313
python3 generator/generate_docs.py
@@ -44,127 +44,13 @@ Files generated or updated for the [openad-toolkit] repo:
4444
Other files:
4545
- [commands.csv](generator/_output/other/commands.csv) overview file (not used, for record only)
4646

47-
48-
### What this does
49-
50-
1. Use the descriptions from the [`/source`](./source) folder to update:
51-
- The `README.md` with OpenAD description
52-
- The `README/plugins.md` with plugins description
53-
- The [openad_intro] text (/openad/helpers/output_content.py) that is displayed when running the `intro` command
54-
- The informational paragraphs that are displayed when running the `? workspace`, `? mws`, `? tookit`, `? context` and `? run` commands (see _output_content_ in [main.py](/openad/app/main.py))
55-
- The [Base Concepts](https://acceleratedscience.github.io/openad-docs/base-concepts.html) page on the documentation website
56-
1. Duplicate all the README markdown pages, prepare them for ***Just the Docs*** consumption, then copy them over to the documentation repository if it's available
57-
1. Generate two additional bespoke pages for the documentation website:
58-
- [Base Concepts](https://acceleratedscience.github.io/openad-docs/base-concepts.html)
59-
- [Commands](https://openad.accelerate.science/docs/commands)
60-
2. Update the [llm_description.txt](/openad/user_toolkits/DS4SD/llm_description.txt) for each individual plugin with the correct commands, used for LLM training.
61-
6247
<br>
6348

6449
### How it works
6550

66-
- The `/source` folder is the "single source of truth" and contains a number of text files with descriptions for OpenAD and some of its core concepts.
67-
- The `/input` folder contains the markdown templates that are used to generate the markdown pages for the [openad-docs] repository. The header info in the input files defines the order of pages in the side navigation.
68-
- The `/output` folder contains all the files that are exported by the script:
69-
- `/markdown`<br>The markdown files for the [openad-docs] repository:
70-
- [index.md](output/markdown/index.md)
71-
- [installation.md](output/markdown/installation.md)
72-
- [getting-started.md](output/markdown/getting-started.md)
73-
- [base-concepts.md](output/markdown/base-concepts.md)
74-
- [commands.md](output/markdown/commands.md)
75-
- [models-service.md](output/markdown/models-service.md)
76-
- [plugins.md](output/markdown/plugins.md)
77-
- [ai-assistant.md](output/markdown/ai-assistant.md)
78-
- [developers.md](output/markdown/developers.md)
79-
- `/csv`
80-
- [csv/commands.csv](output/csv/commands.csv) - A CSV file with all available commands that is not used anywhere but comes in handy to have a clean overview of available commands
81-
82-
<br>
83-
84-
### Link mapping
85-
86-
A key part of the translation from **GitHub** markdown to **Just the Docs** and **PyPI** markdown files, is to update internal links.
87-
88-
- **GitHub:** Links and relative and point to other README files.
89-
- **[Documentation](https://acceleratedscience.github.io/openad-docs):** Links and relative and point to the other pages on the site.
90-
- **[PyPI](https://pypi.org/project/openad/):** Links are absolute and point to the documentation website.
91-
92-
**Source: GitHub**
93-
94-
[Link](README.md)
95-
[Link](README.md#quick-install)
96-
[Link](README/developers.md)
97-
[Link](README/developers.md#testing-a-branch)
98-
[Link]: README.md
99-
[Link]: README.md#quick-install
100-
[Link]: README/developers.md
101-
[Link]: README/developers.md#testing-a-branch
102-
103-
[Link](/README.md)
104-
[Link](/README.md#quick-install)
105-
[Link](/README/developers.md)
106-
[Link](/README/developers.md#testing-a-branch)
107-
[Link]: /README.md
108-
[Link]: /README.md#quick-install
109-
[Link]: /README/developers.md
110-
[Link]: /README/developers.md#testing-a-branch
111-
112-
**Translation: Just the Docs**
113-
114-
[Link](index.html)
115-
[Link](index.html#quick-install)
116-
[Link](developers.html)
117-
[Link](developers.html#testing-a-branch)
118-
[Link]: index.html
119-
[Link]: index.html#quick-install
120-
[Link]: developers.html
121-
[Link]: developers.html#testing-a-branch
122-
123-
[Link](index.html)
124-
[Link](index.html#quick-install)
125-
[Link](developers.html)
126-
[Link](developers.html#testing-a-branch)
127-
[Link]: index.html
128-
[Link]: index.html#quick-install
129-
[Link]: developers.html
130-
[Link]: developers.html#testing-a-branch
131-
132-
**Translation: PyPI**
133-
134-
[Link](https://acceleratedscience.github.io/openad-docs/)
135-
[Link](https://acceleratedscience.github.io/openad-docs/#quick-install)
136-
[Link](https://acceleratedscience.github.io/openad-docs/developers.html)
137-
[Link](https://acceleratedscience.github.io/openad-docs/developers.html#testing-a-branch)
138-
[Link]: https://acceleratedscience.github.io/openad-docs/
139-
[Link]: https://acceleratedscience.github.io/openad-docs/#quick-install
140-
[Link]: https://acceleratedscience.github.io/openad-docs/developers.html
141-
[Link]: https://acceleratedscience.github.io/openad-docs/developers.html#testing-a-branch
142-
143-
[Link](https://acceleratedscience.github.io/openad-docs/)
144-
[Link](https://acceleratedscience.github.io/openad-docs/#quick-install)
145-
[Link](https://acceleratedscience.github.io/openad-docs/developers.html)
146-
[Link](https://acceleratedscience.github.io/openad-docs/developers.html#testing-a-branch)
147-
[Link]: https://acceleratedscience.github.io/openad-docs/
148-
[Link]: https://acceleratedscience.github.io/openad-docs/#quick-install
149-
[Link]: https://acceleratedscience.github.io/openad-docs/developers.html
150-
[Link]: https://acceleratedscience.github.io/openad-docs/developers.html#testing-a-branch
151-
152-
[openad-docs]: https://github.com/acceleratedscience/openad-docs
153-
154-
155-
156-
Documentation pages are generated by script:
157-
- [Publicly Available Models](https://openad.accelerate.science/docs/model-service/deploying-models)
158-
- [OpenAD Commands](https://openad.accelerate.science/docs/commands)
159-
- [Base Concepts](https://openad.accelerate.science/docs/base-concepts)
160-
161-
Documentation pages that have descriptions that are updated by script:
162-
- [OpenAD Plugins](https://openad.accelerate.science/docs/plugins)
163-
164-
Other files that are generated or updated by the script:
165-
- [README.md](https://github.com/acceleratedscience/openad-toolkit?tab=readme-ov-file#readme) for the openad-toolkit repo
166-
- [commands.csv](generator/_output/other/commands.csv) overview file
167-
51+
- The `/source` folder is the "single source of truth" and contains a number of text files with descriptions for OpenAD and some of its core concepts, as well as the list of model services.
52+
- The `/_templates` folder contains the markdown templates that are used to generate some of the markdown pages for the [openad-docs] repository.
53+
- The `/output` folder is where all files are stored before they're distributed to their final destination
16854

16955

17056
[openad-toolkit]: https://github.com/acceleratedscience/openad-toolkit
File renamed without changes.
File renamed without changes.
File renamed without changes.

generator/methods/generate_commands_md.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
from openad.helpers.output import output_text
44
from openad.app.main import RUNCMD as cmd_pointer
55
from openad.core.help import organize_commands
6-
from .shared import DO_NOT_EDIT, read_input_file, write_output_file
6+
from .shared import DO_NOT_EDIT, read_template_file, write_output_file
77

88

99
def generate_commands_md(filename="commands.md"):
1010
"""
1111
Generate the commands.md page for the documentation.
1212
13-
- Start from the _input/commands.md template
13+
- Start from the _templates/commands.md template
1414
- Loop through all OpenAD commands & generate markdown
1515
- Store result in _output/docs/commands.md
1616
"""
@@ -43,7 +43,7 @@ def generate_commands_md(filename="commands.md"):
4343
#
4444

4545
# Read commands.md input content
46-
commands_md = read_input_file(filename)
46+
commands_md = read_template_file(filename)
4747

4848
# Insert sections
4949
# fmt: off

generator/methods/generate_llm_descriptions_text.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# -- NO LONGER IN USE --
2+
# Kept here for reference only
23
# Todo: strategy on how to integrate LLM training for plugins
34

45
import os

generator/methods/generate_model_docs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
DO_NOT_EDIT,
99
FLAG_ERROR,
1010
source_dir,
11-
read_input_file,
11+
read_template_file,
1212
write_output_file,
1313
)
1414

@@ -21,8 +21,8 @@ def generate_model_docs(filename="model-service~available-models.md"):
2121
"""
2222
Generate the available-models.md page for the documentation.
2323
24-
- Start from the _input/model-service~available-models.md template
25-
- Load the models.csv file from _input/models.csv
24+
- Start from the _templates/model-service~available-models.md template
25+
- Load the models.csv file from _templates/models.csv
2626
- Scrape the README.md files from the GitHub repositories listed in models.csv
2727
- Generate overview markdown for each model
2828
- Store result in _output/docs/model-service~available-models.md
@@ -37,7 +37,7 @@ def generate_model_docs(filename="model-service~available-models.md"):
3737
)
3838

3939
# Read commands.md input content
40-
available_models_md = read_input_file(filename)
40+
available_models_md = read_template_file(filename)
4141

4242
# Insert DO NOT EDIT comment
4343
available_models_md = re.sub(

generator/methods/oad_generate_concepts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
from openad.helpers.output import output_text
2-
from .shared import read_input_file, read_source_file, write_output_file
2+
from .shared import read_template_file, read_source_file, write_output_file
33

44

55
def oad_generate_concepts(filename="openad~helpers~concepts.py"):
66
"""
77
Generate the concept.py file for the openad-toolkit repo.
88
9-
- Start from the _input/openad~helpers~concepts.py template
9+
- Start from the _templates/openad~helpers~concepts.py template
1010
- Fill in all descriptions from the _source directory
1111
- Store result in _output/openad-toolkit/openad~helpers~concepts.py
1212
@@ -17,7 +17,7 @@ def oad_generate_concepts(filename="openad~helpers~concepts.py"):
1717
output_text(f"<h1>Generating <yellow>{filename}</yellow></h1>", pad_top=2)
1818

1919
# Read concepts.py template content
20-
concepts_py = read_input_file(filename)
20+
concepts_py = read_template_file(filename)
2121

2222
# Read source file content
2323
description_txt = read_source_file("description.txt")

generator/methods/shared.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
this_dir = os.path.dirname(os.path.abspath(__file__))
77
docs_dir = os.path.normpath(os.path.join(this_dir, "../../main/docs"))
88
source_dir = os.path.normpath(os.path.join(this_dir, "../_source"))
9-
input_dir = os.path.normpath(os.path.join(this_dir, "../_input"))
9+
template_dir = os.path.normpath(os.path.join(this_dir, "../_templates"))
1010
output_dir = os.path.normpath(os.path.join(this_dir, "../_output"))
1111
openad_toolkit_dir = os.path.normpath(os.path.join(this_dir, "../../../openad-toolkit"))
1212

@@ -63,9 +63,9 @@ def read_source_file(filename):
6363
return _read_file_content(path)
6464

6565

66-
def read_input_file(filename):
66+
def read_template_file(filename):
6767
"""Return the content of a file from the input dir."""
68-
path = os.path.join(input_dir, filename)
68+
path = os.path.join(template_dir, filename)
6969
return _read_file_content(path)
7070

7171

0 commit comments

Comments
 (0)