From 5b6358f56ae21137c9c08efa07f82011fbf78f6d Mon Sep 17 00:00:00 2001 From: Hanna Date: Wed, 10 Dec 2025 17:18:53 +0100 Subject: [PATCH 1/2] Added CONTRIBUTING.rst file and tests for it --- template/CONTRIBUTING.rst.jinja | 78 +++++++++++++++++++++++++++++++++ tests/test_copier.py | 11 +++++ 2 files changed, 89 insertions(+) create mode 100644 template/CONTRIBUTING.rst.jinja diff --git a/template/CONTRIBUTING.rst.jinja b/template/CONTRIBUTING.rst.jinja new file mode 100644 index 0000000..f96bcbb --- /dev/null +++ b/template/CONTRIBUTING.rst.jinja @@ -0,0 +1,78 @@ + +.. highlight:: shell + +============ +Contributing +============ + +Contributions are welcome, and they are greatly appreciated! Every little bit +helps, and credit will always be given. The following helps you to start +contributing specifically to {{ project_slug }}. Please also consider the +`general contributing guidelines`_ for example regarding the style +of code and documentation and some helpful hints. + +Types of Contributions +---------------------- + +Report Bugs or Suggest Features +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The best place for this is https://github.com/{{ git_username }}/{{ project_slug }}/issues. + +Fix Bugs or Implement Features +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Look through https://github.com/{{ git_username }}/{{ project_slug }}/issues for bugs or feature request +and contact us or comment if you are interested in implementing. + +Write Documentation +~~~~~~~~~~~~~~~~~~~ + +{{ project_slug }} could always use more documentation, whether as part of the +official {{ project_slug }} docs, in docstrings, or even on the web in blog posts, +articles, and such. + +Get Started! +------------ + +Ready to contribute? Here's how to set up `{{ project_slug }}` for local development using the command-line interface. +Note that several alternative user interfaces exist, e.g., the Git GUI, `GitHub Desktop `_, +extensions in `Visual Studio Code `_ ... + +1. `Fork `_ the `{{ project_slug }}` repo on GitHub. +2. Clone your fork locally and cd into the {{ project_slug }} directory:: + + $ git clone https://github.com/YOUR_USERNAME/{{ project_slug }}.git + $ cd {{ project_slug }} + +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 + $ conda activate {{ project_slug }} + $ pip install -e ".[dev]" + +4. Create a branch for local development. Indicate the intention of your branch in its respective name (i.e. `feature/branch-name` or `bugfix/branch-name`):: + + $ git checkout -b name-of-your-bugfix-or-feature + + Now you can make your changes locally. + +5. When you're done making changes, check that your changes pass ruff and the + tests:: + + $ ruff check + $ pytest + + ruff must pass without any warnings for `./{{ project_slug }}` and `./tests` using the default or a stricter + configuration. Ruff ignores a couple of PEP Errors (see `./pyproject.toml`). If necessary, adjust your linting configuration in your IDE accordingly. + +6. Commit your changes and push your branch to GitHub:: + + $ git add . + $ git commit -m "Your detailed description of your changes." + $ git push origin name-of-your-bugfix-or-feature + +7. Submit a pull request on the develop branch through the GitHub website. + + +.. _general contributing guidelines: https://pyfar-gallery.readthedocs.io/en/latest/contribute/index.html \ No newline at end of file diff --git a/tests/test_copier.py b/tests/test_copier.py index 2b3fad5..7ca449f 100644 --- a/tests/test_copier.py +++ b/tests/test_copier.py @@ -12,6 +12,7 @@ def test_project_folder(copie, copier_project_defaults): @pytest.mark.parametrize("file_name", [ "README.md", + "CONTRIBUTING.rst", ]) def test_generated_file_exists(copie, copier_project_defaults, file_name): project = copie.copy(extra_answers=copier_project_defaults) @@ -35,3 +36,13 @@ def test_content_readme(copie, copier_project_defaults, desired): content = project.project_dir.joinpath("README.md").read_text() assert desired in content + +@pytest.mark.parametrize("desired", [ + "https://github.com/pyfar/my_project/issues", + "$ cd my_project", +]) +def test_content_contributing(copie, copier_project_defaults, desired): + project = copie.copy(extra_answers=copier_project_defaults) + + content = project.project_dir.joinpath("CONTRIBUTING.rst").read_text() + assert desired in content From 75ed01c70abaf1bbbfc87f614c5c428ddc990e28 Mon Sep 17 00:00:00 2001 From: Hanna Chmeruk <119290248+h-chmeruk@users.noreply.github.com> Date: Wed, 10 Dec 2025 17:33:55 +0100 Subject: [PATCH 2/2] Fixed grammatical error in CONTRIBUTING.rst Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- template/CONTRIBUTING.rst.jinja | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/template/CONTRIBUTING.rst.jinja b/template/CONTRIBUTING.rst.jinja index f96bcbb..11e5ea7 100644 --- a/template/CONTRIBUTING.rst.jinja +++ b/template/CONTRIBUTING.rst.jinja @@ -22,7 +22,7 @@ The best place for this is https://github.com/{{ git_username }}/{{ project_slug Fix Bugs or Implement Features ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Look through https://github.com/{{ git_username }}/{{ project_slug }}/issues for bugs or feature request +Look through https://github.com/{{ git_username }}/{{ project_slug }}/issues for bugs or feature requests and contact us or comment if you are interested in implementing. Write Documentation