I'm trying to put the documentation of a code i've done on readthedocs but all the pages just becomes blank. I've tried it all day i've watched/readed dozens of tutorials but nothing seens to work. It builds normally when I do it locally.
The directories are organized like this:
/root: /docs, module1.py, module2.py, module3.py, .readthedocs.yml
root/docs: /_build, /_static, /_templates, conf.py, index.rst, make.bat, Makefile, requirements.txt, module1.rst, module2.rst, module3.rst
I will leave here below the codes of .readthedocs.yml, conf.py and requirements.txt for you to see if I've done some shit. I'm getting sick of so much trying make this thing work please help me
#readthedocs.yml
version: 2
sphinx:
configuration: docs/conf.py
formats: all
python:
version: 3.8
install:
- requirements: docs/requirements.txt
#conf.py
import sphinx_rtd_theme
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
project = 'MolOpt'
copyright = '2021, estevaopbs'
author = 'estevaopbs'
extensions = [
'sphinx.ext.autodoc'
]
templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
html_theme = 'sphinx_rtd_theme'
html_static_path = ['_static']
#requirements.txt
sphinx_rtd_theme==1.0.0
As @Steve Piercy says, this happens because Sphinx finds an exception when trying to import your project. You can see that here:
https://readthedocs.org/projects/molopt/builds/15211653/
In particular, under the /home/docs/checkouts/readthedocs.org/user_builds/molopt/envs/latest/bin/python -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
/home/docs/checkouts/readthedocs.org/user_builds/molopt/envs/latest/bin/python -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html
command,
WARNING: autodoc: failed to import module 'MolOpt'; the following exception was raised:
Traceback (most recent call last):
File "/home/docs/checkouts/readthedocs.org/user_builds/molopt/envs/latest/lib/python3.8/site-packages/sphinx/ext/autodoc/importer.py", line 70, in import_module
return importlib.import_module(modname)
File "/home/docs/checkouts/readthedocs.org/user_builds/molopt/envs/latest/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/docs/checkouts/readthedocs.org/user_builds/molopt/checkouts/latest/MolOpt.py", line 2, in <module>
from genetic import *
File "/home/docs/checkouts/readthedocs.org/user_builds/molopt/checkouts/latest/genetic.py", line 23, in <module>
class Chromosome:
File "/home/docs/checkouts/readthedocs.org/user_builds/molopt/checkouts/latest/genetic.py", line 29, in Chromosome
def __init__(self, genes: Any = None, fitness: Any = None, strategy: list[Callable[[Chromosome], Genes]] = [],
TypeError: 'ABCMeta' object is not subscriptable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.