Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add readthedocs support #205

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config/config-package.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,12 @@ def gitignore(self):
ignore=git_ignore,
)

def readthedocs(self):
self.copy_with_meta(
'readthedocs.yaml.j2', self.path / '.readthedocs.yaml',
dhavlik marked this conversation as resolved.
Show resolved Hide resolved
self.config_type
)

def coveragerc(self):
coverage_run_additional_config = self.meta_cfg['coverage-run'].get(
'additional-config', [])
Expand Down Expand Up @@ -494,6 +500,9 @@ def manifest_in(self):
"""Modify MANIFEST.in with meta options."""
additional_manifest_rules = self.meta_cfg['manifest'].get(
'additional-rules', [])
if (self.with_docs and 'include *.yaml'
not in additional_manifest_rules):
additional_manifest_rules.insert(0, 'include *.yaml')
if self.config_type == 'c-code' \
and 'include *.sh' not in additional_manifest_rules:
additional_manifest_rules.insert(0, 'include *.sh')
Expand Down Expand Up @@ -561,6 +570,9 @@ def configure(self):
print("The package is configured without sphinx docs, "
"but with sphinx doctests. Is this a mistake?")

if self.with_docs:
self.readthedocs()

self.setup_cfg()
self.gitignore()
self.copy_with_meta(
Expand Down Expand Up @@ -594,6 +606,8 @@ def configure(self):
call('git', 'add', '.coveragerc')
if self.with_appveyor:
call('git', 'add', 'appveyor.yml')
if self.with_docs:
call('git', 'add', '.readthedocs.yaml')
if self.add_manylinux:
call('git', 'add', '.manylinux.sh', '.manylinux-install.sh')
# Remove empty sections:
Expand Down
23 changes: 23 additions & 0 deletions config/default/readthedocs.yaml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3.11"

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

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- requirements: docs/requirements.txt
- method: pip
path: .