Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Commit 0bf7aa6

Browse files
committed
Support .readthedocs.yml as an optional configuration file
Address support request readthedocs/readthedocs.org#2211.
1 parent 5e0016d commit 0bf7aa6

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

README.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ Running a build is simple::
2424

2525
rtd-build
2626

27-
This will search for all ``readthedocs.yml`` files below your current directory
28-
and will build your documentation.
27+
This will search for all ``readthedocs.yml`` (or ``.readthedocs.yml``) files
28+
below your current directory and will build your documentation.
2929

3030
You can set a specific a directory where the built documentation should be
3131
stored::

readthedocs_build/config/config.py

+8-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'load', 'BuildConfig', 'ConfigError', 'InvalidConfig', 'ProjectConfig')
1818

1919

20-
CONFIG_FILENAME = 'readthedocs.yml'
20+
CONFIG_FILENAMES = ('readthedocs.yml', '.readthedocs.yml')
2121

2222

2323
BASE_INVALID = 'base-invalid'
@@ -346,11 +346,14 @@ def load(path, env_config):
346346
The config will be validated.
347347
"""
348348

349-
config_files = list(find_all(path, (CONFIG_FILENAME,)))
349+
config_files = list(find_all(path, CONFIG_FILENAMES))
350350
if not config_files:
351-
raise ConfigError(
352-
'No {filename} found'.format(filename=CONFIG_FILENAME),
353-
code=CONFIG_REQUIRED)
351+
files = '{}'.format(', '.join(map(repr, CONFIG_FILENAMES[:-1])))
352+
if files:
353+
files += ' or '
354+
files += '{!r}'.format(CONFIG_FILENAMES[-1])
355+
raise ConfigError('No files {} found'.format(files),
356+
code=CONFIG_REQUIRED)
354357
build_configs = []
355358
for filename in config_files:
356359
with open(filename, 'r') as file:

0 commit comments

Comments
 (0)