Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vendor Rust crates into source distributions #49

Merged
merged 2 commits into from
Jun 6, 2024
Merged
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
24 changes: 24 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
rust-version:
# RHEL 9.4 has rustc 1.75
- "1.75"

steps:
- name: Get source
Expand All @@ -26,12 +29,23 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set up Rust ${{ matrix.rust-version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-version }}
default: true
override: true

- name: Install dependencies
run: python -m pip install tox

- name: Run tests
run: tox -e py

- name: Run tests for pyo3_test
working-directory: ./e2e/pyo3_test/
run: tox -e py

e2e:
name: e2e
runs-on: ubuntu-latest
Expand All @@ -43,6 +57,9 @@ jobs:
- "3.10"
- "3.11"
- "3.12"
rust-version:
# RHEL 9.4 has rustc 1.75
- "1.75"
test-script:
- bootstrap
- report_missing_dependency
Expand All @@ -58,6 +75,13 @@ jobs:
with:
python-version: ${{ matrix.python-version }}

- name: Set up Rust ${{ matrix.rust-version }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust-version }}
default: true
override: true

- name: Install dependencies
run: python -m pip install tox

Expand Down
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,8 @@ __pycache__/
/package.json
/e2e-output/
/dist/
/e2e/pyo3_test/.cargo
/e2e/pyo3_test/build
/e2e/pyo3_test/dist
/e2e/pyo3_test/target
/e2e/pyo3_test/vendor
295 changes: 295 additions & 0 deletions e2e/pyo3_test/Cargo.lock

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

12 changes: 12 additions & 0 deletions e2e/pyo3_test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[package]
name = "pyo3_test"
version = "1.0.0"
edition = "2021"

[dependencies]
pyo3 = { version = "0.21.2", features = ["gil-refs"] }

[lib]
name = "_lib"
crate-type = ["cdylib"]
path = "rust/lib.rs"
4 changes: 4 additions & 0 deletions e2e/pyo3_test/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
graft python
graft rust
include Cargo.toml Cargo.lock tests.py tox.ini
exclude .cargo vendor
13 changes: 13 additions & 0 deletions e2e/pyo3_test/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[build-system]
requires = ["setuptools", "setuptools-rust"]
build-backend = "setuptools.build_meta"

[project]
name = "pyo3_test"
version = "1.0.0"

[tool.setuptools.packages]
find = { where = ["python"] }

[[tool.setuptools-rust.ext-modules]]
target = "pyo3_test._lib"
3 changes: 3 additions & 0 deletions e2e/pyo3_test/python/pyo3_test/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from ._lib import add

__all__ = ["add"]
Loading
Loading