-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from LLNL/update-for-pip-install
Update for pip install
- Loading branch information
Showing
4 changed files
with
155 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import os | ||
import sys | ||
|
||
import requests | ||
|
||
if sys.version_info >= (3, 11): | ||
import tomllib | ||
else: | ||
import tomli as tomllib | ||
|
||
sys.path.insert(0, os.path.abspath("../../src/eyeon/")) | ||
|
||
|
||
|
||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# For the full list of built-in configuration values, see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Project information ----------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information | ||
|
||
project = "EyeON" | ||
# pylint: disable-next=redefined-builtin | ||
copyright = "2024, Lawrence Livermore National Security" | ||
author = "Seth Lyles, Wangmo Tenzing, Jack Mooney, Grant Johnson, Isabel Gardner, Grant Espe" | ||
release = "0.0.0rc4" | ||
|
||
# -- General configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration | ||
|
||
extensions = [ | ||
"myst_parser", | ||
"sphinx.ext.autodoc", | ||
"sphinx.ext.napoleon", | ||
"sphinx.ext.viewcode", | ||
"sphinx.ext.intersphinx", | ||
"sphinx.ext.githubpages", | ||
"sphinx.ext.autosummary", | ||
] | ||
|
||
templates_path = ["_templates"] | ||
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "images.toml"] | ||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output | ||
|
||
html_theme = "alabaster" | ||
html_theme_options = { | ||
"description": "EyeON", | ||
"github_user": "LLNL", | ||
"github_repo": "pEyeON", | ||
"github_button": "true", | ||
"github_banner": "true", | ||
"badge_branch": "main", | ||
"fixed_sidebar": "false", | ||
} | ||
|
||
# -- Extension configuration ------------------------------------------------- | ||
|
||
# Napoleon settings for NumPy and Google style docstrings | ||
napoleon_google_docstring = True | ||
napoleon_numpy_docstring = True | ||
html_favicon = html_logo = "../Photo/EyeON_logo.png" | ||
html_sidebars = {"**": ["globaltoc.html", "relations.html", "searchbox.html"]} | ||
html_static_path = ["_static"] | ||
|
||
|
||
# -- Fetch image references -------------------------------------------------- | ||
# Download all of the image files referenced in images.toml | ||
def download_images_from_toml(toml_file, image_dir): | ||
with open(toml_file, "rb") as f: | ||
data = tomllib.load(f) | ||
|
||
if not os.path.exists(image_dir): | ||
os.makedirs(image_dir) | ||
|
||
for file_name, url in data.get("images", {}).items(): | ||
if file_name and url: | ||
response = requests.get(url) | ||
if response.status_code == 200: | ||
with open(os.path.join(image_dir, file_name), "wb") as img_file: | ||
img_file.write(response.content) | ||
else: | ||
print(f"Failed to download {url}") | ||
|
||
|
||
# Path to the TOML file | ||
toml_file_path = os.path.join(os.path.dirname(__file__), "images.toml") | ||
# Directory to save the images | ||
image_directory = os.path.join(os.path.dirname(__file__), "img") | ||
|
||
# Download images | ||
download_images_from_toml(toml_file_path, image_directory) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters