diff --git a/config/config-package.py b/config/config-package.py index 5cfa33d..143c4af 100755 --- a/config/config-package.py +++ b/config/config-package.py @@ -328,6 +328,12 @@ def gitignore(self): ignore=git_ignore, ) + def readthedocs(self): + self.copy_with_meta( + 'readthedocs.yaml.j2', self.path / '.readthedocs.yaml', + self.config_type + ) + def coveragerc(self): coverage_run_additional_config = self.meta_cfg['coverage-run'].get( 'additional-config', []) @@ -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') @@ -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( @@ -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: diff --git a/config/default/readthedocs.yaml.j2 b/config/default/readthedocs.yaml.j2 new file mode 100644 index 0000000..4f66f4c --- /dev/null +++ b/config/default/readthedocs.yaml.j2 @@ -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: .