Skip to content

Commit c2ea93e

Browse files
committed
Added the .readthedocs.yml file, added tests and adjusted copier.yml and conftest.py
1 parent 0f2308d commit c2ea93e

File tree

4 files changed

+53
-2
lines changed

4 files changed

+53
-2
lines changed

copier.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ dependencies:
9090
type: str
9191
help: |
9292
Enter the dependencies of this project, separate them with commas and do not leave any
93-
spaces between them. These dependencies will be included in the pyproject.toml file.
94-
default: "numpy,scipy"
93+
spaces between them. These dependencies will be included in the pyproject.toml
94+
and in the .readthedocs.yml files.
95+
default: "numpy,scipy,libsndfile1"
9596

9697
valid_python_versions:
9798
when: false
@@ -100,6 +101,12 @@ valid_python_versions:
100101
{% set min_index = python_versions.index(minimum_python_version) %}
101102
{{ python_versions[min_index:] }}
102103
104+
default_python_version:
105+
when: false
106+
type: yaml
107+
default: >
108+
{{ python_versions[-1] }}
109+
103110
pypi_license_classifiers_list:
104111
when: false
105112
type: yaml

template/.readthedocs.yml.jinja

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# .readthedocs.yml
2+
# Read the Docs configuration file for Sphinx projects
3+
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
4+
5+
# Required
6+
version: 2
7+
8+
# Set the OS, Python version and other tools you might need
9+
build:
10+
os: ubuntu-24.04
11+
tools:
12+
python: {{ default_python_version }}
13+
{% if 'libsndfile1' in dependencies -%}
14+
apt_packages:
15+
- libsndfile1
16+
{%- endif %}
17+
18+
# Build documentation in the "docs/" directory with Sphinx
19+
sphinx:
20+
configuration: docs/conf.py
21+
22+
# Optionally build your docs in additional formats such as PDF and ePub
23+
formats:
24+
- pdf
25+
26+
# Optional but recommended, declare the Python requirements required
27+
# to build your documentation
28+
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
29+
python:
30+
install:
31+
- method: pip
32+
path: ".[docs]"

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def copier_project_defaults():
1111
"license": "MIT",
1212
"copyright_statement": "2025, The pyfar developers",
1313
"project_short_description": "my_project_short_description",
14+
"python_versions": "['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']",
1415
}
1516

1617
@pytest.fixture(scope="session")

tests/test_copier.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def test_project_folder(default_project):
1616
"my_project/my_project.py",
1717
"HISTORY.rst",
1818
".github/workflows/check_modified_history.yml",
19+
".readthedocs.yml",
1920
])
2021
def test_generated_file_exists(default_project, file_name):
2122
assert default_project.project_dir.joinpath(file_name).exists()
@@ -120,3 +121,13 @@ def test_content_history(default_project):
120121
"HISTORY.rst").read_text()
121122
desired = f"0.1.0 ({date.today().strftime('%Y-%m-%d')})"
122123
assert desired in content
124+
125+
126+
@pytest.mark.parametrize("desired", [
127+
'- libsndfile1',
128+
"python: 3.14",
129+
])
130+
def test_content_readthedocs(default_project, desired):
131+
content = default_project.project_dir.joinpath(
132+
".readthedocs.yml").read_text()
133+
assert desired in content

0 commit comments

Comments
 (0)