-
-
Notifications
You must be signed in to change notification settings - Fork 277
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
395 additions
and
5 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
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
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
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,17 @@ | ||
[package] | ||
authors = ["konstin <[email protected]>"] | ||
name = "pyo3-mixed-py-subdir" | ||
version = "2.1.3" | ||
description = "Implements a dummy function combining rust and python" | ||
readme = "Readme.md" | ||
edition = "2018" | ||
|
||
[dependencies] | ||
pyo3 = { version = "0.14.0", features = ["extension-module"] } | ||
|
||
[lib] | ||
name = "pyo3_mixed_py_subdir" | ||
crate-type = ["cdylib"] | ||
|
||
[package.metadata.maturin] | ||
python-source = "python" |
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 | ||
|
||
A package for testing maturin with a mixed pyo3/python project. | ||
|
||
## Usage | ||
|
||
```bash | ||
pip install . | ||
``` | ||
|
||
```python | ||
import pyo3_mixed | ||
assert pyo3_mixed.get_42() == 42 | ||
``` | ||
|
||
## Testing | ||
|
||
Install tox: | ||
|
||
```bash | ||
pip install tox | ||
``` | ||
|
||
Run it: | ||
|
||
```bash | ||
tox | ||
``` | ||
|
||
The tests are in `test_pyo3_mixed.py`, while the configuration is in tox.ini |
7 changes: 7 additions & 0 deletions
7
test-crates/pyo3-mixed-py-subdir/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,7 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import pyo3_mixed_py_subdir as pyo3_mixed | ||
|
||
assert pyo3_mixed.get_42() == 42 | ||
|
||
print("SUCCESS") |
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,14 @@ | ||
[build-system] | ||
requires = ["maturin>=0.11,<0.12"] | ||
build-backend = "maturin" | ||
|
||
[project] | ||
name = "pyo3-mixed-py-subdir" | ||
classifiers = [ | ||
"Programming Language :: Python", | ||
"Programming Language :: Rust" | ||
] | ||
requires-python = ">=3.6" | ||
|
||
[project.scripts] | ||
get_42 = "pyo3_mixed_py_subdir:get_42" |
6 changes: 6 additions & 0 deletions
6
test-crates/pyo3-mixed-py-subdir/python/pyo3_mixed_py_subdir/__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_py_subdir import get_21 | ||
|
||
|
||
def get_42() -> int: | ||
return double(get_21) |
Empty file.
5 changes: 5 additions & 0 deletions
5
test-crates/pyo3-mixed-py-subdir/python/pyo3_mixed_py_subdir/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() |
Oops, something went wrong.