Skip to content

Commit

Permalink
Merge pull request #72 from Musaefendic/copy-notebook-with-nbsphinx-link
Browse files Browse the repository at this point in the history
Build the doc, notebook and copy necessary resources
  • Loading branch information
adriendelsalle authored Oct 18, 2022
2 parents 60bc37a + cb83931 commit 086e4fa
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 15 deletions.
Binary file added docs/assets/twiinIT.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 34 additions & 0 deletions docs/build_doc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import os
from pathlib import Path
import shutil

CWD = Path.cwd()
SOURCEDIR = "source"
BUILDDIR = "_build"
NOTEBOOK_FOLDER = "user_guide/notebooks"

RESOURCES = ("tf.html", "textures/twiinIT_logo.png", "textures/twiinIT.png")


def main():
build_documentation()
copy_notebook_resources()


def build_documentation():
return os.system("sphinx-build -b html -d _build/doctrees ./source _build")


def copy_notebook_resources():
for resource in RESOURCES:
source_path = CWD / SOURCEDIR / NOTEBOOK_FOLDER / resource
target_path = CWD / BUILDDIR / NOTEBOOK_FOLDER / resource

if not os.path.exists(target_path.parents[0]):
os.mkdir(target_path.parents[0])

shutil.copyfile(source_path, target_path)


if __name__ == "__main__":
main()
3 changes: 2 additions & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
"sphinx.ext.viewcode",
"nbsphinx",
"autoapi.extension",
"nbsphinx_link",
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -97,7 +98,7 @@ def setup(sphinx):

# -- Options for HTML output -------------------------------------------------

html_logo = "../assets/twiinIT_grayscale.svg"
html_logo = "../assets/twiinIT.png"

html_theme = "furo"

Expand Down
6 changes: 6 additions & 0 deletions docs/source/user_guide/notebooks/turbofan.nblink
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"path": "../../../../pyturbo/notebooks/turbofan.ipynb",
"extra-media": [
"../../../../pyturbo/notebooks/textures"
]
}
1 change: 1 addition & 0 deletions environment-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ dependencies:
- pythonocc-core
- ambiance
- furo
- nbsphinx-link
17 changes: 3 additions & 14 deletions pyturbo/notebooks/turbofan.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"id": "ba8b4132-1828-48fa-bf8c-1a1edbcac52f",
"metadata": {},
"source": [
"# Context\n",
"# Turbofan Tutorial\n",
"`pyturbo` library is provided by twiinIT to assembly a simple turbofan system.\n",
"\n",
"The library is made of components: \n",
Expand Down Expand Up @@ -47,18 +47,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "c5c5219f-88e7-403f-a14d-65946efdb52d",
"metadata": {},
"outputs": [],
"source": [
"# Product Breakdown Structure\n",
"sys.to_d3()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "52efdcc7-37ce-475b-a125-59783a5f23ff",
"id": "6dc31fdb-6dd3-404c-afb4-6fb8c44c488c",
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -111,7 +100,7 @@
"id": "34ea90e8-ecac-4e4f-8c64-14eeb25d7084",
"metadata": {},
"source": [
"## direct mode\n",
"## Direct mode\n",
"`thrust` is computed from `fuel_W`."
]
},
Expand Down

0 comments on commit 086e4fa

Please sign in to comment.