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

Sphinx Multiversioning #346

Open
wants to merge 287 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
287 commits
Select commit Hold shift + click to select a range
13445c7
wrong jekyll changes reverted
ZergLev Apr 27, 2024
71c45c3
automated local doc builds + cleaning only outdated docs locally + sh…
ZergLev May 2, 2024
52ebe11
removed debug output
ZergLev May 2, 2024
2ae84ef
mistake fixed
ZergLev May 2, 2024
c71a93e
mistake fixed
ZergLev May 2, 2024
d6cbee9
mistake fixed
ZergLev May 2, 2024
b0abfe5
Debug output removed
ZergLev May 2, 2024
f5663eb
Comment fixed
ZergLev May 2, 2024
371e655
Review change
ZergLev May 2, 2024
17ca707
made it an option for conf.py replacement
ZergLev May 2, 2024
9be3858
Merge branch 'feat/sphinx_multiversion' of https://github.com/ZergLev…
ZergLev May 2, 2024
21869ed
removed saving branch name without slashes, because it's unused now
ZergLev May 2, 2024
cd6c5b4
Fixed mistake
ZergLev May 2, 2024
9eaa6b5
only updating switcher from master (wouldn't want to break it from an…
ZergLev May 2, 2024
e93c946
Merge branch 'feat/sphinx_multiversion' of https://github.com/ZergLev…
ZergLev May 2, 2024
77a6a52
merging dev
ZergLev Sep 27, 2024
daa496c
minor self-review changes
ZergLev Sep 27, 2024
3887383
dependencies mistake fixed + lint
ZergLev Sep 27, 2024
b75c8cc
merge change + mistake fixed
ZergLev Sep 27, 2024
ad05246
testing github workflow (actions/checkout@v4)
ZergLev Sep 27, 2024
fa26ee4
Revert "testing github workflow (actions/checkout@v4)"
ZergLev Sep 27, 2024
07d1eeb
testing workflow
ZergLev Sep 27, 2024
f29d02a
removed customized sphinx-polyversion dependency, it's now relying on…
ZergLev Sep 27, 2024
73602da
testing the fix for detached HEAD in PRs
ZergLev Oct 2, 2024
faaaf4d
Merge branch 'dev' into feat/sphinx_multiversion
ZergLev Oct 2, 2024
1610fcb
testing
ZergLev Oct 2, 2024
ea07d52
Merge branch 'feat/sphinx_multiversion' of https://github.com/ZergLev…
ZergLev Oct 2, 2024
bb939fd
testing
ZergLev Oct 2, 2024
26ab914
testing
ZergLev Oct 2, 2024
c3a931b
detached head fix drafted
ZergLev Oct 2, 2024
d5da02f
testing
ZergLev Oct 2, 2024
85ca397
testing
ZergLev Oct 2, 2024
95e0e7d
testing
ZergLev Oct 2, 2024
71c2565
testing artifact saving
ZergLev Oct 2, 2024
652d7c2
more testing
ZergLev Oct 2, 2024
4022111
fixed typo
ZergLev Oct 2, 2024
c203eea
fixed typo
ZergLev Oct 2, 2024
1667bc1
testing
ZergLev Oct 2, 2024
7ad36c6
testing
ZergLev Oct 2, 2024
70d8350
testing
ZergLev Oct 2, 2024
87d7afd
fixed typo
ZergLev Oct 2, 2024
f9d9978
drafted new colab and github links in tutorials
ZergLev Oct 4, 2024
f43edb4
Merge branch 'dev' into feat/sphinx_multiversion
ZergLev Oct 4, 2024
d9b1c9e
testing adding doc_version via conf.py
ZergLev Oct 4, 2024
784fc0c
Merge branch 'feat/sphinx_multiversion' of https://github.com/ZergLev…
ZergLev Oct 4, 2024
aa3c320
testing
ZergLev Oct 4, 2024
02a4be5
drafted old docs build in local builds and PRs
ZergLev Oct 4, 2024
8f67549
testing
ZergLev Oct 4, 2024
a4fc074
attempting to fix links
ZergLev Oct 7, 2024
dab2bb9
small changes, testing
ZergLev Oct 7, 2024
2b27597
during non-polyversion build setup is just imported into conf.py from…
ZergLev Oct 7, 2024
751a87b
testing
ZergLev Oct 7, 2024
43de4e6
testing poly build
ZergLev Oct 7, 2024
a30b21e
testing
ZergLev Oct 7, 2024
3b2c772
switched order of setup and link fixing
ZergLev Oct 7, 2024
df027ef
added POLYVERSION_BUILD variable handling in github actions
ZergLev Oct 7, 2024
0d2ac40
fixed small mistake
ZergLev Oct 7, 2024
2f76d66
testing
ZergLev Oct 7, 2024
4175a29
fixed typo + updated tutorial toctree
ZergLev Oct 7, 2024
3bf22d4
testing
ZergLev Oct 7, 2024
9f5fec3
fixed typo
ZergLev Oct 7, 2024
1fcb631
testing no polyversion build
ZergLev Oct 7, 2024
82154ca
fixed typo
ZergLev Oct 7, 2024
a09afba
github workflow will delete all the old versions of docs now, testing
ZergLev Oct 9, 2024
aacca40
fixing an issue, added docs link printout to workflow
ZergLev Oct 9, 2024
64c6930
fixing an issue (conf.py setup needs an empty argument slot)
ZergLev Oct 9, 2024
b5bf331
poly.py partial self-review
ZergLev Oct 9, 2024
a84857d
testing PR docs building
ZergLev Oct 9, 2024
38214b4
not deleting old files for PRs for now
ZergLev Oct 9, 2024
f1edadb
added deleting old docs for PRs
ZergLev Oct 9, 2024
6502a1c
fixing PR outputting into the wrong folder
ZergLev Oct 9, 2024
684599b
fixing workflow's small python script
ZergLev Oct 9, 2024
c475156
fixed typo (fixed recursive directory declaration)
ZergLev Oct 9, 2024
31b752d
fixed PR deploy target directory, testing
ZergLev Oct 9, 2024
64e9375
fixed typo
ZergLev Oct 9, 2024
c6808bb
fixed typo
ZergLev Oct 9, 2024
3fc0dc9
Added comments and some changes during the call
ZergLev Oct 9, 2024
253f85c
mention project template in the getting started section
RLKRo Oct 10, 2024
59687da
added the creation of tag regex for polyversion, plus filtering for '…
ZergLev Oct 11, 2024
3ed732f
testing polyversion tag building
ZergLev Oct 11, 2024
b8dea82
fixed typo in workflow
ZergLev Oct 11, 2024
53ceae5
fixed typo
ZergLev Oct 11, 2024
466675a
testing
ZergLev Oct 11, 2024
bc9e559
fixed mistake
ZergLev Oct 11, 2024
0aa2fc2
testing
ZergLev Oct 11, 2024
fa22f77
fixed typo
ZergLev Oct 11, 2024
bfd7f4e
drafted setup() function import for older versions
ZergLev Oct 11, 2024
95d604b
testing
ZergLev Oct 11, 2024
3061a1c
testing
ZergLev Oct 11, 2024
48156fa
removed setup() usage from builder.py, it's now called from conf.py
ZergLev Oct 11, 2024
5570c3f
fixed typo
ZergLev Oct 11, 2024
1d6fc2f
fixed typo
ZergLev Oct 11, 2024
5ff2d0a
testing
ZergLev Oct 11, 2024
a944f57
Merge branch 'deeppavlov:master' into master
ZergLev Oct 11, 2024
9255c53
testing
ZergLev Oct 11, 2024
7f4a153
building docs only for latest tags in their respective groups
ZergLev Oct 14, 2024
91b3005
adding sphinx-polyversion to poetry dependencies for each build
ZergLev Oct 14, 2024
f1aeceb
changed link_misc_files() to work on Windows pathing too
ZergLev Oct 16, 2024
59ea195
drafted version-dependent links for PRs and local builds (using strin…
ZergLev Oct 16, 2024
6cd25b1
drafted sphinx-polyversion being added to each build (created custom …
ZergLev Oct 16, 2024
8ec6aa4
lint + a few typos fixed
ZergLev Oct 16, 2024
46993c4
changed custom class to include everythin, there has to be a better w…
ZergLev Oct 16, 2024
9da7aa0
fixed imports
ZergLev Oct 16, 2024
cb6c579
fixing imports
ZergLev Oct 16, 2024
648627b
debugging
ZergLev Oct 16, 2024
432ac89
fixed minor mistake
ZergLev Oct 16, 2024
8a13a01
trying to fix setup() import
ZergLev Oct 16, 2024
4dc1197
some comments added during the call
ZergLev Oct 17, 2024
6046a85
custom Poetry class workaround removed, instead pyproject.toml files …
ZergLev Oct 17, 2024
416d9f2
fixing conf.py imports
ZergLev Oct 18, 2024
69fc752
workflow mistake fixed, added a custom polyversion driver for catchin…
ZergLev Oct 18, 2024
520a0b3
attempting simple setup() import in conf.py
ZergLev Oct 18, 2024
a1b26d5
debugging
ZergLev Oct 18, 2024
d8bc882
debugging
ZergLev Oct 18, 2024
a0d33c8
fixed mistake in APIref building
ZergLev Oct 18, 2024
4c86ac6
fixed another mistake in APIref and drawio building
ZergLev Oct 18, 2024
e4c1ca7
fixed another APIref building mistake, debugging
ZergLev Oct 18, 2024
9430993
changed comment
ZergLev Oct 18, 2024
3c5e46c
drafted multiversion example and source links, fixed a mistake in dra…
ZergLev Oct 18, 2024
aaf3346
testing
ZergLev Oct 18, 2024
1925acb
Merge branch 'feat/sphinx_multiversion' of https://github.com/ZergLev…
ZergLev Oct 18, 2024
05bdbe4
Revert "testing"
ZergLev Oct 18, 2024
5585c18
drafting configs dict for setup() utils funcs (squash this commit)
ZergLev Oct 23, 2024
a2c0783
lots of comments on how to change the entire PR (squash this commit)
ZergLev Oct 23, 2024
40e62a3
merged laptop's work (squash this commit)
ZergLev Oct 23, 2024
f640188
setup() changed to use a dict of parameters as it's configs
ZergLev Oct 23, 2024
c0db3d2
building the 'latest' version only when necessary to save time
ZergLev Oct 23, 2024
5e5fc18
fixed wrong import
ZergLev Oct 23, 2024
7a694ed
fixed import + formatted (squash this commit)
ZergLev Oct 23, 2024
8c3c6f7
building the 'latest' version only when necessary to save time
ZergLev Oct 23, 2024
c3db9a3
building the 'latest' version only when necessary to save time
ZergLev Oct 23, 2024
d83468c
removed redundant comment
ZergLev Oct 23, 2024
3c13f06
Merge branch 'master' of https://github.com/ZergLev/chatsky
ZergLev Oct 23, 2024
8e06cc2
lint + typo fixed (squash this commit)
ZergLev Oct 23, 2024
29f7759
Merge branch 'master' of https://github.com/ZergLev/chatsky into feat…
ZergLev Oct 23, 2024
853d1de
Merge branch 'feat/sphinx_multiversion' of https://github.com/ZergLev…
ZergLev Oct 23, 2024
05a5778
testing no master branch building
ZergLev Oct 23, 2024
823e19d
fixed typo
ZergLev Oct 23, 2024
15c4a7c
updated deps
ZergLev Oct 16, 2024
686349b
local version builds properly, typos fixed
ZergLev Oct 24, 2024
f4a6ec6
setup() is called from builder during polyversion builds again, this …
ZergLev Oct 24, 2024
b19af03
posting v0.8.0 and v0.9.0 buildsto gh-pages, while ignoring warnings
ZergLev Oct 24, 2024
b7becbd
add tmp_docs
RLKRo Oct 25, 2024
7463de7
comments added
ZergLev Oct 28, 2024
1d23af8
Merge branch 'master' of https://github.com/ZergLev/chatsky
ZergLev Oct 28, 2024
e40767b
lint
ZergLev Oct 28, 2024
49b91b7
builder doesn't redefine polyversion's code now, testing
ZergLev Oct 28, 2024
bdc6ae8
reconfigured switcher_json to the recent version of PR
ZergLev Oct 28, 2024
0f52907
fixed circular import (added tags_filter.py file)
ZergLev Oct 28, 2024
75784e1
drafted new 404.html file in gh-pages branch (redirecting from latest…
ZergLev Oct 28, 2024
08da682
added current date showing up (not fully configured yet, testing)
ZergLev Oct 28, 2024
b8eee75
remade workflow and partially version-switcher generator (removing sp…
ZergLev Oct 31, 2024
a53aba1
removing sphinx-polyversion, switching to own Sphinx Multiversioning,…
ZergLev Oct 31, 2024
51265de
restored the rest of the old files
ZergLev Oct 31, 2024
d63587b
testing build
ZergLev Oct 31, 2024
075c736
lint
ZergLev Oct 31, 2024
0e604e3
adding today's date to docs
ZergLev Oct 31, 2024
ab3c864
testing today's date in docs
ZergLev Oct 31, 2024
61d9e8d
changed today's format in conf.py, switcher-gen tag filtering workaro…
ZergLev Nov 1, 2024
b292ad0
added switcher-gen to github workflow
ZergLev Nov 1, 2024
16e903d
changed workflow to update the version switcher file in a different w…
ZergLev Nov 1, 2024
9628ae8
added GitPython to 'docs' dependencies
ZergLev Nov 1, 2024
4e25b1f
poetry.lock updated
ZergLev Nov 1, 2024
376bd1f
moved switcher generation from workflow into setup(), as it makes mor…
ZergLev Nov 1, 2024
759e986
poetrly.lock updated
ZergLev Nov 1, 2024
a7a1e59
testing workflow updating version switcher
ZergLev Nov 1, 2024
2f9976f
debugging workflow updating version switcher
ZergLev Nov 1, 2024
9d9aa9c
debugging workflow updating version switcher
ZergLev Nov 1, 2024
b7c80c4
debugging workflow updating version switcher
ZergLev Nov 1, 2024
0a7f171
testing workflow updating version switcher
ZergLev Nov 1, 2024
1250537
fixed versions being reversed in the version switcher file
ZergLev Nov 1, 2024
73d177c
workflow now triggers with tag pushes
ZergLev Nov 1, 2024
89369ec
notes during the work call, some comments changed
ZergLev Nov 2, 2024
bdc9425
moved version switcher generation to scripts + slightly changed file …
ZergLev Nov 2, 2024
c4e7ff6
refactored version switcher updated, mistake fixed (double index.html…
ZergLev Nov 2, 2024
91354de
added versioning links in .rst files, testing
ZergLev Nov 2, 2024
c1be4fe
changed versioned links to extlinks (except example and source links)…
ZergLev Nov 2, 2024
6f5e9f4
fixed versioned links for example and source links
ZergLev Nov 2, 2024
ade1fa5
work call notes added
ZergLev Nov 5, 2024
0428a26
showing version warning banners for tags and dev only, testing
ZergLev Nov 6, 2024
a91f8f1
returned setup() into a separate file, added start_version to switche…
ZergLev Nov 6, 2024
a3c555d
replaced 'zerglev' with 'deeppavlov'
ZergLev Nov 6, 2024
07c2e40
Merge branch 'dev' into feat/sphinx_multiversion
ZergLev Nov 6, 2024
466cdce
updating version switcher and cleaning docs with github-deploy-action…
ZergLev Nov 8, 2024
ef59767
fixed minor mistake (copying a file into a non-existent directory)
ZergLev Nov 8, 2024
a91a6b7
version warning banner removed
ZergLev Nov 8, 2024
1806dfb
gh-mutex added for github-pages deployment security
ZergLev Nov 8, 2024
31bb42f
parsing GitHub Actions variables now
ZergLev Nov 8, 2024
1d5e296
self-review (changed mostly redundant imports or misleading comments)
ZergLev Nov 8, 2024
71ab8da
fixed mistake (github actions variable usage)
ZergLev Nov 8, 2024
9146de4
fixed github-actions variables parsing
ZergLev Nov 8, 2024
b813b98
fixed github-actions variables parsing
ZergLev Nov 8, 2024
a388219
fixed typo (changed again how github variables are parsed)
ZergLev Nov 8, 2024
9e7d765
showcase build (deeppavlov -> zerglev (for correct version switcher l…
ZergLev Nov 8, 2024
9ddbfc7
added a workflow that generates the version switcher, testing
ZergLev Nov 11, 2024
db65ea8
added GitPython installation to version siwthcer workflow
ZergLev Nov 11, 2024
64c9362
debugging version switcher workflow
ZergLev Nov 11, 2024
8a3c761
fixed typo (wrong directory used when copying switcher)
ZergLev Nov 11, 2024
9dc5557
fixed typo
ZergLev Nov 11, 2024
a56e14d
debugging version switcher workflow
ZergLev Nov 11, 2024
73caab5
fixed typo (didn't call switcher generating function from the relevan…
ZergLev Nov 11, 2024
7474e05
switcher_gen workflow works now, enabling GitHub CLI to trigger it
ZergLev Nov 11, 2024
0178831
cancelling switcher-gen in progress for all branches
ZergLev Nov 11, 2024
41afdaf
cancelling switcher-gen in progress for all branches
ZergLev Nov 11, 2024
4a997e7
removed debug output
ZergLev Nov 11, 2024
9eefcd2
zerglev changed into deeppavlov for PR
ZergLev Nov 11, 2024
29dd9fc
switcher generator workflow starts with a proper trigger now, formatt…
ZergLev Nov 13, 2024
c2a730e
tutorial source files updated to install deps from poetry.lock file
ZergLev Nov 13, 2024
615932e
trying to fix InstallationCell's static method, testing
ZergLev Nov 13, 2024
fd87b31
fixed my own typo in test_tutorials
ZergLev Nov 13, 2024
d4a4ca3
testing pulling chatsky version from poetry.lock in test_tutorials()
ZergLev Nov 13, 2024
c99e982
fixed typo in test_tutorials (now saving versions_dict before(!) runn…
ZergLev Nov 13, 2024
64c5c7e
Merge branch 'master' of https://github.com/ZergLev/chatsky into feat…
ZergLev Nov 13, 2024
5c75e99
added pytest marker 'needs_dependencies' to fix test_tutorials(), als…
ZergLev Nov 18, 2024
195210e
fixed test_tutorials() with regex, testing
ZergLev Nov 18, 2024
40df25b
removed debug output in workflow, moved pytest marker into the right …
ZergLev Nov 18, 2024
95bdffe
removed redundant comments + formatted
ZergLev Nov 18, 2024
08a09f7
fixed lint, testing if it will break notebook.py
ZergLev Nov 19, 2024
a68db43
pytest marker description changed
ZergLev Nov 27, 2024
c2a8d9c
style: joined strings in a file
ZergLev Nov 27, 2024
58a0e28
refactor: using sets for easier filtering
ZergLev Nov 27, 2024
8f1801e
fixed version comparisons in version switcher generator
ZergLev Nov 27, 2024
18aa3b6
avoiding switcher_gen.py execution upon file import
ZergLev Nov 27, 2024
cd04770
refactor: added BASE_URL variable in switcher_gen.py
ZergLev Nov 27, 2024
865ee0b
refactor: stopped renaming versions into themselves (in the version s…
ZergLev Nov 27, 2024
2855d34
moved comments into a function's docstring
ZergLev Nov 27, 2024
457a6f7
Stopped adding .nojekyll every time docs are built (it's saved now)
ZergLev Nov 29, 2024
97f5f51
renamed 'github_versioned_link' into 'github_source_link'
ZergLev Nov 29, 2024
e7c7b19
Merge branch 'feat/sphinx_multiversion' of https://github.com/ZergLev…
ZergLev Nov 29, 2024
bdb860e
removed empty argument in setup()
ZergLev Nov 29, 2024
0669919
default doc_version for replacement strings switched to 'master'
ZergLev Nov 29, 2024
760d9c0
moved version switcher's vars into switcher-gen workflow
ZergLev Nov 29, 2024
e8851e8
throwing exception in case start_version doesn't fit regexp in switch…
ZergLev Nov 29, 2024
940222e
fixed comparison to start_version in switcher-gen.py
ZergLev Nov 29, 2024
05083e4
fixing test_tutorials for the case where there aren't any chatsky dep…
ZergLev Nov 29, 2024
1de6cc7
lint
ZergLev Nov 29, 2024
5f3c326
added docs for versions() func in notebook.py
ZergLev Nov 29, 2024
3c23bf3
trying to fix test_tutorials
ZergLev Nov 29, 2024
81ae07c
docstring added for generate_version_switcher()
ZergLev Nov 29, 2024
4ca5558
fixed test_tutorials locally, testing remotely
ZergLev Nov 29, 2024
51f44e2
fixed test_tutorials in GitHub CodeSpaces, testing
ZergLev Nov 29, 2024
bcf0a8e
trying to fix test_tutorials, testing
ZergLev Nov 29, 2024
20889e3
added replace_versions func in test_tutorials, also probably fixed te…
ZergLev Nov 29, 2024
a0db3f9
fixed circular import
ZergLev Nov 29, 2024
db5c67a
trying to fix test_tutorials
ZergLev Nov 29, 2024
e1cf269
trying to fix test_tutorials (attempting a configuration which alread…
ZergLev Nov 29, 2024
86ebad5
test_tutorials trying the exact configs to fix it
ZergLev Nov 29, 2024
09b1f62
debugging test_tutorials
ZergLev Nov 29, 2024
0572c39
moved replace_versions into InstallationCell, accounting for capture …
ZergLev Nov 29, 2024
a4f88d2
final fix for test_tutorials (noqa removed from tutorials for clarity)
ZergLev Nov 29, 2024
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
10 changes: 9 additions & 1 deletion .github/workflows/build_and_publish_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
git remote show origin
git checkout dev
git checkout master
git branch --all

- name: set up python 3.9
uses: actions/setup-python@v5
Expand All @@ -43,6 +50,7 @@ jobs:
TG_API_HASH: ${{ secrets.TG_API_HASH }}
TG_BOT_USERNAME: ${{ secrets.TG_BOT_USERNAME }}
run: |
git branch
python -m poetry run poe docs

- name: remove jekyll theming
Expand All @@ -66,7 +74,7 @@ jobs:
retention-days: 3

- name: deploy website
if: ${{ github.ref == 'refs/heads/master' }}
if: ${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev' }}
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
Expand Down
12 changes: 12 additions & 0 deletions docs/source/_static/switcher.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"name": "stable(master)",
"version": "master",
"url": "https://zerglev.github.io/dialog_flow_framework/master/index.html"
},
{
"name": "latest(dev)",
"version": "dev",
"url": "https://zerglev.github.io/dialog_flow_framework/dev/index.html"
}
]
12 changes: 12 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,14 @@
from utils.generate_tutorials import generate_tutorial_links_for_notebook_creation # noqa: E402
from utils.link_misc_files import link_misc_files # noqa: E402
from utils.regenerate_apiref import regenerate_apiref # noqa: E402
from sphinx_polyversion import load
from sphinx_polyversion.git import GitRef

# -- Project information -----------------------------------------------------

data = load(globals()) # adds variables `current` and `revisions`
current: GitRef = data['current']

_distribution_metadata = importlib.metadata.metadata('dff')

project = _distribution_metadata["Name"]
Expand Down Expand Up @@ -111,6 +116,8 @@
"css/custom.css",
]

switcher_url = "https://raw.githubusercontent.com/ZergLev/dialog_flow_framework/master/docs/source/_static/switcher.json"

# Theme options
html_theme_options = {
"header_links_before_dropdown": 5,
Expand Down Expand Up @@ -139,6 +146,11 @@
},
],
"secondary_sidebar_items": ["page-toc", "source-links", "example-links"],
"switcher": {
"json_url": switcher_url,
"version_match": current[0],
},
"navbar_start": ["navbar-logo", "version-switcher"],
ZergLev marked this conversation as resolved.
Show resolved Hide resolved
}


Expand Down
60 changes: 60 additions & 0 deletions docs/source/poly.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
from pathlib import Path
from datetime import datetime
from sphinx_polyversion import *
from sphinx_polyversion.git import *
from sphinx_polyversion.pyvenv import Poetry
from sphinx_polyversion.sphinx import SphinxBuilder

#: Regex matching the branches to build docs for
BRANCH_REGEX = r"(dev|master|test_branch|test_branch_2|feat/sphinx_multiversion|sphinx_multiversion_test)"

#: Regex matching the tags to build docs for
TAG_REGEX = r"-"

#: Output dir relative to project root
OUTPUT_DIR = "docs/build"

#: Source directory
SOURCE_DIR = "docs/source"

#: Arguments to pass to `poetry install`
POETRY_ARGS = "--with tutorials,docs --all-extras --no-ansi --no-interaction".split()

#: Arguments to pass to `sphinx-build`
SPHINX_ARGS = "-b html -W --keep-going -v".split()

#: Mock data used for building local version
MOCK_DATA = {
"revisions": [
GitRef("dev", "", "", GitRefType.BRANCH, datetime.fromtimestamp(0)),
GitRef("master", "", "", GitRefType.BRANCH, datetime.fromtimestamp(1)),
GitRef("test_branch", "", "", GitRefType.BRANCH, datetime.fromtimestamp(2)),
GitRef("test_branch_2", "", "", GitRefType.BRANCH, datetime.fromtimestamp(3)),
GitRef("feat/sphinx_multiversion", "", "", GitRefType.BRANCH, datetime.fromtimestamp(4)),
],
"current": GitRef("local", "", "", GitRefType.BRANCH, datetime.fromtimestamp(5)),
}
MOCK = False
RLKRo marked this conversation as resolved.
Show resolved Hide resolved

# Load overrides read from commandline to global scope
apply_overrides(globals())
# Determine repository root directory
root = Git.root(Path(__file__).parent)
src = Path(SOURCE_DIR)

# Setup driver and run it
DefaultDriver(
root,
OUTPUT_DIR,
vcs=Git(
branch_regex=BRANCH_REGEX,
tag_regex=TAG_REGEX,
buffer_size=1 * 10**9, # 1 GB
predicate=file_predicate([src]), # exclude refs without source dir
),
builder=SphinxBuilder(src, args=SPHINX_ARGS),
env=Poetry.factory(args=POETRY_ARGS),
template_dir=root / src / "templates",
static_dir=root / src / "static",
mock=MOCK_DATA,
).run(MOCK)
Loading