Skip to content

Commit c57452f

Browse files
authored
Add contributing template and other minor adjustments (#6)
* add contributing doc template * remove jinja from template copy pre-commit * remove headless display from gh actions
1 parent 8faccb2 commit c57452f

File tree

7 files changed

+195
-13
lines changed

7 files changed

+195
-13
lines changed

.github/workflows/run-tests.yml.jinja

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ jobs:
2121
python-version: "3.11"
2222
- name: Install the latest version of uv
2323
uses: astral-sh/setup-uv@v6
24-
- name: Display configuration for Ubuntu
25-
uses: pyvista/setup-headless-display-action@v4
26-
with:
27-
qt: true
2824
- uses: pre-commit/[email protected]
2925
# run pre-commit ci lite for automated fixes
3026
- uses: pre-commit-ci/[email protected]

.github/workflows/test-template.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@ jobs:
2121
python-version: "3.11"
2222
- name: Install the latest version of uv
2323
uses: astral-sh/setup-uv@v6
24-
- name: Display configuration for Ubuntu
25-
uses: pyvista/setup-headless-display-action@v4
26-
with:
27-
qt: true
2824
- uses: pre-commit/[email protected]
2925
# run pre-commit ci lite for automated fixes
3026
- uses: pre-commit-ci/[email protected]

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ repos:
4242
rev: "v0.11.11"
4343
hooks:
4444
- id: ruff-format
45-
- id: ruff
45+
- id: ruff-check
4646
- repo: https://github.com/rhysd/actionlint
4747
rev: v1.7.7
4848
hooks:

.pre-commit-config.yaml.jinja

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v5.0.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- id: detect-private-key
11+
- repo: https://github.com/tox-dev/pyproject-fmt
12+
rev: "v2.6.0"
13+
hooks:
14+
- id: pyproject-fmt
15+
- repo: https://github.com/citation-file-format/cffconvert
16+
rev: 5295f87c0e261da61a7b919fc754e3a77edd98a7
17+
hooks:
18+
- id: validate-cff
19+
- repo: https://github.com/codespell-project/codespell
20+
rev: v2.4.1
21+
hooks:
22+
- id: codespell
23+
exclude: |
24+
(?x)^(
25+
.*\.lock |
26+
.*\.csv |
27+
.*\.cff |
28+
.*\.ipynb
29+
)$
30+
- repo: https://github.com/executablebooks/mdformat
31+
rev: 0.7.21
32+
hooks:
33+
- id: mdformat
34+
additional_dependencies:
35+
- mdformat-gfm
36+
- repo: https://github.com/adrienverge/yamllint
37+
rev: v1.37.1
38+
hooks:
39+
- id: yamllint
40+
exclude: pre-commit-config.yaml
41+
- repo: https://github.com/astral-sh/ruff-pre-commit
42+
rev: "v0.11.11"
43+
hooks:
44+
- id: ruff-format
45+
- id: ruff-check
46+
- repo: https://github.com/rhysd/actionlint
47+
rev: v1.7.7
48+
hooks:
49+
- id: actionlint
50+
- repo: https://gitlab.com/vojko.pribudic.foss/pre-commit-update
51+
rev: v0.6.0
52+
hooks:
53+
- id: pre-commit-update
54+
args: ["--keep", "mdformat", "--keep", "pre-commit-update", "--keep", "cffconvert"]
55+
- repo: https://github.com/jendrikseipp/vulture
56+
rev: 'v2.14'
57+
hooks:
58+
- id: vulture

CITATION.cff

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ keywords:
2020
- research-software
2121
- template
2222
license: BSD-3-Clause
23+
identifiers:
24+
- type: doi
25+
value: "10.5281/zenodo.15518401"

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ If you are stuck, please feel free to ask any questions or ask for help.
1111
This project is governed by our [code of conduct](code_of_conduct.md). By participating, you are expected to uphold this code.
1212
Instances of abusive, harassing, or otherwise unacceptable behavior may be
1313
reported to community leaders responsible for enforcement.
14-
Please open a \[new security advisory notice\](<repo host address>/security/advisories/new) (using defaults or "n/a" where unable to fill in the form) to privately notify us of any incidents of this nature.
14+
Please open a [new security advisory notice](https://github.com/CU-DBMI/template-uv-python-research-software/security/advisories/new) (using defaults or "n/a" where unable to fill in the form) to privately notify us of any incidents of this nature.
1515

1616
## Development
1717

@@ -57,7 +57,7 @@ We welcome anyone to use [GitHub issues](https://docs.github.com/en/issues/track
5757

5858
Specifically, there are several ways to suggest or make changes to this repository:
5959

60-
1. Open a GitHub issue: <git host repo http>/issues
60+
1. Open a GitHub issue: https://github.com/CU-DBMI/template-uv-python-research-software/issues
6161
1. Create a pull request from a forked branch of the repository
6262

6363
### Creating a pull request
@@ -72,7 +72,7 @@ Once you make the necessary changes on this branch, you should file a pull reque
7272
The content and description of your pull request are directly related to the speed at which we are able to review, approve, and merge your contribution.
7373
To ensure an efficient review process please perform the following steps:
7474

75-
1. Follow all instructions in the \[pull request template\](<git host repo http>/blob/main/.github/PULL_REQUEST_TEMPLATE.md)
75+
1. Follow all instructions in the [pull request template](https://github.com/CU-DBMI/template-uv-python-research-software/blob/main/.github/PULL_REQUEST_TEMPLATE.md)
7676
1. Triple check that your pull request is adding _one_ specific feature or additional group of content.
7777
Small, bite-sized pull requests move so much faster than large pull requests.
7878
1. After submitting your pull request, ensure that your contribution passes all status checks (e.g. passes all tests)
@@ -93,7 +93,7 @@ Versioning for the project is intended to align with GitHub Releases which provi
9393

9494
### Releases
9595

96-
We publish source code by using [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) available \[here\](<git repo reference>/releases).
96+
We publish source code by using [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) available [here](https://github.com/CU-DBMI/template-uv-python-research-software/releases).
9797

9898
#### Release Publishing Process
9999

CONTRIBUTING.md.jinja

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# Contributing
2+
3+
First of all, thank you so much for contributing! 🎉 💯
4+
5+
This document contains guidelines on how to most effectively contribute within this repository.
6+
7+
If you are stuck, please feel free to ask any questions or ask for help.
8+
9+
## Code of conduct
10+
11+
This project is governed by our [code of conduct](code_of_conduct.md). By participating, you are expected to uphold this code.
12+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
13+
reported to community leaders responsible for enforcement.
14+
Please open a [new security advisory notice]({{ github_url }}/security/advisories/new) (using defaults or "n/a" where unable to fill in the form) to privately notify us of any incidents of this nature.
15+
16+
## Development
17+
18+
This project leverages development environments managed by [uv](https://docs.astral.sh/uv/).
19+
We use [pytest](https://docs.pytest.org/) for testing and [GitHub actions](https://docs.github.com/en/actions) for automated tests.
20+
21+
### Development setup
22+
23+
Perform the following steps to setup a Python development environment.
24+
25+
1. [Install Python](https://www.python.org/downloads/) (we recommend using [`pyenv`](https://github.com/pyenv/pyenv) or similar)
26+
1. [Install uv](https://docs.astral.sh/uv/getting-started/installation/)
27+
28+
### Linting
29+
30+
Work added to this project is automatically checked using [pre-commit](https://pre-commit.com/) via [GitHub Actions](https://docs.github.com/en/actions).
31+
Pre-commit can work alongside your local [git with git-hooks](https://pre-commit.com/index.html#3-install-the-git-hook-scripts)
32+
33+
After [installing pre-commit](https://pre-commit.com/#installation) within your development environment, the following command also can perform the same checks within your local development environment:
34+
35+
```sh
36+
% pre-commit run --all-files
37+
```
38+
39+
We use these same checks within our automated tests which are managed by [GitHub Actions workflows](https://docs.github.com/en/actions/using-workflows).
40+
These automated tests generally must pass in order to merge work into this repository.
41+
42+
### Testing
43+
44+
Work added to this project is automatically tested using [pytest](https://docs.pytest.org/) via [GitHub Actions](https://docs.github.com/en/actions).
45+
Pytest is installed through the uv environment for this project.
46+
We recommend testing your work before opening pull requests with proposed changes.
47+
48+
You can run pytest on your work using the following example:
49+
50+
```sh
51+
% uv run pytest
52+
```
53+
54+
## Making changes to this repository
55+
56+
We welcome anyone to use [GitHub issues](https://docs.github.com/en/issues/tracking-your-work-with-issues/about-issues) (requires a GitHub login) or create [pull requests](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests) (to directly make changes within this repository) to modify content found within this repository.
57+
58+
Specifically, there are several ways to suggest or make changes to this repository:
59+
60+
1. Open a GitHub issue: {{ github_url }}/issues
61+
1. Create a pull request from a forked branch of the repository
62+
63+
### Creating a pull request
64+
65+
### Pull requests
66+
67+
After you’ve decided to contribute code and have written it up, please file a pull request.
68+
We specifically follow a [forked pull request model](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request-from-a-fork).
69+
Please create a fork of this repository, clone the fork, and then create a new, feature-specific branch.
70+
Once you make the necessary changes on this branch, you should file a pull request to incorporate your changes into this (fork upstream) repository.
71+
72+
The content and description of your pull request are directly related to the speed at which we are able to review, approve, and merge your contribution.
73+
To ensure an efficient review process please perform the following steps:
74+
75+
1. Follow all instructions in the [pull request template]({{ github_url }}/blob/main/.github/PULL_REQUEST_TEMPLATE.md)
76+
1. Triple check that your pull request is adding _one_ specific feature or additional group of content.
77+
Small, bite-sized pull requests move so much faster than large pull requests.
78+
1. After submitting your pull request, ensure that your contribution passes all status checks (e.g. passes all tests)
79+
80+
Pull request review and approval is required by at least one project maintainer to merge.
81+
We will do our best to review the code addition in a timely fashion.
82+
Ensuring that you follow all steps above will increase our speed and ability to review.
83+
We will check for accuracy, style, code coverage, and scope.
84+
85+
## Versioning
86+
87+
We use [`setuptools-scm`](https://github.com/pypa/setuptools-scm) to help version this software through [`PEP 440`](https://peps.python.org/pep-0440/) standards and [semver.org](https://semver.org/) standards.
88+
Configuration for versioning is found within the `pyproject.toml` file.
89+
All builds for packages include dynamic version data to help label distinct versions of the software.
90+
`setuptools-scm` uses `git` tags to help distinguish version data.
91+
We also use the `_version.py` file as a place to persist the version data for occaissions where the `git` history is unavailable or unwanted (this file is only present in package builds).
92+
Versioning for the project is intended to align with GitHub Releases which provide `git` tag capabilities.
93+
94+
### Releases
95+
96+
We publish source code by using [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) available [here]({{ github_url }}/releases).
97+
98+
#### Release Publishing Process
99+
100+
Several manual and automated steps are involved with publishing releases.
101+
See below for an overview of how this works.
102+
103+
Notes about [semantic version](https://en.wikipedia.org/wiki/Software_versioning#Semantic_versioning) (semver) specifications: version specifications are controlled through [`setuptools-scm`](https://github.com/pypa/setuptools-scm) to create version data based on [git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) and commits.
104+
Release git tags are automatically applied through [GitHub Releases](https://docs.github.com/en/repositories/releasing-projects-on-github/about-releases) and related inferred changes from [`release-drafter`](https://github.com/release-drafter/release-drafter).
105+
106+
1. Open a pull request and use a repository label for `release-<semver release type>` to label the pull request for visibility with [`release-drafter`](https://github.com/release-drafter/release-drafter).
107+
1. On merging the pull request for the release, a [GitHub Actions workflow](https://docs.github.com/en/actions/using-workflows) defined in `draft-release.yml` leveraging [`release-drafter`](https://github.com/release-drafter/release-drafter) will draft a release for maintainers.
108+
1. The draft GitHub release will include a version tag based on the GitHub PR label applied and `release-drafter`.
109+
1. Make modifications as necessary to the draft GitHub release, then publish the release (the draft release does not normally need additional modifications).
110+
1. On publishing the release, another GitHub Actions workflow defined in `publish-pypi.yml` will run to build and deploy the Python package to PyPI (utilizing the earlier modified `pyproject.toml` semantic version reference for labeling the release).
111+
112+
## Documentation
113+
114+
Documentation for this project is published using [Sphinx](https://www.sphinx-doc.org) with markdown and Jupyter notebook file compatibility provided by [myst-parser](https://myst-parser.readthedocs.io/en/latest/) and [myst-nb](https://myst-nb.readthedocs.io/en/latest/) to create a "documentation website" (also known as "docsite").
115+
The docsite is hosted through [GitHub Pages](https://pages.github.com/) and deployed through automated [GitHub Actions](https://docs.github.com/en/actions) jobs which trigger on pushes to the main branch or the publishing of a new release on GitHub.
116+
Documentation is versioned as outlined earlier sections covering versioning details to help ensure users are able to understand each release independently of one another.
117+
118+
It can sometimes be useful to test documentation builds locally before proposing changes within a pull request.
119+
See below for some examples of how to build documentation locally.
120+
121+
```shell
122+
# build single-version sphinx documentation
123+
# (useful for troubleshooting potential issues)
124+
uv run sphinx-build docs/src docs/build
125+
126+
# build multi-version sphinx documentation
127+
# (used in production)
128+
uv run sphinx-multiversion docs/src docs/build
129+
```

0 commit comments

Comments
 (0)