Skip to content

Commit 6adb9de

Browse files
committed
Refactor python binding module structure
- Drop nox cause we only rely on uv and maturin - Also drop unnessesary optional-dependencies group - Make ruff & mypy happy - `slint.{slint => core}`, `slint.{__init__ => api}`
1 parent f8ece22 commit 6adb9de

File tree

16 files changed

+668
-627
lines changed

16 files changed

+668
-627
lines changed

.github/workflows/ci.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,11 @@ jobs:
203203
python-version: "3.12"
204204
- name: Install uv
205205
uses: astral-sh/setup-uv@v7
206-
- uses: fjwillemsen/[email protected]
207206
- name: Run python tests
208207
working-directory: api/python/slint
209-
run: nox --default-venv-backend uv
208+
run: uv run pytest tests
209+
env:
210+
MATURIN_PEP517_ARGS: --profile=dev
210211
- name: Run mypy
211212
working-directory: api/python/slint
212213
run: uv run mypy -p tests -p slint

api/python/slint/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ publish = false
1414
rust-version.workspace = true
1515

1616
[lib]
17+
name = "core"
1718
path = "lib.rs"
1819
crate-type = ["cdylib", "rlib"]
1920

api/python/slint/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ impl Translator for PyGettextTranslator {
159159
use pyo3::prelude::*;
160160

161161
#[pymodule(name = "core")]
162-
fn slint(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
162+
fn slint_core(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
163163
i_slint_backend_selector::with_platform(|_b| {
164164
// Nothing to do, just make sure a backend was created
165165
Ok(())

api/python/slint/noxfile.py

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

api/python/slint/pyproject.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ Repository = "https://github.com/slint-ui/slint"
3636
Changelog = "https://github.com/slint-ui/slint/blob/master/CHANGELOG.md"
3737
Tracker = "https://github.com/slint-ui/slint/issues"
3838

39-
[project.optional-dependencies]
40-
dev = ["pytest", "numpy>=2.3.2", "pillow>=11.3.0", "aiohttp>=3.12.15"]
41-
4239
[dependency-groups]
4340
dev = [
4441
"mypy>=1.15.0",
@@ -49,11 +46,13 @@ dev = [
4946
"pillow>=11.3.0",
5047
"numpy>=2.3.2",
5148
"aiohttp>=3.12.15",
49+
"maturin>=1.9.6",
5250
]
5351

5452
[tool.maturin]
5553
module-name = "slint.core"
5654
python-packages = ["slint"]
55+
features = ["pyo3/extension-module"]
5756

5857
[tool.uv]
5958
# Rebuild package when any rust files change

0 commit comments

Comments
 (0)