Skip to content

Commit 544b548

Browse files
committed
docs: Updating contributing guidelines
1 parent 726aa0a commit 544b548

File tree

1 file changed

+37
-15
lines changed

1 file changed

+37
-15
lines changed

CONTRIBUTING.md

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,19 @@ This project uses the [hatch](https://hatch.pypa.io/latest/) project manager and
2626
pipx install hatch
2727
```
2828

29+
> [!NOTE]
30+
> Many custom command shortcuts are accessible through hatch (and shown below). See `tool.hatch.envs.default.scripts` in our project's `pyproject.toml` configuration file.
31+
32+
After forking and cloning the repository, you can create an isolated Python development environment and install the package in "editable" (i.e. development) mode as follows:
33+
34+
```sh
35+
git clone https://github.com/open2c/bioframe.git
36+
cd bioframe
37+
hatch shell
38+
```
39+
40+
The first time you run `hatch shell` the environment will be created and activated, and the package will be installed. In future sessions, running `hatch shell` will reactivate your development environment.
41+
2942
> [!TIP]
3043
> If you prefer to store your virtual environments in your working directory (like classic virtualenvs) rather than in a centralized location (similar to conda), configure hatch as follows:
3144
>
@@ -35,40 +48,49 @@ pipx install hatch
3548
>
3649
> This will make hatch set up its environments within the current working directory under `.venv`.
3750
38-
After forking and cloning the repository, you can create an isolated Python development environment and install the package in "editable" (i.e. development) mode as follows:
39-
40-
```sh
41-
git clone https://github.com/open2c/bioframe.git
42-
hatch shell
43-
```
44-
45-
The first time you run `hatch shell` the environment will be created and activated, and the package will be installed. In future sessions, running `hatch shell` will reactivate your development environment. If you prefer to manage your virtual environments differently, you can install the package for development using:
51+
Alternatively, if you prefer to manage your virtual environments differently, you can install the package for development using, for example:
4652
4753
```sh
54+
python -m venv .venv
4855
pip install -e '.[dev,test,docs]'
4956
```
5057
5158
For all pull requests, linting and unit tests are automatically run using the [GitHub Actions](https://docs.github.com/en/actions) Continuous Integration service. However, you are still encouraged to run these checks locally before pushing code to a PR.
5259
53-
> [!NOTE]
54-
> Many custom command shortcuts are accessible through hatch (and shown below). See `tool.hatch.envs.default.scripts` in our project's `pyproject.toml` configuration file.
55-
56-
## Linting
60+
## Linting and formatting
5761
58-
We use [ruff](https://docs.astral.sh/ruff/) for style checking. Run `ruff .` or:
62+
We use [ruff](https://docs.astral.sh/ruff/) for style checking. Run `ruff check .` or:
5963
6064
```sh
6165
hatch run lint
6266
```
6367
64-
Ruff can fix a lot of errors itself. Run `ruff --fix .` or:
68+
Ruff can fix a lot of errors itself. Run `ruff check --fix .` or:
6569
6670
```sh
6771
hatch run fix
6872
```
6973
70-
You can also use tools like [black](https://black.readthedocs.io/en/stable/) to reformat your code.
74+
Ruff includes a formatter that mimics [black](https://black.readthedocs.io/en/stable/). To automatically reformat your code, you can use `ruff format .` or:
75+
76+
```sh
77+
hatch run format
78+
```
79+
80+
We use [pre-commit](https://github.com/pre-commit/pre-commit) to make sure the coding style is enforced. You first need to install pre-commit and the corresponding git commit hooks:
81+
82+
```sh
83+
pip install pre-commit
84+
pre-commit install
85+
```
86+
87+
After that you can make sure your code satisfies the coding style:
88+
89+
```sh
90+
pre-commit run --all-files
91+
```
7192
93+
If you install pre-commit in your repo, these checks will also run automatically before every commit.
7294
7395
## Running/Adding Unit Tests
7496

0 commit comments

Comments
 (0)