Skip to content

Commit 0ed9b37

Browse files
authored
📝 Docs: Update contributing guidelines (#37)
* 📝 Docs(CONTRIBUTING.md): Update contrib files based on the acore guide and adding extra info about code and doc strandards * 📝 Docs(.github/PULL_REQUEST_TEMPLATE/README.md): Created README to explain how to use PR templates * 🎨 Style(CONTRIBUTING.md): fix acore broken link and add style on the initial description * ✏️ Style(CONTRIBUTING.md): fix typo in PR General Guidelines * 📝 Docs(CONTRIBUTING.md): Add test guidelines section
1 parent 725453d commit 0ed9b37

File tree

2 files changed

+217
-27
lines changed

2 files changed

+217
-27
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Pull request Templates
2+
3+
These templates need to be used with a **query parameter** in the URL when creating a new pull request.
4+
For example, to use the **new plot** template, you should use the following URL:
5+
6+
```
7+
https://github.com/Multiomics-Analytics-Group/vuecore/compare/main...my-branch?quick_pull=1&template=new_plot.md
8+
````
9+
10+
See the [GitHub documentation](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository) for more information.

CONTRIBUTING.md

Lines changed: 207 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,225 @@
11
# Contributing to VueCore
22

3-
[VueCore][vuecore-repo] is an open source project, and we welcome contributions of all
4-
kinds via GitHub issues and pull requests: correct or improve our [documentation][vuecore-docs], report or fix bugs, propose changes, and implement new features. Please follow
5-
these guidelines to make sure that your contribution is easily integrated into the project.
3+
[VueCore][vuecore-repo] is an **open source project**, and we welcome contributions of all kinds via **GitHub issues** and
4+
**pull requests**: correct or improve our [documentation][vuecore-docs], report or fix bugs, propose changes, and
5+
implement new features. Please follow these guidelines to make sure that your contribution is easily integrated
6+
into the project.
67

7-
## 1. Contributor Agreement
8+
## Contributor Agreement
89

910
By contributing, you agree that we may redistribute your work under [our
1011
license](LICENSE.md). In exchange, we will address your issues and/or assess
1112
your change proposal as promptly as we can, and help you become a member of our
1213
community.
1314

14-
## 2. What to Contribute
15+
## What to Contribute?
1516

16-
The easiest way to get started is by reporting an issue that needs to be fixed,
17-
such as a bug in the code, unclear explanations, conceptual errors, or other details.
18-
You can also contribute by proposing new features or modules, improving existing
19-
functionality, or suggesting other ideas that might be useful. If you’re looking for
20-
inspiration, please check the [list of open issues][issues] in this repository.
17+
The easiest way to get started is by **reporting an issue** that needs to be fixed,
18+
such as a bug in the code, unclear explanations, conceptual errors, or other details.
19+
If you are familiar with Python, Git,, and GitHub, you can **fix the bug** yourself
20+
and submit a **pull request (PR)** with your changes, as described below.
21+
22+
You can also contribute by **fixing existing bugs** tagged with the `bug` and
23+
`help wanted` labels in the [list of open issues][issues] of the repository. There are
24+
**new features and imporvements** tagged with `enhancement` and `help wanted` as well, so
25+
feel free to start a discussion if you would like to work on one of those. If you come up with
26+
any **ideas for new features or improvements** that are not yet reported, we are also happy to hear about them.
2127

2228
Feedback from beginners is especially valuable, as experienced users may overlook how
2329
challenging certain aspects of the software can be for newcomers. Therefore, we encourage
24-
you to share any suggestions or observations you have about this project.
30+
you to share any suggestions or observations you have.
2531

26-
## 3. How to Contribute
32+
## How to Contribute?
2733

2834
Here are the ways you can submit your suggestions and contribute to the project:
2935

3036
### 1. Reporting Issues or Suggesting Improvements
3137

32-
If you have a [GitHub][github] account (or are willing to [open one][github-join]) but are unfamiliar with Git, you can report bugs or suggest improvements by [creating an issue][new-issue]. This GitHub feature allows for discussion threads on reported issues and proposed enhancements.
38+
If you have a [GitHub][github] account (or are willing to [open one][github-join]) but are unfamiliar with
39+
Git, you can report bugs or suggest improvements by [creating an issue][new-issue]. This GitHub feature allows
40+
for discussion threads on reported issues and proposed enhancements.
41+
42+
When reporting an issue, please provide as much relevant information as possible, including:
43+
44+
* A clear and descriptive title
45+
* A detailed description of the problem or suggestion
46+
* Steps to reproduce the issue (if applicable)
47+
* Any relevant screenshots or error messages
48+
* Your operating system, software version, and additonal details about your local setup that might be helpful in troubleshooting
49+
50+
> [!TIP]
51+
> This guide from the [GitHub Docs][github-docs] provides useful tips on [how to write an issue][issue-github-guide].
52+
53+
### 2. Submitting Changes via Pull Requests (PR)
54+
55+
If you are comfortable using Git/GitHub and would like to add or modify a functionality, you can submit a **PR**.
56+
You may want to look at [How to Contribute to an Open Source Project on GitHub][how-contribute].
57+
In brief, we use [GitHub flow][github-flow] to manage changes:
58+
59+
> [!TIP]
60+
> Consider using an IDE (e.g., [VSCode][vscode]) or a GUI client (e.g., [GitHub Desktop][github-desktop]) to help
61+
> you with some of the common steps described below.
62+
63+
1. Fork the [vuecore][vuecore-repo] repo on GitHub.
64+
2. Clone your fork locally. Replace `yourusername` with your GitHub username.
65+
66+
```bash
67+
git clone https://github.com/yourusername/vuecore.git
68+
```
69+
70+
3. Install your local copy into a virtual environment. Assuming you have Python available
71+
on your system, this can be done using `venv`. Alternatives are `conda`, `uv`, or `poetry`
72+
to create and manage virtual environments.
73+
74+
```bash
75+
cd vuecore/
76+
python -m venv .env
77+
source .env/bin/activate
78+
pip install -e .[dev]
79+
```
3380

34-
### 2. Submitting Changes via Pull Requests
81+
4. Create a new branch in your desktop copy of this repository for each significant change.
3582

36-
If you are comfortable using Git and would like to add or modify a functionality, you can submit a **pull request (PR)**. Instructions on how to contribute this way are provided in the next section.
83+
```bash
84+
git checkout -b name-of-your-new-branch
85+
```
3786

38-
> [!NOTE]
39-
> The documentation for [Git][git-docs] and [GitHub][github-docs] are easy to follow, and you can learn the basics using their official guides.
87+
5. When you're done making changes, check that your changes are formatted and pass `black` and
88+
`ruff` checks (some changes ruff can automatically fix for you, if you pass the `--fix` flag).
89+
Also, run the `tests` to make sure everything is working as expected:
4090

41-
## 3. Creating a Pull Request
91+
```bash
92+
black .
93+
ruff check src
94+
pytest .
95+
```
4296

43-
If you choose to contribute via GitHub, you may want to look at [How to Contribute to an Open Source Project on GitHub][how-contribute]. In brief, we use [GitHub flow][github-flow] to manage changes:
97+
6. Commit the changea in that branch.
4498

45-
1. Create a new branch in your desktop copy of this repository for each significant change.
46-
2. Commit the change in that branch.
47-
3. Push that branch to your fork of this repository on GitHub.
48-
4. Submit a pull request from that branch to the [upstream repository][vuecore-repo].
49-
5. If you receive feedback, make changes on your desktop and push to your branch on GitHub: the
99+
```bash
100+
git add .
101+
git commit -m "Your detailed description of your changes."
102+
```
103+
104+
7. Push that branch to your fork of this repository on GitHub.
105+
106+
```bash
107+
git push origin name-of-your-new-branch
108+
```
109+
110+
8. Submit a pull request from that branch to the [upstream repository][vuecore-repo] via GitHub.
111+
See the **PR General Guidelines** below for more details.
112+
9. If you receive feedback, make changes on your desktop and push to your branch on GitHub: the
50113
pull request will update automatically.
51114

52-
## 5. Credits
115+
> [!TIP]
116+
> The documentation for [Git][git-docs] and [GitHub][github-docs] are easy to follow, and you can learn the
117+
> basics using their official guides.
118+
119+
#### PR General Guidelines
120+
121+
We have a general [PR template][general-pr-template] that is loaded autmatically when you open a new PR.
122+
Also, if you are adding a new plot, we created a [new plot PR template][new-plot-pr-template]
123+
with a checklist of all the steps to follow, which you can use with a query paramter by clicking [here][new-plot-pr-query-param].
124+
125+
Before you submit a PR, check that it meets these guidelines:
126+
127+
1. The pull request should include tests.
128+
2. If the pull request adds functionality, the docs should be updated. Put
129+
your new functionality into a function with a docstring.
130+
3. The pull request should pass the workflows on GitHub.
131+
132+
## Code & Documentation Standards
133+
134+
To maintain consistency across the codebase, please adhere to the following standards when contributing:
135+
136+
* **Docstrings:** Follow the [NumPy docstring style][numpy-docstring-guide]. Include examples where relevant.
137+
* **Type Hints:** Use Python type hints for function signatures and variable annotations (**PEP 484**).
138+
* **Code Formatting:** Use `black` for code formatting and `ruff` for linting (as mentioned in the PR guidelines).
139+
* **Naming Conventions:** Follow **PEP8** for naming (e.g., snake_case for variables/functions, CamelCase for classes).
140+
141+
Here is an example of a simple function with a proper docstring and type hints:
53142

54-
This contribution guide was modified under the [Creative Commons Attribution 4.0 International License][ccby] from the [Software Carpentry guides][soft-cp-guides].
143+
```python
144+
def calculate_average(values: List[float]) -> float:
145+
"""
146+
Calculate the average of a list of numerical values.
147+
148+
Parameters
149+
----------
150+
values : List[float]
151+
List of numerical values to average.
152+
153+
Returns
154+
-------
155+
float
156+
The arithmetic mean of the input values.
157+
158+
Examples
159+
--------
160+
>>> calculate_average([1.0, 2.0, 3.0, 4.0])
161+
2.5
162+
"""
163+
return sum(values) / len(values)
164+
```
165+
166+
## Test Guidelines
167+
168+
We encourage comprehensive testing to maintain code quality, so all contributions should include
169+
appropriate tests that verify functionality. We use `pytest` as our testing framework. Here are some considerations:
170+
171+
* **Structure:** Place tests in the tests/ directory, mirroring the source structure.
172+
* **Coverage:** Aim for high test coverage, especially for new features or bug fixes. Try to cover typical use cases as well as edge cases.
173+
* **Naming:** Use descriptive test function names that indicate what is being tested.
174+
* **Docstrings:** Include docstrings in your test functions to explain their purpose, following the previous docstring guidelines.
175+
* **Isolation:** Each test should be independent and not rely on other tests.
176+
* **Local Execution:** Ensure that tests can be run locally using `pytest` before submitting a PR.
177+
178+
Here is an example of a test script for the `calculate_average` function:
179+
180+
```python
181+
import pytest
182+
from vuecore.utils import calculate_average
183+
184+
def test_calculate_average_basic():
185+
"""Test basic average calculation with positive numbers."""
186+
result = calculate_average([1.0, 2.0, 3.0, 4.0])
187+
assert result == 2.5
188+
189+
def test_calculate_average_single_value():
190+
"""Test average calculation with a single value."""
191+
result = calculate_average([5.0])
192+
assert result == 5.0
193+
194+
def test_calculate_average_empty_list():
195+
"""Test average calculation with empty list raises appropriate error."""
196+
with pytest.raises(ZeroDivisionError):
197+
calculate_average([])
198+
```
199+
200+
Run the following command in the root directory to execute the tests locally:
201+
202+
```bash
203+
pytest .
204+
```
205+
206+
It's possible to run specific test files or functions by providing their paths.
207+
See the [pytest documentation][pytest-docs] for more details.
208+
209+
## Deployment
210+
211+
We created a [CI/CD worflow][cicd-workflow] using **GitHub Actions** to automatically deploy the Python package to
212+
[PyP][vuecore-pypi] when a new release is created. To create a new release, make sure all changed are merged into the `main` branch,
213+
then go to the [Releases section][releases-vuecore] of the GitHub repository and click on **Draft a new release**. Fill in the
214+
release title and description, then click on **Publish release**. This will trigger the GitHub Actions workflow to build and deploy the package to PyPI.
215+
216+
Also, we have a GitHub Action that automatically deploys the documentation to [Read the Docs][vuecore-docs] in
217+
every push to a branch or when a PR is merged into `main`.
218+
219+
## Credits
220+
221+
This contribution guide was modified under the [Creative Commons Attribution 4.0 International License][ccby] from
222+
the [Software Carpentry guides][soft-cp-guides] and the [acore][acore-repo] project.
55223

56224
[vuecore-repo]: https://github.com/Multiomics-Analytics-Group/vuecore
57225
[vuecore-docs]: https://vuecore.readthedocs.io/
@@ -61,7 +229,19 @@ This contribution guide was modified under the [Creative Commons Attribution 4.0
61229
[github-join]: https://github.com/join
62230
[git-docs]: https://git-scm.com/doc
63231
[github-docs]: https://guides.github.com/
232+
[issue-github-guide]: https://docs.github.com/en/issues/tracking-your-work-with-issues/learning-about-issues/quickstart
64233
[how-contribute]: https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github
65234
[github-flow]: https://guides.github.com/introduction/flow/
66-
[soft-cp-guides]: https://software-carpentry.org/lessons/
235+
[vscode]: https://code.visualstudio.com/
236+
[github-desktop]: https://github.com/apps/desktop
237+
[general-pr-template]: https://github.com/Multiomics-Analytics-Group/vuecore/blob/main/.github/PULL_REQUEST_TEMPLATE.md
238+
[new-plot-pr-template]: https://github.com/Multiomics-Analytics-Group/vuecore/blob/main/.github/PULL_REQUEST_TEMPLATE/new_plot.md
239+
[new-plot-pr-query-param]: https://github.com/Multiomics-Analytics-Group/vuecore/compare/main...my-branch?quick_pull=1&template=new_plot.md
240+
[numpy-docstring-guide]: https://numpydoc.readthedocs.io/en/latest/format.html
241+
[pytest-docs]: https://docs.pytest.org/en/stable
242+
[cicd-workflow]: https://github.com/Multiomics-Analytics-Group/vuecore/blob/main/.github/workflows/cdci.yml
243+
[vuecore-pypi]: https://pypi.org/project/vuecore/
244+
[releases-vuecore]: https://github.com/Multiomics-Analytics-Group/vuecore/releases
67245
[ccby]: https://creativecommons.org/licenses/by/4.0/
246+
[soft-cp-guides]: https://software-carpentry.org/lessons/
247+
[acore-repo]: https://github.com/Multiomics-Analytics-Group/acore

0 commit comments

Comments
 (0)