Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ jobs:
run: python -m pip install ${{ matrix.dependencies }}
if: ${{ matrix.dependencies }}

- name: Set up Rust compiler
run: rustup override set nightly

- name: Install
run: python -m pip install . --group test

Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,10 @@ def __init__(self, source_dir, build_dir, meson_args=None, editable_verbose=None
# keeps working.
'link-against-local-lib',

# The ``rust-pyo3`` package bumps into this Meson
# warning: ``WARNING: Library entry portable_atomic
# has unexpected keys "doc-scrape-examples"``.
'rust-pyo3',
}:
if meson_args is None:
meson_args = {}
Expand Down
132 changes: 132 additions & 0 deletions tests/packages/rust-pyo3/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions tests/packages/rust-pyo3/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# SPDX-FileCopyrightText: 2026 The meson-python developers
#
# SPDX-License-Identifier: MIT

[package]
name = "rust-pyo3"
version = "1.0.0"
edition = "2024"

[lib]
name = "rust_pyo3"
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.29.0"
17 changes: 17 additions & 0 deletions tests/packages/rust-pyo3/meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# SPDX-FileCopyrightText: 2026 The meson-python developers
#
# SPDX-License-Identifier: MIT

project('rust-pyo3', 'c', 'rust', version: '1.0.0', meson_version: '>= 1.12.0', default_options: ['rust_std=2024'])

py = import('python').find_installation(pure: false)
pkg = import('rust').workspace().package()

py.extension_module(
'rust_pyo3',
'src/lib.rs',
rust_dependency_map : pkg.rust_dependency_map(),
rust_args: pkg.rust_args(),
dependencies : pkg.dependencies(),
install: true,
)
10 changes: 10 additions & 0 deletions tests/packages/rust-pyo3/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2021 The meson-python developers
#
# SPDX-License-Identifier: MIT

[build-system]
build-backend = "mesonpy"
requires = ["meson-python"]

[tool.meson-python.args]
setup = ['--vsenv']
16 changes: 16 additions & 0 deletions tests/packages/rust-pyo3/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// SPDX-FileCopyrightText: 2026 The meson-python developers
//
// SPDX-License-Identifier: MIT

use pyo3::prelude::*;

#[pymodule]
mod rust_pyo3 {
use pyo3::prelude::*;

/// Sum two numbers.
#[pyfunction]
fn sum(a: i64, b: i64) -> PyResult<i64> {
Ok(a + b)
}
}
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extra_args += cargo_ws.subproject('pyo3-ffi', pkg_obj.api(), native: false).dependency().get_variable('args').split('\0')
Loading
Loading