Skip to content

Commit 4491d73

Browse files
committed
chore: Migrate dev from hatch to uv (#151)
1 parent 532558a commit 4491d73

File tree

13 files changed

+1844
-181
lines changed

13 files changed

+1844
-181
lines changed

.github/workflows/ci.yml

Lines changed: 17 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,37 @@ jobs:
1313
Lint:
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v3
17-
- name: Set up Python
18-
uses: actions/setup-python@v4
19-
with:
20-
python-version: "3.x"
21-
- run: |
22-
python -m pip install --upgrade hatch
23-
hatch run lint
16+
- uses: actions/checkout@v4
17+
- uses: astral-sh/setup-uv@v3
18+
with:
19+
version: "0.4.x"
20+
- run: |
21+
uv run ruff check .
2422
2523
Test:
2624
runs-on: ubuntu-latest
2725
strategy:
2826
matrix:
2927
python-version: ["3.8", "3.9", "3.10", "3.11"]
30-
3128
steps:
32-
- uses: actions/checkout@v3
33-
- name: Set up Python ${{ matrix.python-version }}
34-
uses: actions/setup-python@v4
35-
with:
36-
python-version: ${{ matrix.python-version }}
37-
- run: |
38-
python -m pip install --upgrade pip
39-
pip install -e .[dev]
40-
pytest
29+
- uses: actions/checkout@v4
30+
- uses: astral-sh/setup-uv@v3
31+
with:
32+
version: "0.4.x"
33+
- run: uv run pytest
34+
env:
35+
UV_PYTHON: ${{ matrix.python-version }}
4136

4237
Release:
4338
needs: [Lint, Test]
4439
runs-on: ubuntu-latest
4540
if: startsWith(github.ref, 'refs/tags')
4641
steps:
47-
- name: Checkout
48-
uses: actions/checkout@v3
49-
50-
- name: Setup Python
51-
uses: actions/setup-python@v4
42+
- uses: actions/checkout@v4
43+
- uses: astral-sh/setup-uv@v3
5244
with:
53-
python-version: "3.x"
54-
55-
- name: Install dependencies
56-
run: |
57-
python -m pip install --upgrade pip
58-
pip install build
59-
60-
- name: Build
61-
run: python -m build
62-
45+
version: "0.4.x"
46+
- run: uv build
6347
- name: Publish distribution 📦 to PyPI
6448
uses: pypa/gh-action-pypi-publish@release/v1
6549
with:

.github/workflows/docs.yml

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,32 +27,18 @@ jobs:
2727
url: ${{ steps.deployment.outputs.page_url }}
2828
runs-on: ubuntu-latest
2929
steps:
30-
- name: Checkout
31-
uses: actions/checkout@v3
32-
33-
- name: Set up Python
34-
uses: actions/setup-python@v4
30+
- uses: actions/checkout@v4
31+
- uses: astral-sh/setup-uv@v3
3532
with:
36-
python-version: "3.x"
37-
38-
- name: Install dependencies
39-
run: |
40-
python -m pip install --upgrade pip
41-
pip install hatch
33+
version: "0.4.x"
4234

43-
- name: Build
44-
run: hatch run docs:build
35+
- run: uv run docs/build.py
4536

46-
- name: Setup Pages
47-
uses: actions/configure-pages@v3
48-
49-
- name: Upload artifact
50-
uses: actions/upload-pages-artifact@v1
37+
- uses: actions/configure-pages@v3
38+
- uses: actions/upload-pages-artifact@v1
5139
with:
52-
# Upload entire repository
5340
path: './docs/_build/html'
5441

5542
- name: Deploy to GitHub Pages
5643
id: deployment
5744
uses: actions/deploy-pages@v1
58-

.github/workflows/docs_s3.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,12 @@ jobs:
1515
deploy_s3:
1616
runs-on: ubuntu-latest
1717
steps:
18-
- name: Checkout
19-
uses: actions/checkout@v3
20-
21-
- name: Set up Python
22-
uses: actions/setup-python@v4
18+
- uses: actions/checkout@v4
19+
- uses: astral-sh/setup-uv@v3
2320
with:
24-
python-version: "3.x"
25-
26-
- name: Install dependencies
27-
run: |
28-
python -m pip install --upgrade pip
29-
pip install hatch
21+
version: "0.4.x"
3022

31-
- name: Build
32-
run: hatch run docs:build
23+
- run: uv run docs/build.py
3324

3425
- name: Publish docs to S3
3526
uses: jakejarvis/s3-sync-action@master

README.md

Lines changed: 12 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -70,44 +70,22 @@ and understanding are greatly appreciated.
7070

7171
## Development
7272

73-
**higlass-python** uses
74-
[the recommended](https://packaging.python.org/en/latest/flow/#) `hatchling`
75-
build-system, which is convenient to use via the
76-
[`hatch` CLI](https://hatch.pypa.io/latest/). We recommend installing `hatch`
77-
globally (e.g., via `pipx`) and running the various commands defined within
78-
`pyproject.toml`. `hatch` will take care of creating and synchronizing a virtual
79-
environment with all dependencies defined in `pyproject.toml`.
73+
**higlass-python** uses uses [uv](https://astral.sh/uv) for development.
8074

8175
### Commands Cheatsheet
8276

8377
All commands are run from the root of the project, from a terminal:
8478

85-
| Command | Action |
86-
| :--------------------- | :------------------------------------------------------------------ |
87-
| `hatch run fix` | Format project with `black .` and apply linting with `ruff --fix .` |
88-
| `hatch run lint` | Lint project with `ruff .`. |
89-
| `hatch run test` | Run unit tests with `pytest` in latest Python version. |
90-
| `hatch run test:test` | Run unit tests with `pytest` in all target Python versions. |
91-
| `hatch run docs:build` | Build the documentation in `docs/_build/html`. |
92-
| `hatch run docs:serve` | Start an dev-server for live editing RST files in `docs/`. |
93-
94-
> **Note**: `hatch build` and `hatch publish` are available to build and publish
95-
> the project to PyPI, but all releases are handled automatically via CI.
96-
97-
Alternatively, you can develop **higlass-python** by manually creating a virtual
98-
environment and managing installation and dependencies with `pip`. For example,
99-
create a virtual environment with `conda`:
100-
101-
```bash
102-
conda create -n higlass python=3.11
103-
conda activate higlass
104-
```
105-
106-
and install **higlass-python** in _editable_ mode with all optional
107-
dependencies:
79+
| Command | Action |
80+
|---------|--------|
81+
| `uv run ruff check --fix && uv run ruff format` | Lint and apply formatting |
82+
| `uv run check` | Check linting rules |
83+
| `uv run ruff format --check` | Check formatting |
84+
| `uv run pytest` | Run unit tests |
85+
| `uv run docs/build.py` | Build the documentation in `docs/_build/html` |
10886

109-
```bash
110-
pip install -e ".[dev,fuse,docs]"
111-
```
87+
This table now includes only the UV-related commands, with each command in the
88+
left column and its corresponding action in the right column. The formatting is
89+
clean and easy to read.
11290

113-
Our CI checks formatting (`black .`), linting (`ruff .`), and tests (`pytest`).
91+
Our CI enforces formatting, linting, and tests.

docs/Makefile

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

docs/README.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,16 @@
22

33
Documentation for all HiGlass software ([viewer][hgv], [app][hga], [server][hgs], [docker][hgd])
44

5-
Simple edits can be made in GitHub. For anything more extensive, preview it locally:
5+
Simple edits can be made in GitHub. For anything more extensive, build and preview it locally:
66

77
```
8-
git clone https://github.com/higlass/higlass.git
9-
cd higlass/docs
10-
git checkout develop
11-
pip install -r requirements.txt
12-
./serve.sh
8+
uv run build.py
9+
uv run python -m http.server 8000 --directory _build/html
1310
```
1411

15-
Docs are built and pushed to S3 by Travis.
16-
See [.travis.yml](https://github.com/higlass/higlass/blob/develop/.travis.yml) for details.
12+
Then open your browser to `http://localhost:8000`.
13+
14+
Docs are built and deployed via GitHub Actions via a [workflow](.github/workflows/docs.yml).
1715

1816
[hga]: https://github.com/higlass/higlass-app
1917
[hgd]: https://github.com/higlass/higlass-docker

docs/build.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# /// script
2+
# requires-python = ">=3.12"
3+
# dependencies = [
4+
# "higlass-python",
5+
# "markupsafe==2.0.1",
6+
# "setuptools",
7+
# "sphinx-js",
8+
# "Sphinx",
9+
# ]
10+
#
11+
# [tool.uv.sources]
12+
# higlass-python = { path = "../" }
13+
# ///
14+
import pathlib
15+
16+
from sphinx.application import Sphinx
17+
18+
SELF_DIR = pathlib.Path(__file__).parent
19+
20+
21+
def main():
22+
app = Sphinx(
23+
srcdir=SELF_DIR,
24+
confdir=SELF_DIR,
25+
outdir=SELF_DIR / "_build" / "html",
26+
doctreedir=SELF_DIR / "_build" / "doctrees",
27+
buildername="html",
28+
)
29+
30+
app.build()
31+
32+
33+
if __name__ == "__main__":
34+
main()

docs/build.sh

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

docs/environment.yml

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

docs/requirements.txt

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

0 commit comments

Comments
 (0)