Skip to content

Commit c05dd18

Browse files
authored
switch from rye to uv (#100)
* setup uv * fix ci * fix doc build * clean up README * fix doc ci * update script with uv
1 parent 61b771f commit c05dd18

File tree

7 files changed

+1502
-128
lines changed

7 files changed

+1502
-128
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,20 @@ jobs:
2424

2525
steps:
2626
- uses: actions/checkout@v4
27-
- name: setup-rye
28-
uses: eifinger/setup-rye@v4
27+
- name: Install uv
28+
uses: astral-sh/setup-uv@v3
2929
with:
30-
enable-cache: true
31-
cache-prefix: "rye-cache-ci"
32-
- run: rye pin cpython@${{ matrix.python-version }}
33-
- run: rye sync
34-
- name: Test with pytest & generate coverage
35-
run: |
36-
rye run coverage:github
30+
# Install a specific version of uv.
31+
version: "0.5.1"
32+
enable-cache: true
33+
cache-dependency-glob: "uv.lock"
34+
- name: Set up Python ${{ matrix.python-version }}
35+
run: uv python install ${{ matrix.python-version }}
36+
- name: Install the project
37+
run: uv sync --all-extras --dev
38+
- name: Run tests
39+
# For example, using `pytest`
40+
run: uv run just coverage
3741
- name: Upload Coverage to Codecov
3842
uses: codecov/codecov-action@v4
3943
with:

.github/workflows/doc.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,15 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- uses: actions/checkout@v4
19-
- name: Set up rye
20-
uses: eifinger/setup-rye@v3
21-
- name: Update Rye
22-
run: |
23-
rye self update
24-
- name: Sync dependencies using rye
25-
run: |
26-
rye config --set-bool behavior.use-uv=true
27-
rye pin 3.10
28-
rye sync
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v3
21+
with:
22+
# Install a specific version of uv.
23+
version: "0.5.1"
24+
enable-cache: true
25+
cache-dependency-glob: "uv.lock"
26+
- name: Install Documentation dependencies
27+
run: uv sync --group doc
2928
- name: Set up build cache
3029
uses: actions/cache@v4
3130
id: cache
@@ -38,7 +37,7 @@ jobs:
3837
env:
3938
GH_TOKEN: ${{ secrets.GH_TOKEN }}
4039
run: |
41-
rye run mkdocs build
40+
uv run mkdocs build
4241
- name: Deploy preview
4342
uses: rossjrw/pr-preview-action@v1
4443
with:

README.md

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -14,66 +14,8 @@ _The multi-level intermediate representation (MLIR) compiler for high-level sema
1414
1515
## Installation
1616

17-
### Install via `rye` (Recommended)
17+
### Install via `uv` (Recommended)
1818

19-
This package is registered in `quera-algo` repository. If you have not set up the repository, you can add the following to `~/.rye/config.toml`:
20-
21-
```toml
22-
[[sources]]
23-
name = "quera-algo"
24-
url = "https://rluo@quera.com:<PASSWORD>@quera.jfrog.io/artifactory/api/pypi/quera-algo/simple"
25-
type = "index"
26-
```
27-
28-
where `<PASSWORD>` can be found on QuEra's JFrog Artifactory. Then you can install the package by:
29-
30-
```bash
31-
rye add kirin-toolchain
32-
rye sync
33-
```
34-
35-
### Install via `pip` (Less Recommended)
36-
37-
Or you can use it via `pip` by copying the following to `~/.pip/pip.conf`:
38-
39-
```conf
40-
[global]
41-
index-url = https://rluo@quera.com:<PASSWORD>@quera.jfrog.io/artifactory/api/pypi/quera-algo/simple
19+
```py
20+
uv add kirin-toolchain
4221
```
43-
44-
then install the package by:
45-
46-
```bash
47-
pip install kirin-toolchain
48-
```
49-
50-
## See Also
51-
52-
Several dialects are defined in their own packages. The close relatives are
53-
defined as namespace packages. See [kirin-workspace](https://github.com/QuEraComputing/kirin-workspace) to develop them together.
54-
55-
## Roadmap
56-
57-
Some features of this compiler before we all in [MLIR][mlir]:
58-
59-
- [x] a [MLIR-like][mlir] IR infrastructure specialized for FLAIR
60-
- [ ] progressive lowering
61-
- [x] dialects for several compilation stages
62-
- [x] a [Julia-like][julia] JIT compiler
63-
- [x] abstract interpretation
64-
- [x] linear type system on SSA with type inference
65-
- [x] [Jax][jax]-like frontend
66-
67-
## References
68-
69-
- current [flair.py][flair.py]
70-
- [xdsl][xdsl]
71-
- [mlir][mlir]
72-
- [Julia/base/compiler][julia] compiler
73-
- [jax][jax]
74-
75-
[flair.py]: https://github.com/QuEraComputing/flair.py
76-
[xdsl]: https://github.com/xdslproject/xdsl
77-
[mlir]: https://mlir.llvm.org/
78-
[julia]: https://github.com/JuliaLang/julia/tree/master/base/compiler
79-
[jax]: https://jax.readthedocs.io/en/latest/

justfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
coverage-run:
2+
coverage run -m pytest test
3+
4+
coverage-xml:
5+
coverage xml
6+
7+
coverage-html:
8+
coverage html
9+
10+
coverage-report:
11+
coverage report
12+
13+
coverage-open:
14+
open htmlcov/index.html
15+
16+
coverage: coverage-run coverage-xml coverage-report
17+
18+
doc:
19+
mkdocs serve
20+
21+
doc-build:
22+
mkdocs build

pyproject.toml

Lines changed: 27 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -15,50 +15,6 @@ requires-python = ">= 3.10"
1515
requires = ["hatchling"]
1616
build-backend = "hatchling.build"
1717

18-
[tool.rye]
19-
managed = true
20-
dev-dependencies = [
21-
"black>=24.2.0",
22-
"ruff>=0.3.0",
23-
"pytest>=8.1.1",
24-
"ipython>=8.12.3",
25-
"pre-commit>=3.5.0",
26-
"python-pptx>=0.6.23",
27-
"isort>=5.13.2",
28-
"coverage>=7.4.4",
29-
"mkdocs>=1.5.3",
30-
"mike>=2.0.0",
31-
"twine>=5.0.0",
32-
"tomlkit>=0.12.4",
33-
"numpy>=1.26.4",
34-
"mypy>=1.11.2",
35-
"pyright>=1.1.380",
36-
"mkdocs-material>=9.5.27",
37-
"mkdocstrings[python]>=0.25.1",
38-
"mkdocs-gen-files>=0.5.0",
39-
"mkdocs-literate-nav>=0.6.1",
40-
"mkdocs-minify-plugin>=0.8.0",
41-
"griffe-inherited-docstrings>=1.1.1",
42-
]
43-
44-
[tool.rye.scripts]
45-
clean = "git clean -f"
46-
release = "python scripts/release.py"
47-
"coverage:run" = "coverage run -m pytest test"
48-
"coverage:xml" = "coverage xml"
49-
"coverage:html" = "coverage html"
50-
"coverage:report" = "coverage report"
51-
"coverage:open" = "open htmlcov/index.html"
52-
"coverage:github" = { chain = [
53-
"coverage:run",
54-
"coverage:xml",
55-
"coverage:report",
56-
] }
57-
"test:all" = "pytest test"
58-
"doc:serve" = "mkdocs serve"
59-
"doc:build" = "mkdocs build"
60-
61-
6218
[tool.hatch.metadata]
6319
allow-direct-references = true
6420

@@ -104,3 +60,30 @@ dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
10460

10561
[tool.coverage.run]
10662
include = ["src/kirin/*"]
63+
64+
[tool.uv]
65+
dev-dependencies = [
66+
"black>=24.10.0",
67+
"coverage>=7.6.4",
68+
"ipython>=8.29.0",
69+
"isort>=5.13.2",
70+
"mypy>=1.13.0",
71+
"numpy>=2.1.3",
72+
"pre-commit>=4.0.1",
73+
"pyright>=1.1.388",
74+
"pytest>=8.3.3",
75+
"ruff>=0.7.3",
76+
"rust-just>=1.36.0",
77+
]
78+
79+
[dependency-groups]
80+
doc = [
81+
"griffe-inherited-docstrings>=1.1.1",
82+
"mike>=2.1.3",
83+
"mkdocs>=1.6.1",
84+
"mkdocs-gen-files>=0.5.0",
85+
"mkdocs-literate-nav>=0.6.1",
86+
"mkdocs-material>=9.5.44",
87+
"mkdocs-minify-plugin>=0.8.0",
88+
"mkdocstrings[python]>=0.27.0",
89+
]

scripts/release.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ def fail_and_revert(msg):
8686
if subprocess.run(["git", "push"]).returncode != 0:
8787
fail_and_revert("Failed to push")
8888

89-
# 1. build the package via rye
90-
print("rye build -c")
91-
if subprocess.run(["rye", "build", "-c"]).returncode != 0:
89+
# 1. build the package via uv
90+
print("uv build -c")
91+
if subprocess.run(["uv", "build", "-c"]).returncode != 0:
9292
fail_and_revert("Failed to build the package")
9393

9494
# 2. create a new release

0 commit comments

Comments
 (0)