6

I'm trying to automatically import a project from Github into ReadtheDocs. When creating the documentation it is failing due to a missing dependency. I've tried adding the setup.py installation in the config, but am running into the following:

  • Problem in your project's configuration. Invalid "python.install.0": .readthedocs.yml: "path" or "requirements" key is required

Current Configuration yaml:

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
  configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
  version: 3.6
  install:
    - method: setuptools
    - path: .
jdk514
  • 106
  • 5

2 Answers2

0

I wasn't able to find an answer that leverage the pre-existing setup.py file, but was able to get it working with a requirements.txt file. The relevant portion is the install portion of the python section in the readthedocs.yml file (seen below).

Inside the requirements.txt file I simply copied the install requirements section from the setup.py.

# Required
version: 2

# Build documentation in the docs/ directory with Sphinx
sphinx:
  configuration: docs/conf.py

# Optionally build your docs in additional formats such as PDF and ePub
formats: all

# Optionally set the version of Python and requirements required to build your docs
python:
  version: 3.6
  install:
    - requirements: docs/requirements.txt
jdk514
  • 106
  • 5
0

I also had this issue just now, and eventually figured out that the YAML declaration is wrong. It should not be:

python:
  version: 3.6
  install:
    - method: setuptools
    - path: .

This defines two entries in python.install, the first one containing only the method key set to setuptools, and the second one containing only the path key set to .. They have nothing to do with each other semantically, and so readthedocs complains about the first entry missing that path key. Instead, use:

python:
  version: 3.6
  install:
    - method: setuptools
      path: .

This now defines python.install to be a list with exactly one entry, python.install.0, that has both required keys. And so readthedocs started accepting my config after I did this one-character deletion.

Yet another example of YAML being less intuitive than one would like.

yerforkferchips
  • 1,965
  • 1
  • 19
  • 27