Skip to content

Commit bee07b0

Browse files
authored
Update contributing guide and CI workflows (#162)
* update rtd to ubuntu latest * misc maintenance * fix paths
1 parent 9d3f984 commit bee07b0

File tree

9 files changed

+86
-174
lines changed

9 files changed

+86
-174
lines changed

.github/CONTRIBUTING.md

Lines changed: 35 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,135 +1,58 @@
1-
# Table of Contents
2-
3-
- [Pull request workflow](#pull-request-workflow)
4-
* [Syncing your fork's `main` with `upstream main`](#syncing-your-fork-s--main--with--upstream-main-)
5-
* [Working on a feature (and rebasing)](#working-on-a-feature--and-rebasing-)
6-
+ [Working on a feature](#working-on-a-feature)
7-
+ [Rebasing without conflicts](#rebasing-without-conflicts)
8-
+ [Rebasing WITH conflicts](#rebasing-with-conflicts)
9-
+ [Rebasing ... panic mode (or "the easy way")](#rebasing--panic-mode--or--the-easy-way--)
10-
- [Info about docs](#info-about-docs)
11-
- [Info about versioning](#info-about-versioning)
12-
- [How to make a release](#how-to-make-a-release)
13-
14-
# Pull request workflow
15-
16-
- assuming you are working with `git` from a command line
17-
- assuming your GitHub username is `username`
18-
- `github.com/sappelhoff/pyprep` is `upstream`
19-
- `github.com/username/pyprep` is `origin` (your *fork*)
20-
21-
## Syncing your fork's `main` with `upstream main`
22-
23-
- first, you start with *forking* `upstream`
24-
- then, you continue by *cloning* your fork: `git clone https://github.com/username/pyprep`
25-
- you'll have your own `main` branch there
26-
- **you always want to make sure that your fork's `main` and `upstream main` are aligned**
27-
- to do this, you work with *git remotes*
28-
- Note: this also means that you NEVER work on `main` (unless you know
29-
what you are doing) ... because you want to always be able to SYNC your
30-
fork with `upstream`, which would mean losing your own work on `main`
31-
- use `git remote -v` to list your configured remotes
32-
- initially this will only list `origin` ... a bit like this maybe:
33-
34-
```Text
35-
origin https://github.com/username/pyprep (fetch)
36-
origin https://github.com/username/pyprep (push)
37-
```
38-
39-
- Now you want to add `upstream` as a remote. Use
40-
`git remote add upstream https://github.com/sappelhoff/pyprep`
41-
- again, do `git remote -v`, it should look like this:
42-
43-
```Text
44-
origin https://github.com/username/pyprep (fetch)
45-
origin https://github.com/username/pyprep (push)
46-
upstream https://github.com/sappelhoff/pyprep (fetch)
47-
upstream https://github.com/sappelhoff/pyprep (push)
48-
49-
```
50-
51-
- Now you can use your `upstream` *remote* to make sure your fork's `main` is
52-
up to date.
53-
1. `git checkout main` to make sure you are on your `main` branch
54-
1. Make sure you do not have any changes on your `main`, because we will
55-
discard them!
56-
1. `git pull upstream main` SYNC your fork and `upstream`
57-
1. sometimes there are issues, so to be safe, do:
58-
`git reset --hard upstream/main` ... this makes sure that both
59-
branches are really synced.
60-
1. ensure with another `git pull upstream main` ... this should say
61-
"already up to date"
1+
# Contributions
622

63-
## Working on a feature (and rebasing)
3+
Contributions are welcome in the form of feedback and discussion in issues,
4+
or pull requests for changes to the code.
645

65-
### Working on a feature
6+
Once the implementation of a piece of functionality is considered to be free of
7+
bugs and properly documented, it can be incorporated into the `main` branch.
668

67-
- before working on any feature: always do `git checkout main` and
68-
`git pull upstream main`
69-
- then make your new branch to work on and check it out, for example
70-
`git checkout -b my_feature`
71-
- do your work
72-
- submit a pull request
73-
- hope you are lucky and nobody did work in between
74-
- however IF somebody did work in between, we need to *rebase*. Just follow the
75-
steps below
9+
To help developing `pyprep`,
10+
you will need a few adjustments to your installation as shown below.
7611

77-
### Rebasing without conflicts
12+
## Install the development version
7813

79-
1. sync `main` through: `git checkout main` and `git pull upstream main`
80-
1. go back to your branch and rebase it: `git checkout my_feature` and then
81-
`git rebase main`
14+
First make a fork of the repository under your `USERNAME` GitHub account.
15+
Then, in your Python environment follow these steps:
8216

83-
Now it could be that you are lucky and there no conflicts ... in that case, the
84-
rebase just works and you can then finish up by *force pushing* your rebased
85-
branch: `git push -f my_feature` ... you need to force it, because rebasing
86-
changed the history of your branch. But don't worry, if rebasing "just worked"
87-
without any conflicts, this should be very safe.
88-
89-
### Rebasing WITH conflicts
17+
```Shell
18+
git clone https://github.com/USERNAME/pyprep
19+
cd pyprep
20+
git fetch --tags --prune --prune-tags
21+
python -m pip install -e ".[dev]"
22+
pre-commit install
23+
```
9024

91-
In case you are unlucky, there are conflicts and you'll have to resolve them
92-
step by step ... `git` will be in *rebase* mode and try to rebase one commit
93-
after another ... for each commit where conflicts are detected, it'll stop.
25+
You may also clone the repository via ssh, depending on your preferred workflow
26+
(`git clone [email protected]:USERNAME/pyprep.git`).
9427

95-
Then you have to do: `git status` to see conflicting files ... then edit these
96-
files to resolve conflicts ... then `git add <filename>` ... and then
97-
`git rebase --continue` to go on to the next commit, rinse and repeat.
28+
Note that we are working with "pre-commit hooks".
29+
See https://pre-commit.com/ for more information.
9830

99-
**NOTE: the conflict resolution part is the dangerous part that can get very
100-
messy and where you can actually lose stuff ... so make backups of your branch
101-
before.**
31+
## Running tests and coverage
10232

103-
After everything is resolved, you can again do `git push -f my_feature`.
33+
If you have followed the steps to get the development version,
34+
you can run tests as follows.
35+
From the project root, call:
10436

105-
If you screw up **during** rebasing and you panic, you can do
106-
`git rebase --abort` and start again.
37+
- `pytest` to run tests and coverage
38+
- `pre-commit run -a` to run style checks (Ruff and some additional hooks)
10739

108-
### Rebasing ... panic mode
40+
## Building the documentation
10941

110-
If nothing helps and you just don't know how to resolve the issues and
111-
conflicts that arise during rebasing, just make a new branch:
112-
1. `git checkout main`
113-
1. `git pull upstream main`
114-
1. `git checkout -b my_feature_2nd_attempt`
42+
The documentation can be built using [Sphinx](https://www.sphinx-doc.org).
11543

116-
... and apply your changes manually.
44+
The publicly accessible documentation is built and hosted by
45+
[Read the Docs](https://readthedocs.org/).
46+
Credentials for Read the Docs are currently held by:
11747

118-
This method is not really a `git` workflow, ... but in cases where there are
119-
only few changes, this is often a practical solution.
48+
- [@sappelhoff](https://github.com/sappelhoff/)
12049

121-
# Info about versioning
50+
## Info about versioning
12251

12352
We follow a [semantic versioning scheme](https://semver.org/).
12453
This is implemented via [hatch-vcs](https://github.com/ofek/hatch-vcs).
12554

126-
# Info about docs
127-
128-
The documentation is build and hosted by [https://readthedocs.org/](https://readthedocs.org/).
129-
130-
Admin credentials are needed to access the setup.
131-
132-
# How to make a release
55+
## Making a release on GitHub, PyPi, and Conda-Forge
13356

13457
- needs admin rights
13558
- we are using [semver](https://semver.org/) (see section on versioning)

.github/dependabot.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ updates:
55
- package-ecosystem: "github-actions"
66
directory: "/"
77
schedule:
8-
interval: "monthly"
8+
interval: "weekly"
99

1010
- package-ecosystem: "gitsubmodule"
1111
directory: "/"
1212
schedule:
13-
interval: "monthly"
13+
interval: "weekly"

.github/workflows/python_build.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Python build
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
5+
cancel-in-progress: true
6+
37
on:
48
push:
59
branches: [ main ]
@@ -25,7 +29,7 @@ jobs:
2529
with:
2630
python-version: ${{ matrix.python-version }}
2731

28-
- name: Update pip et al.
32+
- name: Update pip etc.
2933
run: |
3034
python -m pip install --upgrade pip
3135
python -m pip install --upgrade build twine
@@ -40,13 +44,13 @@ jobs:
4044
- name: Check sdist
4145
run: twine check --strict dist/*
4246
- name: Install sdist
43-
run: pip install ./dist/pyprep-*
47+
run: python -m pip install ./dist/pyprep-*
4448
- name: Clean up working directory
4549
run: rm -rf ./*
4650
- name: Try importing pyprep
4751
run: python -c 'import pyprep; print(pyprep.__version__)'
4852
- name: Remove sdist install
49-
run: pip uninstall -y pyprep
53+
run: python -m pip uninstall -y pyprep
5054

5155
- uses: actions/checkout@v4
5256
with:
@@ -58,10 +62,10 @@ jobs:
5862
- name: Check wheel
5963
run: twine check --strict dist/*
6064
- name: Install wheel
61-
run: pip install ./dist/pyprep-*.whl
65+
run: python -m pip install ./dist/pyprep-*.whl
6266
- name: Clean up working directory
6367
run: rm -rf ./*
6468
- name: Try importing pyprep
6569
run: python -c 'import pyprep; print(pyprep.__version__)'
6670
- name: Remove wheel install
67-
run: pip uninstall -y pyprep
71+
run: python -m pip uninstall -y pyprep

.github/workflows/python_tests.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
name: Python tests
22

3+
concurrency:
4+
group: ${{ github.workflow }}-${{ github.event.number }}-${{ github.event.ref }}
5+
cancel-in-progress: true
6+
37
on:
48
push:
59
branches: [ main ]
@@ -49,21 +53,25 @@ jobs:
4953
- name: Install dependencies
5054
run: |
5155
python -m pip install --upgrade pip
52-
pip install -e ".[dev]"
56+
python -m pip install -e ".[dev]"
5357
5458
- name: Install MNE-Python (development version)
5559
if: matrix.mne-version == 'mne-main'
5660
run: |
57-
pip install --upgrade https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip
61+
python -m pip install --upgrade https://github.com/mne-tools/mne-python/archive/refs/heads/main.zip
5862
59-
- name: Check installed versions
63+
- name: Display versions and environment information
6064
run: |
65+
echo $TZ
66+
date
67+
python --version
68+
which python
6169
mne sys_info
6270
6371
- name: Check formatting
6472
if: matrix.platform == 'ubuntu-latest'
6573
run: |
66-
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
74+
pre-commit run --all-files
6775
6876
- name: Test with pytest
6977
# Options defined in pyproject.toml
@@ -74,7 +82,7 @@ jobs:
7482
make -C docs/ clean
7583
make -C docs/ html
7684
77-
- name: Upload artifacts
85+
- name: Upload docs build artifacts
7886
if: ${{ matrix.platform == 'ubuntu-latest' && matrix.mne-version == 'mne-stable' }}
7987
uses: actions/upload-artifact@v4
8088
with:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Upload a Python Package using Twine when a release is created
22

3-
name: build
3+
name: release
44
on: # yamllint disable-line rule:truthy
55
release:
66
types: [published]

.readthedocs.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,19 @@
1-
# .readthedocs.yml
2-
# Read the Docs configuration file
1+
# Read the Docs configuration file for Sphinx projects
32
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
43

5-
# Required
64
version: 2
75

86
build:
9-
os: ubuntu-22.04
7+
os: ubuntu-lts-latest
108
tools:
119
python: "3.12"
1210

13-
# Build documentation in the docs/ directory with Sphinx
1411
sphinx:
1512
configuration: docs/conf.py
1613

17-
# Optionally set the version of Python and requirements required to build your docs
1814
python:
1915
install:
20-
- method: pip
21-
path: .
22-
extra_requirements:
23-
- docs
16+
- method: pip
17+
path: .
18+
extra_requirements:
19+
- docs

README.rst

Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
.. image:: https://codecov.io/gh/sappelhoff/pyprep/branch/main/graph/badge.svg
1414
:target: https://codecov.io/gh/sappelhoff/pyprep
15-
:alt: codecov
16-
15+
:alt: Test coverage
1716

1817
.. image:: https://readthedocs.org/projects/pyprep/badge/?version=latest
1918
:target: https://pyprep.readthedocs.io/en/latest/?badge=latest
@@ -49,57 +48,42 @@ for EEG data, working with `MNE-Python <https://mne.tools>`_.
4948
Installation
5049
============
5150

52-
``pyprep`` requires Python version ``3.9`` or higher to run properly.
51+
``pyprep`` runs on Python version 3.9 or higher.
52+
5353
We recommend to run ``pyprep`` in a dedicated virtual environment
5454
(for example using `conda <https://docs.conda.io/en/latest/miniconda.html>`_).
5555

5656
For installing the **stable** version of ``pyprep``, call:
5757

5858
.. code-block:: Text
5959
60-
pip install pyprep
60+
python -m pip install --upgrade pyprep
6161
62-
or, as an alternative to ``pip``, call:
62+
or if you use `conda <https://docs.conda.io/en/latest/miniconda.html>`_:
6363

6464
.. code-block:: Text
6565
66-
conda install -c conda-forge pyprep
66+
conda install --channel conda-forge pyprep
6767
6868
For installing the **latest (development)** version of ``pyprep``, call:
6969

7070
.. code-block:: Text
7171
72-
pip install --upgrade https://github.com/sappelhoff/pyprep/archive/refs/heads/main.zip
72+
python -m pip install --upgrade https://github.com/sappelhoff/pyprep/archive/refs/heads/main.zip
7373
7474
Both the *stable* and the *latest* installation will additionally install
7575
all required dependencies automatically.
7676
The dependencies are defined in the ``pyproject.toml`` file under the
7777
``dependencies`` and ``project.optional-dependencies`` sections.
7878

79-
Contributions
80-
=============
81-
82-
**We are actively looking for contributors!**
83-
84-
Please chime in with your ideas on how to improve this software by opening
85-
a GitHub issue, or submitting a pull request.
86-
87-
See also our `CONTRIBUTING.md <https://github.com/sappelhoff/pyprep/blob/main/.github/CONTRIBUTING.md>`_
88-
file for help with submitting a pull request.
89-
90-
Potential contributors should install ``pyprep`` in the following way:
91-
92-
#. First they should fork ``pyprep`` to their own GitHub account.
93-
#. Then they should run the following commands,
94-
adequately replacing ``<gh-username>`` with their GitHub username.
79+
Contributing
80+
============
9581

96-
.. code-block:: Text
82+
The development of ``pyprep`` is taking place on
83+
`GitHub <https://github.com/sappelhoff/pyprep>`_.
9784

98-
git clone https://github.com/<gh-username>/pyprep
99-
cd pyprep
100-
git fetch --tags --prune --prune-tags
101-
pip install -e ".[dev]"
102-
pre-commit install
85+
For more information, please see
86+
`CONTRIBUTING.md <https://github.com/sappelhoff/pyprep/blob/main/.github/CONTRIBUTING.md>`_.
10387

10488
Citing
10589
======

0 commit comments

Comments
 (0)