Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,6 @@ cython_debug/
/docs/_static/logos/
/docs/_build/
/docs/changelog.md
/docs_version3/_build/
/docs_version3/_static/logos/
/docs_version3/changelog.md
17 changes: 1 addition & 16 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,10 @@ build:
os: "ubuntu-24.04"
tools:
python: "3.13"
jobs:
post_checkout:
# Copy the appropriate conf.py based on project name
- |
if [ "$DOC_BUILD_VERSION" = "v2" ]; then
echo "DOC_BUILD_VERSION is: $DOC_BUILD_VERSION"
echo "Building brainpy-version2 documentation"
mkdir -p docs_build
cp -r docs_version2/* docs_build/
else
echo "DOC_BUILD_VERSION is: $DOC_BUILD_VERSION"
echo "Building standard brainpy documentation"
mkdir -p docs_build
cp -r docs/* docs_build/
fi

# Build documentation using the copied conf.py
sphinx:
configuration: docs_build/conf.py
configuration: docs/conf.py

# Optionally set the version of Python and requirements required to build your docs
python:
Expand Down
54 changes: 44 additions & 10 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,42 @@
import shutil
import sys

# 要保留的文件/文件夹列表
keep_files = {'highlight_test_lexer.py', 'conf.py', 'make.bat', 'Makefile'}

# 遍历当前目录
for item in os.listdir('.'):
if item not in keep_files:
path = os.path.join('.', item)
try:
if os.path.isfile(path):
os.remove(path)
elif os.path.isdir(path):
shutil.rmtree(path)
except Exception as e:
print(f"Error deleting {item}: {e}")

build_version = os.environ.get('CURRENT_VERSION', 'v3')
if build_version == 'v2':
shutil.copytree(
os.path.join(os.path.dirname(__file__), '../docs_version2'),
os.path.join(os.path.dirname(__file__), ),
dirs_exist_ok=True
)
else:
shutil.copytree(
os.path.join(os.path.dirname(__file__), '../docs_version3'),
os.path.join(os.path.dirname(__file__), ),
dirs_exist_ok=True
)

sys.path.insert(0, os.path.abspath('./'))
sys.path.insert(0, os.path.abspath('../'))
sys.path.insert(0, r'D:\codes\projects\brainstate')

import brainpy

shutil.copytree('../images/', './_static/logos/', dirs_exist_ok=True)
shutil.copyfile('../changelog.md', './changelog.md')
shutil.rmtree('./generated', ignore_errors=True)
shutil.rmtree('./_build', ignore_errors=True)


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

Expand Down Expand Up @@ -88,12 +114,20 @@
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# href with no underline and white bold text color
announcement = """
<a href="https://brainpy-v2.readthedocs.io" style="text-decoration: none; color: white;">
This site covers the new BrainPy 3.0 API.
<span style="color: lightgray;">[Click here for the classical <b>BrainPy 2.0</b> API]</span>
</a>
"""

if build_version == 'v2':
announcement = """
<a href="https://brainpy.readthedocs.io" style="text-decoration: none; color: white;">
This site covers the old BrainPy 2.0 API. <span style="color: lightgray;">[Explore the new <b>BrainPy 3.0</b> API ✨]</span>
</a>
"""
else:
announcement = """
<a href="https://brainpy-v2.readthedocs.io" style="text-decoration: none; color: white;">
This site covers the new BrainPy 3.0 API.
<span style="color: lightgray;">[Click here for the classical <b>BrainPy 2.0</b> API]</span>
</a>
"""

html_theme_options = {
'repository_url': 'https://github.com/brainpy/BrainPy',
Expand Down
21 changes: 0 additions & 21 deletions docs_version2/Makefile

This file was deleted.

150 changes: 0 additions & 150 deletions docs_version2/conf.py

This file was deleted.

35 changes: 0 additions & 35 deletions docs_version2/make.bat

This file was deleted.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading