Skip to content

Commit aa9140e

Browse files
committed
start rust conversion
1 parent 2d9685a commit aa9140e

10 files changed

Lines changed: 2846 additions & 54 deletions

File tree

.github/workflows/ci.yml

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,26 @@ jobs:
1919
- windows-latest
2020
- macos-latest
2121
python-version:
22-
- '3.7'
23-
- '3.8'
24-
- '3.9'
2522
- '3.10'
2623
- '3.11'
2724
- '3.12'
25+
- '3.13'
26+
- '3.14'
2827
runs-on: "${{ matrix.os }}"
2928
continue-on-error: false
3029
steps:
31-
- uses: actions/checkout@v3
32-
- uses: actions/setup-python@v4
33-
with:
34-
python-version: "${{ matrix.python-version }}"
35-
- name: install dependencies
36-
run: |
37-
python -m pip install --upgrade pip setuptools wheel
38-
pip install flit
39-
flit install --extras=all
30+
- uses: actions/checkout@v4
31+
- name: Install Rust toolchain
32+
uses: dtolnay/rust-toolchain@stable
33+
- name: Install uv
34+
uses: astral-sh/setup-uv@v2
35+
- name: Install GNU make (Windows)
36+
if: runner.os == 'Windows'
37+
run: choco install make -y
38+
- name: Sync project environment
39+
run: uv sync --all-groups --python "${{ matrix.python-version }}"
4040
- name: lint and test
41-
run: make ci
42-
- name: Inclusiveness Analyzer
43-
uses: microsoft/InclusivenessAnalyzer@main
44-
with:
45-
excludeTerms: master
41+
run: uv run make ci
4642
- name: upload coverage to codecov
4743
uses: codecov/codecov-action@v3
4844
with:
@@ -53,22 +49,18 @@ jobs:
5349
ruff:
5450
runs-on: ubuntu-latest
5551
steps:
56-
- uses: actions/checkout@v3
57-
- run: pip install --user ruff
58-
- run: ruff --format=github .
52+
- uses: actions/checkout@v4
53+
- uses: astral-sh/setup-uv@v2
54+
- run: uv tool run ruff --format=github .
5955

6056
pyright:
6157
runs-on: ubuntu-latest
6258
steps:
63-
- uses: actions/checkout@v3
64-
- uses: actions/setup-python@v4
65-
with:
66-
python-version: 3.11
67-
- name: install dependencies
68-
run: |
69-
python -m pip install --upgrade pip setuptools wheel
70-
pip install flit
71-
flit install --extras=all
72-
- uses: jakebailey/pyright-action@v1
73-
with:
74-
working-directory: .
59+
- uses: actions/checkout@v4
60+
- uses: dtolnay/rust-toolchain@stable
61+
- uses: astral-sh/setup-uv@v2
62+
- name: Sync project environment
63+
run: uv sync --all-groups --python 3.11
64+
- uses: jakebailey/pyright-action@v1
65+
with:
66+
working-directory: .

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,9 @@ docs/_build/
6565
# PyBuilder
6666
target/
6767

68+
# Rust builds
69+
rust/target/
70+
6871
# Jupyter Notebook
6972
.ipynb_checkpoints
7073

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ SHELL:=/usr/bin/env bash
22

33

44
build:
5-
flit build
5+
maturin build --release
66

77
install:
8-
flit install
8+
maturin develop
99

1010
extract_messages:
1111
find src/wily -iname "*.py" | xargs xgettext -o src/wily/locales/messages.pot

pyproject.toml

Lines changed: 43 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[build-system]
2-
requires = ["flit_core>=2,<4"]
3-
build-backend = "flit_core.buildapi"
2+
requires = ["maturin>=1.10,<2.0"]
3+
build-backend = "maturin"
44

55
[project]
66
name = "wily"
@@ -32,7 +32,7 @@ dependencies = [
3232
"progress>=1.4,<2.0",
3333
"dataclasses; python_version == '3.6'",
3434
]
35-
requires-python = ">=3.6"
35+
requires-python = ">=3.9"
3636
dynamic=["version", "description"]
3737

3838
[project.optional-dependencies]
@@ -41,14 +41,42 @@ test = [
4141
"pytest-cov~=4.1.0",
4242
]
4343
dev = [
44+
"maturin>=1.10,<2.0",
4445
"black~=22.6.0",
4546
"codespell[toml]",
4647
"mypy~=0.961",
4748
"ruff~=0.0.277",
4849
"safety~=2.3.4",
4950
]
50-
# TODO: move here proper deps from `docs/requirements_docs.txt`
51-
doc = []
51+
doc = [
52+
"sphinx>=7.0,<9.0",
53+
"sphinx-click>=5.1,<6.0",
54+
"urllib3>=2.5.0",
55+
]
56+
57+
[dependency-groups]
58+
lint = [
59+
"black~=22.6.0",
60+
"codespell[toml]",
61+
"mypy~=0.961",
62+
"ruff~=0.0.277",
63+
"safety~=2.3.4",
64+
]
65+
test = [
66+
"pytest~=7.2",
67+
"pytest-cov~=4.1.0",
68+
]
69+
docs = [
70+
"sphinx>=7.0,<9.0",
71+
"sphinx-click>=5.1,<6.0",
72+
"urllib3>=2.5.0",
73+
]
74+
dev = [
75+
"maturin>=1.5,<2.0",
76+
{ include-group = "lint" },
77+
{ include-group = "test" },
78+
{ include-group = "docs" },
79+
]
5280

5381
[project.urls]
5482
Homepage = "https://github.com/tonybaloney/wily"
@@ -57,9 +85,16 @@ Documentation = "https://wily.readthedocs.io/en/latest/"
5785
[project.scripts]
5886
wily = "wily.__main__:cli"
5987

60-
[tool.flit.sdist]
61-
include = ["doc/"]
62-
exclude = ["doc/*.html"]
88+
89+
[tool.maturin]
90+
bindings = "pyo3"
91+
manifest-path = "rust/Cargo.toml"
92+
module-name = "wily._rust"
93+
python-source = "src"
94+
95+
[tool.uv]
96+
package = true
97+
default-groups = ["dev"]
6398

6499
[tool.black]
65100
extend-exclude = '''

0 commit comments

Comments
 (0)