You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+37-15Lines changed: 37 additions & 15 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,19 @@ This project uses the [hatch](https://hatch.pypa.io/latest/) project manager and
26
26
pipx install hatch
27
27
```
28
28
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
+
29
42
> [!TIP]
30
43
> 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:
31
44
>
@@ -35,40 +48,49 @@ pipx install hatch
35
48
>
36
49
> This will make hatch set up its environments within the current working directory under `.venv`.
37
50
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:
46
52
47
53
```sh
54
+
python -m venv .venv
48
55
pip install -e '.[dev,test,docs]'
49
56
```
50
57
51
58
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.
52
59
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
57
61
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:
59
63
60
64
```sh
61
65
hatch run lint
62
66
```
63
67
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:
65
69
66
70
```sh
67
71
hatch run fix
68
72
```
69
73
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
+
```
71
92
93
+
If you install pre-commit in your repo, these checks will also run automatically before every commit.
0 commit comments