Skip to content

Commit b1729db

Browse files
Fix libai installation failure on readthedocs (Oneflow-Inc#114)
* Test setup.py * Update requirements.txt * Import libai * Fix bug * Fix bug * Fix two of bug * Fix oneflow import bug * Format * Update requirements.txt * Update setup.py * Update conf.py * Update conf.py
1 parent 64397a5 commit b1729db

File tree

5 files changed

+42
-5
lines changed

5 files changed

+42
-5
lines changed

.readthedocs.yaml

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# .readthedocs.yaml
2+
# Read the Docs configuration file
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the version of Python and other tools you might need
9+
build:
10+
os: ubuntu-20.04
11+
tools:
12+
python: "3.7"
13+
# You can also specify other tool versions:
14+
# nodejs: "16"
15+
# rust: "1.55"
16+
# golang: "1.17"
17+
18+
# Build documentation in the docs/ directory with Sphinx
19+
sphinx:
20+
configuration: docs/source/conf.py
21+
22+
# If using Sphinx, optionally build your docs in additional formats such as PDF
23+
# formats:
24+
# - pdf
25+
26+
# Optionally declare the Python requirements required to build your docs
27+
python:
28+
install:
29+
- requirements: requirements.txt
30+
- requirements: docs/requirements.txt

docs/requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sphinx==3.5.4
22
recommonmark==0.6.0
33
furo==2021.4.11b34
4-
git+https://github.com/Oneflow-Inc/vision.git
4+
git+https://github.com/Oneflow-Inc/libai.git
55
--pre
66
-f https://staging.oneflow.info/branch/master/cpu
77
oneflow

docs/source/conf.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
import os
1414
import sys
1515

16+
import libai # noqa
17+
1618
sys.path.insert(0, os.path.abspath("."))
1719

1820
# -- Project information -----------------------------------------------------
@@ -55,7 +57,7 @@
5557
# The theme to use for HTML and HTML Help pages. See the documentation for
5658
# a list of builtin themes.
5759
#
58-
html_theme = "sphinx_rtd_theme"
60+
html_theme = "furo"
5961

6062

6163
def setup(app):

requirements.txt

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ hydra-core
66
nltk
77
numpy
88
omegaconf
9-
oneflow>=0.6.0
109
Pygments
1110
PyYAML
1211
jieba

setup.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import subprocess
1818
import sys
1919

20-
import pybind11
2120
from setuptools import Extension, find_packages, setup
2221

2322
version = "0.0.1.3"
@@ -66,6 +65,13 @@ def write_version_file():
6665
"black==21.4b2",
6766
]
6867

68+
69+
def get_pybind11():
70+
import pybind11 as pb
71+
72+
return pb
73+
74+
6975
extensions = [
7076
Extension(
7177
"libai.data.data_utils.helpers",
@@ -78,7 +84,7 @@ def write_version_file():
7884
"-fPIC",
7985
"-fdiagnostics-color",
8086
],
81-
include_dirs=[pybind11.get_include()],
87+
include_dirs=[get_pybind11().get_include()],
8288
),
8389
]
8490

0 commit comments

Comments
 (0)