Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
11 changes: 11 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ docs_custom_import:
Separate multiple modules with commas.
default: ""

add_submodules:
type: bool
help: "Would you like to add submodules to this project?"
default: false

submodule_path:
when: "{{ add_submodules }}"
type: str
help: "Enter the path for the submodule."
default: ""

valid_python_versions:
when: false
type: yaml
Expand Down
23 changes: 23 additions & 0 deletions template/.circleci/config.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
- run:
name: install dependencies
command: pip install ".[tests]"
{%- if add_submodules == true %}
- run:
name: synchronize submodules
command: git submodule update --init --recursive && git submodule update --recursive --init
{%- endif %}
- run:
name: Run tests
command: pytest tests
Expand All @@ -62,6 +67,11 @@ jobs:
- run:
name: install dependencies
command: pip install ".[tests]"
{%- if add_submodules == true %}
- run:
name: synchronize submodules
command: git submodule update --init --recursive && git submodule update --recursive --init
{%- endif %}
- run:
name: Ruff
command: ruff check
Expand All @@ -85,6 +95,10 @@ jobs:
- run:
name: Sphinx
command: |
{%- if add_submodules == true %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

maybe add this as a separate block as done for the other ci jobs. Right now it is not that clean in sofar.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the review!
What exactly do you mean by a separate block? Could you please give an example?

git submodule sync --recursive
git submodule update --recursive --init
{%- endif %}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
- run:
name: Sphinx
command: |
{%- if add_submodules == true %}
git submodule sync --recursive
git submodule update --recursive --init
{%- endif %}
{%- if add_submodules == true %}
- run:
name: synchronize submodules
command: git submodule update --init --recursive && git submodule update --recursive --init
{%- endif %}
- run:
name: Sphinx
command: |

sth like this? now the Sphinx is just excecuting installing dependencies and excecute Sphinx

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh yes, you're right, that would look much better, and we have already used that block in other places in the file

pip install ".[docs]"
cd docs/
make html SPHINXOPTS="-W"
Expand All @@ -110,6 +124,11 @@ jobs:
command: pip install ".[tests]"
- run: |
python --version
{%- if add_submodules == true %}
- run:
name: synchronize submodules
command: git submodule update --init --recursive && git submodule update --recursive --init
{%- endif %}
- run:
name: Run tests
command: pytest tests -W error::DeprecationWarning
Expand Down Expand Up @@ -161,6 +180,10 @@ jobs:
- run:
name: deploy
command: | # create whl, install twine and publish to Test PyPI
{%- if add_submodules == true %}
git submodule sync --recursive
git submodule update --recursive --init
{%- endif %}
python -m build
twine check dist/*
twine upload dist/*
Expand Down
8 changes: 8 additions & 0 deletions template/.readthedocs.yml.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ build:
- libsndfile1
{%- endif %}

{%- if add_submodules == true %}

# make sure to include submodule at {{ submodule_path }}
submodules:
include:
- {{ submodule_path }}
{%- endif %}

# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/conf.py
Expand Down
21 changes: 21 additions & 0 deletions template/CONTRIBUTING.rst.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,13 @@ extensions in `Visual Studio Code <https://code.visualstudio.com/>`_ ...
$ git clone https://github.com/YOUR_USERNAME/{{ project_slug }}.git
$ cd {{ project_slug }}

{%- if add_submodules == true %}

Note that some graphical Git interfaces can not do the recursive clone. If the folder {{ submodule_path }} is empty try::

$ git submodule update --init
{%- endif %}

Comment thread
h-chmeruk marked this conversation as resolved.
3. Install your local copy into a virtualenv. Assuming you have Anaconda or Miniconda installed, this is how you set up your fork for local development::

$ conda create --name {{ project_slug }} python
Expand Down Expand Up @@ -74,5 +81,19 @@ extensions in `Visual Studio Code <https://code.visualstudio.com/>`_ ...

7. Submit a pull request on the develop branch through the GitHub website.

{%- if add_submodules == true %}

Submodules
~~~~~~~~~~

To update the submodule containing the conventions and verification rules run

.. code-block:: bash

$ git submodule update --init --recursive
$ git submodule update --recursive --remote

and then commit the changes
{%- endif %}

.. _general contributing guidelines: https://pyfar-gallery.readthedocs.io/en/latest/contribute/index.html
2 changes: 2 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def copier_project_defaults():
"manifest_custom": "recursive-include your/custom/path/,"
"recursive-exclude another/custom/path/'",
"docs_custom_import": "module, anothermodule",
"add_submodules": "true",
"submodule_path": "path/to/submodule",
}

@pytest.fixture(scope="session")
Expand Down
5 changes: 5 additions & 0 deletions tests/test_copier.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def test_license_choice_other(copie, copier_project_defaults):
@pytest.mark.parametrize("desired", [
"https://github.com/pyfar/my_project/issues",
"$ cd my_project",
"$ git submodule update --init --recursive",
])
def test_content_contributing(default_project, desired):
content = default_project.project_dir.joinpath(
Expand Down Expand Up @@ -173,6 +174,7 @@ def test_content_docs_multiple_files(default_project, file_name):
@pytest.mark.parametrize("desired", [
'- libsndfile1',
"python: 3.14",
" include:\n - path/to/submodule",
])
def test_content_readthedocs(default_project, desired):
content = default_project.project_dir.joinpath(
Expand All @@ -196,6 +198,9 @@ def test_content_gitignore(default_project, desired):
' - "3.13"\n - "3.14"',
'command: sudo apt-get update && sudo apt-get install -y libsndfile1',
'# Test and publish on new git version tags',
'git submodule sync --recursive\n '
'git submodule update --recursive --init',
'name: synchronize submodules',
])
def test_content_circleci(default_project, desired):
content = default_project.project_dir.joinpath(
Expand Down