Skip to content

Commit

Permalink
Don't require sphinx/mkdocs keys when using build.commands (#11913)
Browse files Browse the repository at this point in the history
Closes #11912
  • Loading branch information
stsewd authored Jan 13, 2025
1 parent 9b99c47 commit 1788629
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions readthedocs/config/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -753,12 +753,16 @@ def validate_deprecated_implicit_keys(self):
"""
Check for deprecated usages and raise an exception if found.
- If the user is using build.commands, we don't need the sphinx or mkdocs keys.
- If the sphinx key is used, a path to the configuration file is required.
- If the mkdocs key is used, a path to the configuration file is required.
- If none of the sphinx or mkdocs keys are used,
and the user isn't overriding the new build jobs,
the sphinx key is explicitly required.
"""
if self.is_using_build_commands:
return

has_sphinx_key = "sphinx" in self.source_config
has_mkdocs_key = "mkdocs" in self.source_config
if has_sphinx_key and not self.sphinx.configuration:
Expand Down
12 changes: 12 additions & 0 deletions readthedocs/config/tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,18 @@ def test_config_without_sphinx_key(self):
data_copy["build"]["jobs"]["build"] = {"html": ["echo 'Hello World'"]}
get_build_config(data_copy, validate=True, deprecate_implicit_keys=True)

def test_sphinx_and_mkdocs_arent_required_when_using_build_commands(self):
data = {
"build": {
"os": "ubuntu-22.04",
"tools": {
"python": "3",
},
"commands": ["echo 'Hello World'"],
},
}
get_build_config(data, validate=True, deprecate_implicit_keys=True)

def test_as_dict_new_build_config(self, tmpdir):
build = get_build_config(
{
Expand Down

0 comments on commit 1788629

Please sign in to comment.