Skip to content
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 copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,27 @@ dependencies:
spaces between them. These dependencies will be included in the pyproject.toml file.
default: "numpy,scipy"

apt_packages:
type: str
help: |
Enter the required apt packages for this project, separate them with commas and do not leave any
spaces between them. The dependencies are installed before each CI/CD workflow and readthedocs
build via apt-get on a Linux system.
default: "libsndfile1,"

valid_python_versions:
when: false
type: yaml
default: >
{% set min_index = python_versions.index(minimum_python_version) %}
{{ python_versions[min_index:] }}

latest_python_version:
when: false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, because of the when: False attribute, this parameter is not included in the questionnaires and always takes the default value. Please let me know if you think this parameter should be displayed to the user when creating/updating a project.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe you can discuss this point in the weekly, both options would work for me.
advatange of always using the latest version is that we dont need to worry about it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, thank you, I could bring it up in the meeting today :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have decided to leave the parameter unchanged so that the latest python version is always used as the parameter value

type: yaml
default: >
{{ python_versions[-1] }}

pypi_license_classifiers_list:
when: false
type: yaml
Expand Down
32 changes: 32 additions & 0 deletions template/.readthedocs.yml.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# .readthedocs.yml
# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the OS, Python version and other tools you might need
build:
os: ubuntu-24.04
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure which version we want to use as the default. The old cookiecutter template had ubuntu-22.04, but maybe it's time to update the version.

tools:
python: {{ latest_python_version }}
{% if 'libsndfile1' in apt_packages -%}
apt_packages:
- libsndfile1
{%- endif %}

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

# Optionally build your docs in additional formats such as PDF and ePub
formats:
- pdf

# Optional but recommended, declare the Python requirements required
# to build your documentation
# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- method: pip
path: ".[docs]"
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ def copier_project_defaults():
"license": "MIT",
"copyright_statement": "2025, The pyfar developers",
"project_short_description": "my_project_short_description",
"python_versions": "['3.9', '3.10', '3.11', '3.12', '3.13', '3.14']",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also added this line to the standard test configuration, since we will be updating the python_versions parameter in the copier.yml in the future. So that the tests do not fail and we do not have to adjust them, I added a default value for the python_versions parameter.

}

@pytest.fixture(scope="session")
Expand Down
11 changes: 11 additions & 0 deletions tests/test_copier.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def test_project_folder(default_project):
"docs/Makefile",
"docs/readme.rst",
"MANIFEST.in",
".readthedocs.yml",
])
def test_generated_file_exists(default_project, file_name):
assert default_project.project_dir.joinpath(file_name).exists()
Expand Down Expand Up @@ -158,3 +159,13 @@ def test_content_docs_multiple_files(default_project, file_name):
content = default_project.project_dir.joinpath(file_name).read_text()
desired = "my_project"
assert desired in content, f"{desired!r} is not in content"


@pytest.mark.parametrize("desired", [
'- libsndfile1',
"python: 3.14",
])
def test_content_readthedocs(default_project, desired):
content = default_project.project_dir.joinpath(
".readthedocs.yml").read_text()
assert desired in content