-
-
Notifications
You must be signed in to change notification settings - Fork 437
Replace MkDocs with Zensical for the documentation site #544
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
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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,73 @@ | ||
| """Convert Jupyter notebooks in the docs folder to Markdown for Zensical. | ||
|
|
||
| Zensical does not yet support the mkdocs-jupyter plugin, so this script | ||
| converts every notebook under ``docs/examples`` and ``docs/workshops`` to a | ||
| Markdown file of the same name before the site is built. A download link to | ||
| the original notebook (which Zensical copies into the site as a static file) | ||
| is prepended to each page. | ||
|
|
||
| Usage: | ||
| python scripts/convert_notebooks.py | ||
| """ | ||
|
|
||
| import pathlib | ||
| import sys | ||
|
|
||
| import nbformat | ||
| from nbconvert import MarkdownExporter | ||
|
|
||
| ROOT = pathlib.Path(__file__).resolve().parents[1] | ||
| NOTEBOOK_DIRS = ["docs/examples", "docs/workshops"] | ||
| REPO_URL = "https://github.com/opengeos/segment-geospatial" | ||
|
|
||
|
|
||
| def convert_notebook(nb_path: pathlib.Path) -> pathlib.Path: | ||
| """Convert a single notebook to a Markdown file alongside it. | ||
|
|
||
| Args: | ||
| nb_path: Path to the ``.ipynb`` file to convert. | ||
|
|
||
| Returns: | ||
| pathlib.Path: Path to the generated ``.md`` file. | ||
| """ | ||
| notebook = nbformat.read(nb_path, as_version=4) | ||
| exporter = MarkdownExporter() | ||
| body, _ = exporter.from_notebook_node(notebook) | ||
|
|
||
| rel_path = nb_path.relative_to(ROOT) | ||
| header = ( | ||
| f"[![Download notebook]" | ||
| f"(https://img.shields.io/badge/Download-notebook-blue)]" | ||
| f"({REPO_URL}/blob/main/{rel_path.as_posix()})\n\n" | ||
| ) | ||
|
|
||
| md_path = nb_path.with_suffix(".md") | ||
| md_path.write_text(header + body, encoding="utf-8") | ||
| return md_path | ||
|
|
||
|
|
||
| def main() -> None: | ||
| """Convert all notebooks in the configured docs directories. | ||
|
|
||
| Conversion continues past individual failures so that one broken | ||
| notebook does not hide the status of the others; the script exits | ||
| with a non-zero status if any notebook failed to convert. | ||
| """ | ||
| failures = [] | ||
| for dir_name in NOTEBOOK_DIRS: | ||
| for nb_path in sorted((ROOT / dir_name).glob("*.ipynb")): | ||
| try: | ||
| md_path = convert_notebook(nb_path) | ||
| except Exception as e: | ||
| failures.append(nb_path) | ||
| print(f"FAILED to convert {nb_path.relative_to(ROOT)}: {e}") | ||
| else: | ||
| print(f"Converted {nb_path.relative_to(ROOT)} -> {md_path.name}") | ||
|
|
||
| if failures: | ||
| print(f"{len(failures)} notebook(s) failed to convert.") | ||
| sys.exit(1) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
This file contains hidden or 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,109 @@ | ||
| [project] | ||
| site_name = "segment-geospatial" | ||
| site_url = "https://samgeo.gishub.org" | ||
| site_description = "A Python package for segmenting geospatial data with the Segment Anything Model (SAM)" | ||
| repo_url = "https://github.com/opengeos/segment-geospatial" | ||
|
|
||
| nav = [ | ||
| { "Home" = "index.md" }, | ||
| { "Installation" = "installation.md" }, | ||
| { "Usage" = "usage.md" }, | ||
| { "REST API" = "api.md" }, | ||
| { "Contributing" = "contributing.md" }, | ||
| { "FAQ" = "faq.md" }, | ||
| { "Changelog" = "changelog.md" }, | ||
| { "Report Issues" = "https://github.com/opengeos/segment-geospatial/issues" }, | ||
| { "Examples" = [ | ||
| "examples/satellite.md", | ||
| "examples/automatic_mask_generator.md", | ||
| "examples/automatic_mask_generator_hq.md", | ||
| "examples/input_prompts.md", | ||
| "examples/input_prompts_hq.md", | ||
| "examples/box_prompts.md", | ||
| "examples/text_prompts.md", | ||
| "examples/text_prompts_batch.md", | ||
| "examples/fast_sam.md", | ||
| "examples/text_swimming_pools.md", | ||
| "examples/arcgis.md", | ||
| "examples/maxar_open_data.md", | ||
| "examples/sam2_automatic.md", | ||
| "examples/sam2_predictor.md", | ||
| "examples/sam2_video.md", | ||
| "examples/sam2_box_prompts.md", | ||
| "examples/sam2_point_prompts.md", | ||
| "examples/sam2_text_prompts.md", | ||
| "examples/tree_mapping.md", | ||
| "examples/image_captioning.md", | ||
| "examples/sam3_image_segmentation.md", | ||
| "examples/sam3_image_segmentation_jpg.md", | ||
| "examples/sam3_interactive.md", | ||
| "examples/sam3_batch_segmentation.md", | ||
| "examples/sam3_video_segmentation.md", | ||
| "examples/sam3_video_prompts.md", | ||
| "examples/sam3_video_masks.md", | ||
| "examples/sam3_automated_segmentation.md", | ||
| "examples/sam3_object_tracking.md", | ||
| "examples/sam3_point_prompts.md", | ||
| "examples/sam3_point_prompts_batch.md", | ||
| "examples/sam3_box_prompts.md", | ||
| "examples/sam3_tiled_segmentation.md", | ||
| "examples/detectree2.md", | ||
| ] }, | ||
| { "Workshops" = [ | ||
| "workshops/purdue.md", | ||
| "workshops/cn_workshop.md", | ||
| "workshops/IPPN_2024.md", | ||
| "workshops/AIforGood_2025.md", | ||
| ] }, | ||
| { "API Reference" = [ | ||
| { "caption module" = "caption.md" }, | ||
| { "common module" = "common.md" }, | ||
| { "samgeo module" = "samgeo.md" }, | ||
| { "samgeo2 module" = "samgeo2.md" }, | ||
| { "samgeo3 module" = "samgeo3.md" }, | ||
| { "fast_sam module" = "fast_sam.md" }, | ||
| { "hq_sam module" = "hq_sam.md" }, | ||
| { "text_sam module" = "text_sam.md" }, | ||
| { "detectree2 module" = "detectree2.md" }, | ||
| { "api module" = "api.md" }, | ||
| ] }, | ||
| ] | ||
|
|
||
| [project.theme] | ||
| features = [ | ||
| "content.code.copy", | ||
| "navigation.instant", | ||
| "navigation.top", | ||
| "search.highlight", | ||
| ] | ||
|
|
||
| [project.theme.icon] | ||
| repo = "fontawesome/brands/github" | ||
|
|
||
| [[project.theme.palette]] | ||
| media = "(prefers-color-scheme: light)" | ||
| scheme = "default" | ||
| toggle.icon = "lucide/sun" | ||
| toggle.name = "Switch to dark mode" | ||
|
|
||
| [[project.theme.palette]] | ||
| media = "(prefers-color-scheme: dark)" | ||
| scheme = "slate" | ||
| toggle.icon = "lucide/moon" | ||
| toggle.name = "Switch to light mode" | ||
|
|
||
| [project.plugins.mkdocstrings.handlers.python] | ||
| paths = ["."] | ||
|
|
||
| [project.plugins.mkdocstrings.handlers.python.options] | ||
| docstring_style = "google" | ||
|
|
||
| [project.markdown_extensions.attr_list] | ||
|
|
||
| [project.markdown_extensions.toc] | ||
| permalink = true | ||
|
|
||
| [project.markdown_extensions.pymdownx.superfences] | ||
|
|
||
| [project.markdown_extensions.pymdownx.highlight] | ||
| linenums = true |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🌐 Web query:
Does GitHub Actions ubuntu-latest runner include ~/.local/bin in PATH for run steps💡 Result:
Whether the ~/.local/bin directory is included in the PATH on GitHub Actions ubuntu-latest runners is inconsistent and can vary depending on the specific runner image version and architecture [1]. While some versions of the Ubuntu-hosted runners include /home/runner/.local/bin in the default PATH [2][1], others do not [3][4][5]. Because this behavior is not guaranteed across all runner environments, it is recommended practice to explicitly add ~/.local/bin to your PATH if your workflow depends on binaries installed there (e.g., via pip) [4][1]. To add it to the PATH for the remainder of your job, you can use the GITHUB_PATH environment file [6][7]: - name: Add ~/.local/bin to PATH run: echo "$HOME/.local/bin" >> $GITHUB_PATH Alternatively, if you only need it for a single step, you can modify the PATH variable within that step's script [8]. It is generally best to avoid relying on the default inclusion of this directory to ensure your workflows remain portable and predictable [4][1].
Citations:
PATHvariable not being updated actions/runner#2293🏁 Script executed:
Repository: opengeos/segment-geospatial
Length of output: 3191
zensicalneeds to be on PATH before the build step.pip install --usercan place the console script under~/.local/bin, which GitHub Actions does not guarantee is onPATHforrun:steps, sozensical build --clean --strictmay fail withcommand not found. Drop--user, or add$HOME/.local/bintoGITHUB_PATHbefore the build step.🤖 Prompt for AI Agents