Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed need for copy_build_artifacts in the doc build process. #1100

Merged
merged 9 commits into from
Aug 15, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/dymos_docs_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,6 @@ jobs:
cd docs
export PYDEVD_DISABLE_FILE_VALIDATION=1
jupyter-book build -W --keep-going dymos_book
python copy_build_artifacts.py

- name: Display doc build reports
continue-on-error: True
Expand Down
3 changes: 0 additions & 3 deletions docs/build_jupyter_book.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import subprocess
import pathlib

from copy_build_artifacts import copy_build_artifacts


_this_file = pathlib.Path(__file__).resolve()
REPO_ROOT = _this_file.parent
Expand All @@ -28,7 +26,6 @@ def build_book(book_dir=BOOK_DIR, clean=True, ignore_warnings=False):
subprocess.run(['jupyter-book', 'build', '--keep-going', book_dir]) # nosec: trusted input
else:
subprocess.run(['jupyter-book', 'build', '-W', '--keep-going', book_dir]) # nosec: trusted input
copy_build_artifacts(book_dir)
os.chdir(save_cwd)


Expand Down
4 changes: 2 additions & 2 deletions docs/build_source_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def build_src_docs(top, src_dir, project_name='dymos'):
# specifically don't use os.path.join here. Even windows wants the
# stuff in the file to have fwd slashes.
title = f"[{package}]"
link = f"(packages/{package}.md)\n"
link = f"(packages/{package}.ipynb)\n"
index_data += f"- {title}{link}"

# make subpkg directory (e.g. _srcdocs/packages/core) for ref sheets
Expand All @@ -139,7 +139,7 @@ def build_src_docs(top, src_dir, project_name='dymos'):
# specifically don't use os.path.join here. Even windows wants the
# stuff in the file to have fwd slashes.
title = f"[{sub_package}]"
link = f"({package}/{sub_package}.md)\n"
link = f"({package}/{sub_package}.ipynb)\n"
package_data += f"- {title}{link}"

