-
-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add integration tests for
[tool.maturin.include]
and `[tool.maturin…
….exclude]`
- Loading branch information
Showing
16 changed files
with
462 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include_this_file |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
authors = [] | ||
name = "pyo3-mixed-include-exclude" | ||
version = "2.1.3" | ||
description = "Implements a dummy function combining rust and python" | ||
edition = "2021" | ||
|
||
[dependencies] | ||
pyo3 = { version = "0.17.3", features = [ | ||
"extension-module", | ||
"generate-import-lib", | ||
] } | ||
|
||
[lib] | ||
name = "pyo3_mixed" | ||
crate-type = ["cdylib"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# pyo3-mixed-include-exclude | ||
|
||
A package for testing maturin with a mixed pyo3/python project with include and exclude configurations. | ||
|
||
## Usage | ||
|
||
```bash | ||
pip install . | ||
``` | ||
|
||
```python | ||
import pyo3_mixed_include_exclude | ||
assert pyo3_mixed_include_exclude.get_42() == 42 | ||
``` | ||
|
||
## Testing | ||
|
||
Install tox: | ||
|
||
```bash | ||
pip install tox | ||
``` | ||
|
||
Run it: | ||
|
||
```bash | ||
tox | ||
``` | ||
|
||
The tests are in `test_pyo3_mixed_include_exclude.py`, while the configuration is in tox.ini |
9 changes: 9 additions & 0 deletions
9
test-crates/pyo3-mixed-include-exclude/check_installed/check_installed.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from boltons.strutils import slugify | ||
import pyo3_mixed_include_exclude | ||
|
||
assert pyo3_mixed_include_exclude.get_42() == 42 | ||
assert slugify("First post! Hi!!!!~1 ") == "first_post_hi_1" | ||
|
||
print("SUCCESS") |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
implementation=CPython | ||
version=3.10 | ||
shared=true | ||
abi3=false | ||
suppress_build_script_link_lines=false | ||
pointer_width=64 |
6 changes: 6 additions & 0 deletions
6
test-crates/pyo3-mixed-include-exclude/pyo3_mixed_include_exclude/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from .python_module.double import double | ||
from .pyo3_mixed_include_exclude import get_21 | ||
|
||
|
||
def get_42() -> int: | ||
return double(get_21) |
Empty file.
5 changes: 5 additions & 0 deletions
5
test-crates/pyo3-mixed-include-exclude/pyo3_mixed_include_exclude/python_module/double.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
from typing import Callable | ||
|
||
|
||
def double(fn: Callable[[], int]) -> int: | ||
return 2 * fn() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[build-system] | ||
requires = ["maturin>=0.13,<0.14"] | ||
build-backend = "maturin" | ||
|
||
[project] | ||
name = "pyo3-mixed-include-exclude" | ||
classifiers = ["Programming Language :: Python", "Programming Language :: Rust"] | ||
requires-python = ">=3.7" | ||
dependencies = ["boltons"] | ||
|
||
[project.scripts] | ||
get_42 = "pyo3_mixed:get_42" | ||
|
||
[tool.maturin] | ||
include = ["include_this_file", "missing"] | ||
exclude = ["exclude_this_file", "tests/**/*", ".gitignore", "unused"] |
Oops, something went wrong.