Skip to content

Commit 1b872b3

Browse files
committed
Always install the package in ReadTheDocs
1 parent 402b0c7 commit 1b872b3

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

repo_helper/files/docs.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -203,23 +203,22 @@ def make_rtfd(repo_path: pathlib.Path, templates: jinja2.Environment) -> List[st
203203
]
204204

205205
python_config = {"version": 3.8, "install": [{"requirements": r} for r in install_requirements]}
206+
python_config["install"].append({"method": "pip", "path": "."})
206207

207208
# Formats: Optionally build your docs in additional formats such as PDF and ePub
208209
config = {"version": 2, "sphinx": sphinx_config, "formats": "all", "python": python_config}
209210

210-
class Dumper(yaml.RoundTripDumper):
211+
dumper = yaml.YAML()
212+
dumper.indent(mapping=2, sequence=3, offset=1)
211213

212-
@functools.wraps(yaml.RoundTripDumper.__init__)
213-
def __init__(self, *args, **kwargs):
214-
super().__init__(*args, **kwargs)
215-
self.sequence_dash_offset = 1
216-
self.best_width = 4086
214+
yaml_buf = yaml.StringIO()
215+
dumper.dump(config, yaml_buf)
217216

218217
file.write_lines([
219218
f"# {templates.globals['managed_message']}",
220219
"# Read the Docs configuration file",
221220
"---",
222-
yaml.round_trip_dump(config, default_flow_style=False, Dumper=Dumper), # type: ignore
221+
yaml_buf.getvalue()
223222
])
224223

225224
return [file.relative_to(repo_path).as_posix()]

tests/test_files/test_docs_/test_make_rtfd_case_1.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ python:
1111
install:
1212
- requirements: requirements.txt
1313
- requirements: doc-source/requirements.txt
14+
- method: pip
15+
path: .

tests/test_files/test_docs_/test_make_rtfd_case_2.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,5 @@ python:
1212
- requirements: requirements.txt
1313
- requirements: userguide/requirements.txt
1414
- requirements: hello_world/submodule/requirements.txt
15+
- method: pip
16+
path: .

0 commit comments

Comments
 (0)