Skip to content

Commit 4fb76f1

Browse files
authored
Add Hatch (#468)
* Add Hatch * Update workflows * Update workflows * Update workflows * Add networkx * Update tests * Add formatters * Drop Poetry refs * Respond to PR comments
1 parent c962092 commit 4fb76f1

40 files changed

+486
-4832
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
1-
## Type of changes
2-
3-
- [ ] Bug fix
4-
- [ ] New feature
5-
- [ ] Documentation / docstrings
6-
- [ ] Tests
7-
- [ ] Other
8-
91
## Checklist
102

11-
- [ ] I've formatted the new code by running `poetry run pre-commit run --all-files --show-diff-on-failure` before committing.
3+
- [ ] I've formatted the new code by running `hatch run dev:format` before committing.
124
- [ ] I've added tests for new code.
135
- [ ] I've added docstrings for the new code.
146

.github/workflows/build_docs.yml

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,15 @@ jobs:
4646
- name: Install KaTeX
4747
run: |
4848
npm install katex
49-
# Install Poetry and build the documentation
50-
- name: Install and configure Poetry
51-
uses: snok/install-poetry@v1
52-
with:
53-
version: 1.5.1
54-
virtualenvs-create: false
55-
virtualenvs-in-project: false
56-
installer-parallel: true
49+
50+
# Install Hatch
51+
- name: Install Hatch
52+
uses: pypa/hatch@install
5753

5854
- name: Build the documentation with MKDocs
5955
run: |
60-
poetry install --all-extras --with docs
6156
conda install pandoc
62-
poetry run python docs/scripts/gen_examples.py --execute && poetry run mkdocs build
57+
hatch run docs:build
6358
6459
- name: Deploy Page 🚀
6560
uses: JamesIves/github-pages-deploy-action@v4.4.1

.github/workflows/integration.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,10 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

28-
# Install Poetry
29-
- name: Install Poetry
30-
uses: snok/install-poetry@v1.3.3
31-
with:
32-
version: 1.5.1
33-
34-
# Configure Poetry to use the virtual environment in the project
35-
- name: Setup Poetry
36-
run: |
37-
poetry config virtualenvs.in-project true
38-
39-
# Install the dependencies
40-
- name: Install Package
41-
run: |
42-
poetry install --with docs
28+
# Install Hatch
29+
- name: Install Hatch
30+
uses: pypa/hatch@install
4331

4432
# Run the unit tests and build the coverage report
4533
- name: Run Integration Tests
46-
run: poetry run python tests/integration_tests.py
34+
run: hatch run docs:integration

.github/workflows/test_docs.yml

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,11 @@ jobs:
3333
auto-update-conda: true
3434
python-version: ${{ matrix.python-version }}
3535

36-
# Install Poetry and build the documentation
37-
- name: Install and configure Poetry
38-
uses: snok/install-poetry@v1
39-
with:
40-
version: 1.5.1
41-
virtualenvs-create: false
42-
virtualenvs-in-project: false
43-
installer-parallel: true
36+
# Install Hatch
37+
- name: Install Hatch
38+
uses: pypa/hatch@install
4439

4540
- name: Build the documentation with MKDocs
4641
run: |
47-
poetry install --all-extras --with docs
4842
conda install pandoc
49-
poetry run python docs/scripts/gen_examples.py --execute && poetry run mkdocs build
43+
hatch run docs:build

.github/workflows/tests.yml

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,18 @@ jobs:
2525
with:
2626
python-version: ${{ matrix.python-version }}
2727

28-
# Install Poetry
29-
- name: Install and configure Poetry
30-
uses: snok/install-poetry@v1
31-
with:
32-
version: 1.5.1
33-
virtualenvs-create: false
34-
virtualenvs-in-project: false
35-
installer-parallel: true
36-
37-
# Configure Poetry to use the virtual environment in the project
38-
- name: Setup Poetry
39-
run: |
40-
poetry config virtualenvs.in-project true
28+
# Install Hatch
29+
- name: Install Hatch
30+
uses: pypa/hatch@install
4131

4232
# Install the dependencies
43-
- name: Install Package
44-
run: |
45-
poetry install --with dev
46-
4733
- name: Check docstrings
4834
run: |
49-
poetry run xdoctest ./gpjax
35+
hatch run dev:docstrings
5036
5137
# Run the unit tests and build the coverage report
5238
- name: Run Tests
53-
run: poetry run pytest -v --cov=./gpjax --cov-report=xml:./coverage.xml
39+
run: hatch run dev:coverage
5440

5541
- name: Upload code coverage
5642
uses: codecov/codecov-action@v3

.pre-commit-config.yaml

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

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,14 @@ configuration in development mode.
205205
```bash
206206
git clone https://github.com/JaxGaussianProcesses/GPJax.git
207207
cd GPJax
208-
poetry install
208+
hatch env create
209+
hatch shell
209210
```
210211
211212
> We recommend you check your installation passes the supplied unit tests:
212213
>
213214
> ```python
214-
> poetry run pytest
215+
> hatch run dev:test
215216
> ```
216217
217218
# Citing GPJax

docs/contributing.md

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -72,36 +72,19 @@ you through every detail!
7272
Always use a `feature` branch. It's good practice to avoid
7373
work on the ``main`` branch of any repository.
7474

75-
4. We use [Poetry](https://python-poetry.org/) for packaging and dependency management, and project requirements are in ``pyproject.toml``. We suggest using a [virtual environment](https://docs.python-guide.org/dev/virtualenvs/) for
76-
development. For those using Apple Silicon chips, we advise using [Conda miniforge](https://github.com/conda-forge/miniforge). Once the virtual environment is activated, run:
75+
4. We use [Hatch](https://hatch.pypa.io/latest/) for packaging and dependency management. Project requirements are in ``pyproject.toml``. To install GPJax into a Hatch virtual environment, run:
7776

7877
```bash
79-
$ poetry install
78+
$ hatch env create
8079
```
8180

8281
At this point we recommend you check your installation passes the supplied unit tests:
8382

8483
```bash
85-
$ poetry run pytest
84+
$ hatch run dev:all-tests
8685
```
8786

88-
5. Install the pre-commit hooks.
89-
90-
```bash
91-
$ pre-commit install
92-
```
93-
94-
Please ensure you have done this before committing any files. If
95-
successful, this will print the following output `pre-commit installed at
96-
.git/hooks/pre-commit`.
97-
98-
6. At this point you can manually run the pre-commit hooks with the following command:
99-
100-
```bash
101-
poetry run pre-commit run --all-files
102-
```
103-
104-
7. Add changed files using `git add` and then `git commit` files to record your
87+
5. Add changed files using `git add` and then `git commit` files to record your
10588
changes locally:
10689

10790
```bash
@@ -122,7 +105,7 @@ development. For those using Apple Silicon chips, we advise using [Conda minifor
122105
$ git push -u origin my-feature
123106
```
124107

125-
8. Go to the GitHub web page of your fork of the GPJax repo. Click the 'Pull
108+
6. Go to the GitHub web page of your fork of the GPJax repo. Click the 'Pull
126109
request' button to send your changes to the project's maintainers for
127110
review.
128111

@@ -159,7 +142,7 @@ request, we recommend you check the following:
159142
accepted. Test coverage can be checked with:
160143

161144
```bash
162-
$ poetry run pytest tests --cov=./ --cov-report=html
145+
$ hatch run dev:coverage
163146
```
164147

165148
Navigate to the newly created folder `htmlcov` and open `index.html` to view

docs/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ hardware acceleration support as detailed in the
3131
```bash
3232
git clone https://github.com/thomaspinder/GPJax.git
3333
cd GPJax
34-
poetry install
34+
hatch shell create
3535
```
3636

3737
!!! tip
@@ -45,5 +45,5 @@ hardware acceleration support as detailed in the
4545
and recommend you check your installation passes the supplied unit tests:
4646

4747
```bash
48-
poetry run pytest tests/
48+
hatch run dev:all-tests
4949
```

0 commit comments

Comments
 (0)