Skip to content

Commit

Permalink
feat(docs): add .readthedocs.yaml (#34)
Browse files Browse the repository at this point in the history
Co-authored-by: Xuehai Pan <[email protected]>
  • Loading branch information
Benjamin-eecs and XuehaiPan authored Jul 26, 2022
1 parent 7455286 commit bdf1558
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Bug report
about: Create a report to help us improve
title: "[BUG]"
labels: ''
labels: ["bug"]
assignees: Benjamin-eecs

---
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name: Feature request
about: Suggest an idea for this project
title: "[Feature Request]"
labels: ''
labels: ["enhancement"]
assignees: Benjamin-eecs

---
Expand Down
32 changes: 32 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: mambaforge-4.10

# Optionally declare the Python requirements required to build your docs
conda:
environment: docs/conda-recipe.yaml

# If using Sphinx, optionally build your docs in additional formats such as PDF
formats:
- pdf

# Build documentation in the docs/ directory with Sphinx
sphinx:
builder: html
configuration: docs/source/conf.py
fail_on_warning: true

# Optionally declare the Python requirements required to build your docs
python:
install:
- method: pip
path: .
2 changes: 1 addition & 1 deletion conda-recipe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ dependencies:
- sphinxcontrib-spelling
- sphinxcontrib-bibtex
- sphinx-autodoc-typehints
- pyenchant
- myst-nb
- ipykernel
- pandoc
Expand All @@ -76,7 +77,6 @@ dependencies:
- flake8-bugbear
- doc8
- pydocstyle
- pyenchant
- clang-format
- clang-tools # clang-tidy
- cpplint
Expand Down
73 changes: 73 additions & 0 deletions docs/conda-recipe.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Copyright 2022 MetaOPT Team. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
#
# Create virtual environment with command:
#
# $ CONDA_OVERRIDE_CUDA=11.7 conda env create --file docs/conda-recipe.yaml
#

name: torchopt-docs

channels:
- pytorch
- defaults
- conda-forge

dependencies:
- python = 3.8
- pip

# Learning
- pytorch::pytorch = 1.12
- pytorch::torchvision
- pytorch::pytorch-mutex = *=*cpu*
- pip:
- jax[cpu] >= 0.3
- functorch
- torchviz
- sphinxcontrib-katex # for documentation
- tensorboard
- wandb

# Build toolchain
- cmake >= 3.4
- make
- cxx-compiler
- gxx = 10
- nvidia/label/cuda-11.6.2::cuda-nvcc
- nvidia/label/cuda-11.6.2::cuda-cudart-dev
- pybind11

# Misc
- typing-extensions
- numpy
- matplotlib-base
- seaborn
- python-graphviz
- pillow

# Documentation
- sphinx
- sphinx_rtd_theme
- sphinx-autobuild
- sphinx-copybutton
- sphinxcontrib-spelling
- sphinxcontrib-bibtex
- sphinx-autodoc-typehints
- pyenchant
- myst-nb
- ipykernel
- pandoc
- docutils
7 changes: 3 additions & 4 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import inspect
import os
import pathlib
import sys

import sphinxcontrib.katex as katex

import torchopt


HERE = pathlib.Path(__file__).absolute().parent
PROJECT_ROOT = HERE.parent.parent
Expand Down Expand Up @@ -76,12 +73,14 @@ def get_version() -> str:
'sphinx_copybutton',
'sphinx_rtd_theme',
'sphinxcontrib.bibtex',
'sphinxcontrib.spelling',
'sphinxcontrib.katex',
'sphinx_autodoc_typehints',
'myst_nb', # This is used for the .ipynb notebooks
]

if not os.getenv('READTHEDOCS', None):
extensions.append('sphinxcontrib.spelling')

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

Expand Down

0 comments on commit bdf1558

Please sign in to comment.