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
+7-12
Original file line number
Diff line number
Diff line change
@@ -48,16 +48,17 @@ The first time you run `hatch shell` the environment will be created and activat
48
48
>
49
49
> This will make hatch set up its environments within the current working directory under `.venv`.
50
50
51
-
Alternatively, if you prefer to manage your virtual environments differently, you can install the package for development using, for example:
51
+
Alternatively, if you prefer to manage your virtual environments yourself, you can install the package for development using, for example:
52
52
53
53
```sh
54
54
python -m venv .venv
55
+
source .venv/bin/activate
55
56
pip install -e '.[dev,test,docs]'
56
57
```
57
58
58
59
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.
59
60
60
-
## Linting and formatting
61
+
## Linting and Formatting
61
62
62
63
We use [ruff](https://docs.astral.sh/ruff/) for style checking. Run `ruff check .` or:
63
64
@@ -71,11 +72,7 @@ Ruff can fix a lot of errors itself. Run `ruff check --fix .` or:
71
72
hatch run fix
72
73
```
73
74
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
-
```
75
+
Ruff includes a formatter that mimics [black](https://black.readthedocs.io/en/stable/). To automatically reformat your code, you can use `ruff format {source_file}`.
79
76
80
77
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
78
@@ -84,15 +81,13 @@ pip install pre-commit
84
81
pre-commit install
85
82
```
86
83
87
-
After that you can make sure your code satisfies the coding style:
84
+
The last command installs the hooks listed in`.pre-commit-config.yaml` locally into your git repo. If you do this, the checks will run automatically before every commit. You can also manually make sure your code satisfies the coding style:
88
85
89
86
```sh
90
87
pre-commit run --all-files
91
88
```
92
89
93
-
If you install pre-commit in your repo, these checks will also run automatically before every commit.
94
-
95
-
## Running/Adding Unit Tests
90
+
## Testing
96
91
97
92
It is best if all new functionality and/or bug fixes have unit tests added with each use-case.
98
93
@@ -102,7 +97,7 @@ We use [pytest](https://docs.pytest.org/en/latest) as our unit testing framework
102
97
hatch run test
103
98
```
104
99
105
-
## Adding/Building the Documentation
100
+
## Documentation
106
101
107
102
If a feature is stable and relatively finalized, it is time to add it to the documentation. If you are adding any private/public functions, it is best to add docstrings, to aid in reviewing code and also for the API reference.
0 commit comments