Skip to content

Commit 7145bbc

Browse files
authored
Move to uv (#94)
* Move to uv Signed-off-by: Hemil Desai <[email protected]> * fix Signed-off-by: Hemil Desai <[email protected]> * fix Signed-off-by: Hemil Desai <[email protected]> * fix Signed-off-by: Hemil Desai <[email protected]> * Use dependency groups Signed-off-by: Hemil Desai <[email protected]> * Update contribution guide Signed-off-by: Hemil Desai <[email protected]> * fix Signed-off-by: Hemil Desai <[email protected]> --------- Signed-off-by: Hemil Desai <[email protected]>
1 parent dd970c9 commit 7145bbc

File tree

10 files changed

+6923
-96
lines changed

10 files changed

+6923
-96
lines changed

.github/workflows/nightly.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ on:
77

88
jobs:
99
format:
10-
uses: ./.github/workflows/rye-format.yml
10+
uses: ./.github/workflows/ruff-format.yml
1111
lint:
12-
uses: ./.github/workflows/rye-lint.yml
12+
uses: ./.github/workflows/ruff-lint.yml
1313
test:
14-
uses: ./.github/workflows/rye-test.yml
14+
uses: ./.github/workflows/test.yml
1515
tag:
1616
name: Run Tests and Create Nightly Tag
1717
runs-on: ubuntu-latest

.github/workflows/ruff-format.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Ruff format
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
10+
jobs:
11+
format:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install the latest version of uv
18+
uses: astral-sh/setup-uv@v3
19+
with:
20+
version: "latest"
21+
22+
- name: Ruff fmt
23+
run: uv run --group lint -- ruff format --diff

.github/workflows/ruff-lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Ruff lint
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
10+
jobs:
11+
lint:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install the latest version of uv
18+
uses: astral-sh/setup-uv@v3
19+
with:
20+
version: "latest"
21+
22+
- name: Ruff lint
23+
run: uv run --group lint -- ruff check

.github/workflows/rye-format.yml

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

.github/workflows/rye-lint.yml

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

.github/workflows/rye-test.yml

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

.github/workflows/test.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Run tests
2+
3+
on:
4+
workflow_dispatch:
5+
workflow_call:
6+
push:
7+
branches: [main]
8+
pull_request:
9+
10+
jobs:
11+
test:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Install the latest version of uv
18+
uses: astral-sh/setup-uv@v3
19+
with:
20+
version: "latest"
21+
22+
- name: uv sync
23+
run: uv sync --extra skypilot
24+
25+
- shell: bash
26+
run: |
27+
git config --global user.name github-actions[bot]
28+
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com
29+
30+
- name: Run tests
31+
run: uv run -- pytest test/
32+
33+
- name: Run coverage
34+
run: |
35+
uv run -- coverage run -m pytest
36+
uv run -- coverage report -m
37+
38+
- name: Run example notebooks
39+
run: uv run -- jupyter execute examples/**/*.ipynb
40+
41+
- name: Run example scripts
42+
run: |
43+
cd examples/hello-world && uv run -- python hello_scripts.py

CONTRIBUTING.md

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ Not all steps are necessary for some contributions, so read the linked sections
2525
1. **Sensible**: code should make sense. If you think a piece of code might be confusing, write comments.
2626

2727
## Environment Setup
28-
We use [rye](https://rye.astral.sh/) to develop NeMo Run. The following steps should get you started with the dev environment:
28+
We use [uv](https://docs.astral.sh/uv/) to develop NeMo Run. The following steps should get you started with the dev environment:
2929

30-
1. Install [rye](https://rye.astral.sh/guide/installation/)
30+
1. Install [uv](https://docs.astral.sh/uv/getting-started/installation/)
3131
2. Clone NeMo-Run
32-
3. Sanity check with `rye test` (This will create a venv and run all unit tests)
32+
3. Sanity check with `uv sync --extra skypilot && uv run -- pytest test/` (This will create a venv and run all unit tests)
3333

3434
If all tests passed, then you should be good to get started with the development of NeMo-Run.
3535

@@ -55,14 +55,11 @@ The documentation should also cover potential pitfalls and caveats.
5555
This existing examples and documentation should serve as a good reference to what is expected.
5656

5757
## Python style
58-
We use [``ruff``](https://docs.astral.sh/ruff/) for linting and formatting. To lint and format your code, you can run `rye check` and `rye fmt` respectively.
58+
We use [``ruff``](https://docs.astral.sh/ruff/) for linting and formatting. To lint and format your code, you can run `uv run --group lint -- ruff check` and `uv run --group lint -- ruff format` respectively.
5959

6060
## Unit tests
6161
Unit tests should be simple and fast.
6262
Developers should be able to run them frequently while developing without any slowdown.
63-
```
64-
rye test
65-
```
6663

6764
## Pull Requests (PR) Guidelines
6865

pyproject.toml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,10 @@ skypilot-all = [
5252
"skypilot[all]>=v0.6.1",
5353
]
5454

55-
[build-system]
56-
requires = ["hatchling", "hatch-vcs"]
57-
build-backend = "hatchling.build"
58-
59-
[tool.rye]
60-
managed = true
61-
dev-dependencies = [
55+
[dependency-groups]
56+
dev = [
57+
{ include-group = "lint" },
6258
"pytest>=8.2.0",
63-
"ruff>=0.4.4",
6459
"coverage>=7.5.1",
6560
"pre-commit>=3.7.1",
6661
"pytest-sugar>=1.0.0",
@@ -70,8 +65,21 @@ dev-dependencies = [
7065
"jupyter>=1.1.1"
7166
]
7267

73-
[tool.rye.scripts]
74-
cov = { chain = ["coverage run -m pytest", "coverage report -m" ] }
68+
lint = [
69+
"ruff>=0.4.4",
70+
]
71+
72+
docs = [
73+
"sphinx"
74+
]
75+
76+
[build-system]
77+
requires = ["hatchling", "hatch-vcs"]
78+
build-backend = "hatchling.build"
79+
80+
[tool.uv]
81+
managed = true
82+
prerelease = "allow"
7583

7684
[tool.pytest.ini_options]
7785
markers = [

0 commit comments

Comments
 (0)