# creates and writes out one reference sheet (e.g. core/component.ipynb)
Expand Down
36 changes: 0 additions & 36 deletions docs/copy_build_artifacts.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -77,19 +77,19 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -307,6 +307,8 @@
},
"outputs": [],
"source": [
"import pathlib\n",
"\n",
"from bokeh.plotting import figure, show, output_notebook, output_file, save\n",
"\n",
"from bokeh.palettes import d3\n",
Expand Down Expand Up @@ -345,12 +347,30 @@
"p1.xaxis.axis_label = 'time (s)'\n",
"p1.yaxis.axis_label = 'state value'\n",
"p1.legend.location = 'bottom_right'\n",
" \n",
"\n",
"output_file('plot.html', mode='inline')\n",
"plot_file = save(p1)\n",
"\n",
"HTML(filename=plot_file)"
"# Define the path to the HTML file\n",
"html_file_path = pathlib.Path('plot.html')\n",
"html_content = html_file_path.read_text()\n",
"\n",
"# Inject CSS to control the output cell height and avoid scrollbars\n",
"html_with_custom_height = f\"\"\"\n",
"<div style=\"height: 320px; overflow: auto;\">\n",
" {html_content}\n",
"</div>\n",
"\"\"\"\n",
"\n",
"HTML(html_with_custom_height)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand All @@ -370,7 +390,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
21 changes: 16 additions & 5 deletions docs/dymos_book/examples/bryson_denham/bryson_denham.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,7 @@
"execution_count": null,
"id": "beea4c6a",
"metadata": {
"id": "beea4c6a",
"scrolled": true
"id": "beea4c6a"
},
"outputs": [],
"source": [
Expand Down Expand Up @@ -555,13 +554,14 @@
},
"id": "da31be29",
"outputId": "f351fca0-6415-4469-8a42-dc035fe2bbc4",
"scrolled": false,
"tags": [
"hide-input"
]
},
"outputs": [],
"source": [
"import pathlib\n",
"\n",
"import matplotlib as mpl\n",
"from matplotlib import animation\n",
"\n",
Expand Down Expand Up @@ -681,7 +681,18 @@
"from IPython.display import HTML\n",
"with open('anim.html', 'w') as f:\n",
" f.write(anim.to_jshtml())\n",
"HTML('anim.html')"
"\n",
"# Define the path to the HTML file\n",
"html_content = pathlib.Path('anim.html').read_text()\n",
"\n",
"# Inject CSS to control the output cell height and avoid scrollbars\n",
"html_with_custom_height = f\"\"\"\n",
"<div style=\"height: 400px; overflow: auto;\">\n",
" {html_content}\n",
"</div>\n",
"\"\"\"\n",
"\n",
"HTML(html_with_custom_height)"
]
},
{
Expand Down Expand Up @@ -719,7 +730,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,19 +74,19 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -387,7 +387,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"## Plotting the results"
"## Displaying the timeseries data"
]
},
{
Expand All @@ -398,9 +398,20 @@
},
"outputs": [],
"source": [
"from IPython.display import IFrame\n",
"from IPython.display import HTML\n",
"\n",
"# Define the path to the HTML file\n",
"html_file_path = p.get_reports_dir() / 'traj_results_report.html'\n",
"html_content = html_file_path.read_text()\n",
"\n",
"# Inject CSS to control the output cell height and avoid scrollbars\n",
"html_with_custom_height = f\"\"\"\n",
"<div style=\"height: 800px; overflow: auto;\">\n",
" {html_content}\n",
"</div>\n",
"\"\"\"\n",
"\n",
"IFrame(src='reports/cannonball_implicit_duration/traj_results_report.html', width=700, height=1000)"
"HTML(html_with_custom_height)"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -523,19 +523,19 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
Expand Down Expand Up @@ -674,8 +674,19 @@
},
"outputs": [],
"source": [
"from IPython.display import IFrame\n",
"IFrame(src=str(p.get_reports_dir() / 'traj_results_report.html'), width=800, height=1200)"
"from IPython.display import HTML\n",
"# Define the path to the HTML file\n",
"html_file_path = p.get_reports_dir() / 'traj_results_report.html'\n",
"html_content = html_file_path.read_text()\n",
"\n",
"# Inject CSS to control the output cell height and avoid scrollbars\n",
"html_with_custom_height = f\"\"\"\n",
"<div style=\"height: 800px; overflow: auto;\">\n",
" {html_content}\n",
"</div>\n",
"\"\"\"\n",
"\n",
"HTML(html_with_custom_height)\n"
]
},
{
Expand Down Expand Up @@ -734,7 +745,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.0"
"version": "3.11.4"
}
},
"nbformat": 4,
Expand Down
16 changes: 14 additions & 2 deletions docs/dymos_book/examples/moon_landing/moon_landing.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,20 @@
"metadata": {},
"outputs": [],
"source": [
"from IPython.display import IFrame\n",
"IFrame(src=str(p.get_reports_dir() / 'traj_results_report.html'), width=800, height=1200)"
"from IPython.display import HTML\n",
"\n",
"# Define the path to the HTML file\n",
"html_file_path = p.get_reports_dir() / 'traj_results_report.html'\n",
"html_content = html_file_path.read_text()\n",
"\n",
"# Inject CSS to control the output cell height and avoid scrollbars\n",
"html_with_custom_height = f\"\"\"\n",
"<div style=\"height: 800px; overflow: auto;\">\n",
" {html_content}\n",
"</div>\n",
"\"\"\"\n",
"\n",
"HTML(html_with_custom_height)"
]
},
{
Expand Down
24 changes: 12 additions & 12 deletions docs/dymos_book/examples/mountain_car/mountain_car.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,19 +212,19 @@
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": [
"active-ipynb",
"remove-input",
"remove-output"
]
},
"outputs": [],
"source": [
"%matplotlib inline"
]
},
{
"cell_type": "code",
Expand Down
Loading
Loading