Skip to content

Commit aedb7ca

Browse files
committed
Improve contributing guide and remove requirements-check
1 parent 69a1aa7 commit aedb7ca

File tree

5 files changed

+20
-27
lines changed

5 files changed

+20
-27
lines changed

.github/workflows/code-style.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
with:
2424
python-version: "3.11"
2525
- run: |
26-
pip install -r requirements-check.txt
26+
pip install -r requirements-dev.txt
2727
pre-commit run -a
2828
2929
- name: Commit and push changes

.github/workflows/unit-tests.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ jobs:
100100
101101
- name: Check code formatting
102102
run: |
103-
pip install -r requirements-check.txt
104103
pre-commit run -a
105104
106105
- name: Run Mypy

CONTRIBUTING.md

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ into the following categories:
3535
- [Installation](#installation)
3636
- [Code development](#code-development)
3737
- [Codebase structure](#codebase-structure)
38-
- [Formatting Code](#formatting-code)
39-
- [Formatting without pre-commit](#formatting-without-pre-commit)
40-
- [Formatting with pre-commit](#formatting-with-pre-commit)
38+
- [Checking Code Style](#checking-code-style)
39+
- [Formatting the code](#formatting-the-code)
40+
- [Formatting the code with a pre-commit hook](#formatting-the-code-with-a-pre-commit-hook)
4141
- [Run tests](#run-tests)
4242
- [Run distributed tests only on CPU](#run-distributed-tests-only-on-cpu)
4343
- [Run Mypy checks](#run-mypy-checks)
@@ -138,44 +138,39 @@ If you modify the code, you will most probably also need to code some tests to e
138138
New code should be compatible with Python 3.X versions. Once you finish implementing a feature or bugfix and tests,
139139
please run lint checking and tests:
140140

141-
#### Formatting Code
141+
#### Checking Code Style
142142

143-
To ensure the codebase complies with a style guide, we use [flake8](https://flake8.pycqa.org/en/latest/)
144-
and [ufmt](https://ufmt.omnilib.dev/) ([black](https://black.readthedocs.io/en/stable/) and
145-
[usort](https://usort.readthedocs.io/en/stable/)) to format and check codebase for compliance with PEP8.
143+
To ensure the codebase complies with the PEP8 style guide, we use [ruff](https://docs.astral.sh/ruff/)
144+
and [black](https://black.readthedocs.io/en/stable/) to lint and format the codebase respectively.
146145

147-
##### Formatting without pre-commit
146+
##### Formatting the code
148147

149-
If you choose not to use pre-commit, you can take advantage of IDE extensions configured to black format or invoke
150-
black manually to format files and commit them.
151-
152-
To install `flake8`, `ufmt` and `mypy`, please run
148+
To automate the process, we have configured the repo with [pre-commit](https://pre-commit.com/).
153149

154150
To format files and commit changes:
155151

156152
```bash
157-
# This should autoformat the files
153+
# This should lint and autoformat the files
158154
pre-commit -a
159155
# If everything is OK, then commit
160156
git add .
161157
git commit -m "Added awesome feature"
162158
```
163159

164-
##### Formatting with pre-commit
160+
##### Formatting the code with a pre-commit hook
165161

166-
To automate the process, we have configured the repo with [pre-commit hooks](https://pre-commit.com/) to use µfmt to autoformat the staged files to ensure every commit complies with a style guide. This requires some setup, which is described below:
162+
To enable the `pre-commit` hooks follow the steps described below:
167163

168-
1. Install pre-commit in your python environment.
169-
2. Run pre-commit install that configures a virtual environment to invoke ufmt and flake8 on commits.
164+
1. Run `pre-commit install` to configures a virtual environment to invoke linters and formatters on commits.
170165

171166
```bash
172167
pip install pre-commit
173168
pre-commit install
174169
```
175170

176-
3. When files are committed:
177-
- If the stages files are not compliant with black or µsort, µfmt will autoformat the staged files. If this were to happen, files should be staged and committed again. See example code below.
178-
- If the staged files are not compliant with flake8, errors will be raised. These errors should be fixed and the files should be committed again. See example code below.
171+
2. When files are committed:
172+
- If the stages files are not compliant, the tools autoformat the staged files. If this were to happen, files should be staged and committed again. See example code below.
173+
- If the staged files are not compliant errors will be raised. These errors should be fixed and the files should be committed again. See example code below.
179174

180175
```bash
181176
git add .

requirements-check.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

requirements-dev.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Tests
2+
dill
3+
filelock
4+
mypy
25
numpy
6+
pre-commit
37
pytest
48
pytest-cov
59
pytest-order
610
pytest-timeout
711
pytest-xdist
8-
dill
9-
filelock
1012
setuptools
1113
# Test contrib dependencies
1214
scipy

0 commit comments

Comments
 (0)