Skip to content

Commit

Permalink
auto nav
Browse files Browse the repository at this point in the history
  • Loading branch information
efriis committed Dec 16, 2023
1 parent 891b565 commit f322358
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 18 deletions.
9 changes: 1 addition & 8 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,8 @@ on:
inputs:
working-directory:
required: true
type: choice
type: string
default: 'libs/langchain'
options:
- libs/langchain
- libs/core
- libs/experimental
- libs/community
- libs/partners/google-genai
- libs/partners/nvidia-aiplay

env:
PYTHON_VERSION: "3.10"
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ build:
- python -m pip install --upgrade --no-cache-dir pip setuptools
- python -m pip install --upgrade --no-cache-dir sphinx readthedocs-sphinx-ext
- python -m pip install --exists-action=w --no-cache-dir -r docs/api_reference/requirements.txt
- python -m pip install ./libs/partners/*
- python docs/api_reference/create_api_rst.py
- cat docs/api_reference/conf.py
- python -m sphinx -T -E -b html -d _build/doctrees -c docs/api_reference docs/api_reference $READTHEDOCS_OUTPUT/html -j auto
Expand Down
10 changes: 7 additions & 3 deletions docs/api_reference/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,16 +141,20 @@ def setup(app):
for old_link in redirects:
html_additional_pages[old_link] = "redirects.html"

partners_dir = Path(__file__).parent.parent.parent / "libs/partners"
partners = [
(p.name, p.name.replace("-", "_") + "_api_reference")
for p in partners_dir.iterdir()
]

html_context = {
"display_github": True, # Integrate GitHub
"github_user": "langchain-ai", # Username
"github_repo": "langchain", # Repo name
"github_version": "master", # Version
"conf_py_path": "/docs/api_reference", # Path in the checkout to the docs root
"redirects": redirects,
"drop_down_navigation": [
("Google Generative AI", "https://python.langchain.com", "")
],
"partners": partners,
}

# Add any paths that contain custom static files (such as style sheets) here,
Expand Down
1 change: 0 additions & 1 deletion docs/api_reference/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
-e libs/langchain
-e libs/core
-e libs/community
-e libs/partners/google-genai
pydantic<2
autodoc_pydantic==1.8.0
myst_parser
Expand Down
10 changes: 4 additions & 6 deletions docs/api_reference/themes/scikit-learn-modern/nav.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
{%- set top_container_cls = "sk-landing-container" %}
{%- endif %}

{# title, link, link_attrs #}

<nav id="navbar" class="{{ nav_bar_class }} navbar navbar-expand-md navbar-light bg-light py-0">
<div class="container-fluid {{ top_container_cls }} px-0">
{%- if logo_url %}
Expand Down Expand Up @@ -45,16 +43,16 @@
<li class="nav-item">
<a class="sk-nav-link nav-link" href="{{ pathto('experimental_api_reference') }}">Experimental</a>
</li>
{%- for title, link, link_attrs in drop_down_navigation %}
{%- for title, pathname in partners %}
<li class="nav-item">
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="{{ link }}" {{ link_attrs }}>{{ title }}</a>
<a class="sk-nav-link nav-link nav-more-item-mobile-items" href="{{ pathto(pathname) }}">{{ title }}</a>
</li>
{%- endfor %}
<li class="nav-item dropdown nav-more-item-dropdown">
<a class="sk-nav-link nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Partner libs</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
{%- for title, link, link_attrs in drop_down_navigation %}
<a class="sk-nav-dropdown-item dropdown-item" href="{{ link }}" {{ link_attrs }}>{{ title}}</a>
{%- for title, pathname in partners %}
<a class="sk-nav-dropdown-item dropdown-item" href="{{ pathto(pathname) }}">{{ title }}</a>
{%- endfor %}
</div>
</li>
Expand Down

0 comments on commit f322358

Please sign in to comment.