maturin 1.3.0__py3-none-linux_armv6l.whl → 1.5.0__py3-none-linux_armv6l.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of maturin might be problematic. Click here for more details.
- maturin/__init__.py +8 -28
- maturin/import_hook.py +5 -16
- {maturin-1.3.0.data → maturin-1.5.0.data}/scripts/maturin +0 -0
- {maturin-1.3.0.dist-info → maturin-1.5.0.dist-info}/METADATA +13 -11
- maturin-1.5.0.dist-info/RECORD +7 -0
- {maturin-1.3.0.dist-info → maturin-1.5.0.dist-info}/WHEEL +1 -1
- maturin-1.3.0.dist-info/RECORD +0 -7
maturin/__init__.py
CHANGED
|
@@ -32,16 +32,10 @@ def get_config() -> Dict[str, str]:
|
|
|
32
32
|
return pyproject_toml.get("tool", {}).get("maturin", {})
|
|
33
33
|
|
|
34
34
|
|
|
35
|
-
def get_maturin_pep517_args(
|
|
36
|
-
config_settings: Optional[Mapping[str, Any]] = None
|
|
37
|
-
) -> List[str]:
|
|
35
|
+
def get_maturin_pep517_args(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
38
36
|
build_args = config_settings.get("build-args") if config_settings else None
|
|
39
37
|
if build_args is None:
|
|
40
38
|
env_args = os.getenv("MATURIN_PEP517_ARGS", "")
|
|
41
|
-
if env_args:
|
|
42
|
-
print(
|
|
43
|
-
f"'MATURIN_PEP517_ARGS' is deprecated, use `--config-settings build-args='{env_args}'` instead."
|
|
44
|
-
)
|
|
45
39
|
args = shlex.split(env_args)
|
|
46
40
|
elif isinstance(build_args, str):
|
|
47
41
|
args = shlex.split(build_args)
|
|
@@ -91,9 +85,7 @@ def _build_wheel(
|
|
|
91
85
|
sys.stdout.buffer.write(result.stdout)
|
|
92
86
|
sys.stdout.flush()
|
|
93
87
|
if result.returncode != 0:
|
|
94
|
-
sys.stderr.write(
|
|
95
|
-
f"Error: command {command} returned non-zero exit status {result.returncode}\n"
|
|
96
|
-
)
|
|
88
|
+
sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
|
|
97
89
|
sys.exit(1)
|
|
98
90
|
output = result.stdout.decode(errors="replace")
|
|
99
91
|
wheel_path = output.strip().splitlines()[-1]
|
|
@@ -112,9 +104,7 @@ def build_wheel(
|
|
|
112
104
|
|
|
113
105
|
|
|
114
106
|
# noinspection PyUnusedLocal
|
|
115
|
-
def build_sdist(
|
|
116
|
-
sdist_directory: str, config_settings: Optional[Mapping[str, Any]] = None
|
|
117
|
-
) -> str:
|
|
107
|
+
def build_sdist(sdist_directory: str, config_settings: Optional[Mapping[str, Any]] = None) -> str:
|
|
118
108
|
command = ["maturin", "pep517", "write-sdist", "--sdist-directory", sdist_directory]
|
|
119
109
|
|
|
120
110
|
print("Running `{}`".format(" ".join(command)))
|
|
@@ -123,18 +113,14 @@ def build_sdist(
|
|
|
123
113
|
sys.stdout.buffer.write(result.stdout)
|
|
124
114
|
sys.stdout.flush()
|
|
125
115
|
if result.returncode != 0:
|
|
126
|
-
sys.stderr.write(
|
|
127
|
-
f"Error: command {command} returned non-zero exit status {result.returncode}\n"
|
|
128
|
-
)
|
|
116
|
+
sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
|
|
129
117
|
sys.exit(1)
|
|
130
118
|
output = result.stdout.decode(errors="replace")
|
|
131
119
|
return output.strip().splitlines()[-1]
|
|
132
120
|
|
|
133
121
|
|
|
134
122
|
# noinspection PyUnusedLocal
|
|
135
|
-
def get_requires_for_build_wheel(
|
|
136
|
-
config_settings: Optional[Mapping[str, Any]] = None
|
|
137
|
-
) -> List[str]:
|
|
123
|
+
def get_requires_for_build_wheel(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
138
124
|
if get_config().get("bindings") == "cffi":
|
|
139
125
|
return ["cffi"]
|
|
140
126
|
else:
|
|
@@ -147,9 +133,7 @@ def build_editable(
|
|
|
147
133
|
config_settings: Optional[Mapping[str, Any]] = None,
|
|
148
134
|
metadata_directory: Optional[str] = None,
|
|
149
135
|
) -> str:
|
|
150
|
-
return _build_wheel(
|
|
151
|
-
wheel_directory, config_settings, metadata_directory, editable=True
|
|
152
|
-
)
|
|
136
|
+
return _build_wheel(wheel_directory, config_settings, metadata_directory, editable=True)
|
|
153
137
|
|
|
154
138
|
|
|
155
139
|
# Requirements to build an editable are the same as for a wheel
|
|
@@ -157,9 +141,7 @@ get_requires_for_build_editable = get_requires_for_build_wheel
|
|
|
157
141
|
|
|
158
142
|
|
|
159
143
|
# noinspection PyUnusedLocal
|
|
160
|
-
def get_requires_for_build_sdist(
|
|
161
|
-
config_settings: Optional[Mapping[str, Any]] = None
|
|
162
|
-
) -> List[str]:
|
|
144
|
+
def get_requires_for_build_sdist(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
163
145
|
return []
|
|
164
146
|
|
|
165
147
|
|
|
@@ -170,9 +152,7 @@ def prepare_metadata_for_build_wheel(
|
|
|
170
152
|
print("Checking for Rust toolchain....")
|
|
171
153
|
is_cargo_installed = False
|
|
172
154
|
try:
|
|
173
|
-
output = subprocess.check_output(["cargo", "--version"]).decode(
|
|
174
|
-
"utf-8", "ignore"
|
|
175
|
-
)
|
|
155
|
+
output = subprocess.check_output(["cargo", "--version"]).decode("utf-8", "ignore")
|
|
176
156
|
if "cargo" in output:
|
|
177
157
|
is_cargo_installed = True
|
|
178
158
|
except (FileNotFoundError, SubprocessError):
|
maturin/import_hook.py
CHANGED
|
@@ -71,9 +71,7 @@ class Importer(abc.MetaPathFinder):
|
|
|
71
71
|
|
|
72
72
|
return None
|
|
73
73
|
|
|
74
|
-
def _build_and_load(
|
|
75
|
-
self, fullname: str, cargo_toml: pathlib.Path
|
|
76
|
-
) -> ModuleSpec | None:
|
|
74
|
+
def _build_and_load(self, fullname: str, cargo_toml: pathlib.Path) -> ModuleSpec | None:
|
|
77
75
|
build_module(cargo_toml, bindings=self.bindings)
|
|
78
76
|
loader = Loader(fullname)
|
|
79
77
|
return importlib.util.spec_from_loader(fullname, loader)
|
|
@@ -98,10 +96,7 @@ def _is_cargo_project(cargo_toml: pathlib.Path, module_name: str) -> bool:
|
|
|
98
96
|
with open(cargo_toml, "rb") as f:
|
|
99
97
|
cargo = tomllib.load(f)
|
|
100
98
|
package_name = cargo.get("package", {}).get("name")
|
|
101
|
-
if (
|
|
102
|
-
package_name == module_name
|
|
103
|
-
or package_name.replace("-", "_") == module_name
|
|
104
|
-
):
|
|
99
|
+
if package_name == module_name or package_name.replace("-", "_") == module_name:
|
|
105
100
|
return True
|
|
106
101
|
return False
|
|
107
102
|
|
|
@@ -115,9 +110,7 @@ def generate_project(rust_file: pathlib.Path, bindings: str = "pyo3") -> pathlib
|
|
|
115
110
|
command: list[str] = ["maturin", "new", "-b", bindings, str(project_dir)]
|
|
116
111
|
result = subprocess.run(command, stdout=subprocess.PIPE)
|
|
117
112
|
if result.returncode != 0:
|
|
118
|
-
sys.stderr.write(
|
|
119
|
-
f"Error: command {command} returned non-zero exit status {result.returncode}\n"
|
|
120
|
-
)
|
|
113
|
+
sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
|
|
121
114
|
raise ImportError("Failed to generate cargo project")
|
|
122
115
|
|
|
123
116
|
with open(rust_file) as f:
|
|
@@ -128,9 +121,7 @@ def generate_project(rust_file: pathlib.Path, bindings: str = "pyo3") -> pathlib
|
|
|
128
121
|
return project_dir
|
|
129
122
|
|
|
130
123
|
|
|
131
|
-
def build_module(
|
|
132
|
-
manifest_path: pathlib.Path, bindings: str | None = None, release: bool = False
|
|
133
|
-
) -> None:
|
|
124
|
+
def build_module(manifest_path: pathlib.Path, bindings: str | None = None, release: bool = False) -> None:
|
|
134
125
|
command = ["maturin", "develop", "-m", str(manifest_path)]
|
|
135
126
|
if bindings:
|
|
136
127
|
command.append("-b")
|
|
@@ -141,9 +132,7 @@ def build_module(
|
|
|
141
132
|
sys.stdout.buffer.write(result.stdout)
|
|
142
133
|
sys.stdout.flush()
|
|
143
134
|
if result.returncode != 0:
|
|
144
|
-
sys.stderr.write(
|
|
145
|
-
f"Error: command {command} returned non-zero exit status {result.returncode}\n"
|
|
146
|
-
)
|
|
135
|
+
sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
|
|
147
136
|
raise ImportError("Failed to build module with maturin")
|
|
148
137
|
|
|
149
138
|
|
|
Binary file
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: maturin
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.5.0
|
|
4
4
|
Classifier: Topic :: Software Development :: Build Tools
|
|
5
5
|
Classifier: Programming Language :: Rust
|
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
@@ -34,21 +34,23 @@ _formerly pyo3-pack_
|
|
|
34
34
|
[](https://cirrus-ci.com/github/PyO3/maturin)
|
|
35
35
|
[](https://gitter.im/PyO3/Lobby)
|
|
36
36
|
|
|
37
|
-
Build and publish crates with pyo3, rust-cpython, cffi and uniffi bindings as well as rust binaries as python packages.
|
|
38
|
-
|
|
39
|
-
This project is meant as a zero configuration replacement for [setuptools-rust](https://github.com/PyO3/setuptools-rust) and [milksnake](https://github.com/getsentry/milksnake).
|
|
40
|
-
It supports building wheels for python 3.7+ on windows, linux, mac and freebsd, can upload them to [pypi](https://pypi.org/) and has basic pypy and graalpy support.
|
|
37
|
+
Build and publish crates with pyo3, rust-cpython, cffi and uniffi bindings as well as rust binaries as python packages with minimal configuration.
|
|
38
|
+
It supports building wheels for python 3.8+ on windows, linux, mac and freebsd, can upload them to [pypi](https://pypi.org/) and has basic pypy and graalpy support.
|
|
41
39
|
|
|
42
40
|
Check out the [User Guide](https://maturin.rs/)!
|
|
43
41
|
|
|
44
42
|
## Usage
|
|
45
43
|
|
|
46
|
-
You can either download binaries from the [latest release](https://github.com/PyO3/maturin/releases/latest) or install it with
|
|
44
|
+
You can either download binaries from the [latest release](https://github.com/PyO3/maturin/releases/latest) or install it with [pipx](https://pypa.github.io/pipx/):
|
|
47
45
|
|
|
48
46
|
```shell
|
|
49
|
-
|
|
47
|
+
pipx install maturin
|
|
50
48
|
```
|
|
51
49
|
|
|
50
|
+
> [!NOTE]
|
|
51
|
+
>
|
|
52
|
+
> `pip install maturin` should also work if you don't want to use pipx.
|
|
53
|
+
|
|
52
54
|
There are four main commands:
|
|
53
55
|
|
|
54
56
|
* `maturin new` creates a new cargo project with maturin configured.
|
|
@@ -163,7 +165,7 @@ my-project
|
|
|
163
165
|
└── lib.rs
|
|
164
166
|
```
|
|
165
167
|
|
|
166
|
-
>
|
|
168
|
+
> [!NOTE]
|
|
167
169
|
>
|
|
168
170
|
> This structure is recommended to avoid [a common `ImportError` pitfall](https://github.com/PyO3/maturin/issues/490)
|
|
169
171
|
|
|
@@ -187,7 +189,7 @@ my-project
|
|
|
187
189
|
|
|
188
190
|
When doing this also be sure to set the module name in your code to match the last part of `module-name` (don't include the package path):
|
|
189
191
|
|
|
190
|
-
```
|
|
192
|
+
```rust
|
|
191
193
|
#[pymodule]
|
|
192
194
|
#[pyo3(name="_lib_name")]
|
|
193
195
|
fn my_lib_name(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
|
@@ -200,7 +202,7 @@ fn my_lib_name(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
|
|
200
202
|
## Python metadata
|
|
201
203
|
|
|
202
204
|
maturin supports [PEP 621](https://www.python.org/dev/peps/pep-0621/), you can specify python package metadata in `pyproject.toml`.
|
|
203
|
-
maturin merges metadata from `Cargo.toml` and `pyproject.toml`, `pyproject.toml`
|
|
205
|
+
maturin merges metadata from `Cargo.toml` and `pyproject.toml`, `pyproject.toml` takes precedence over `Cargo.toml`.
|
|
204
206
|
|
|
205
207
|
To specify python dependencies, add a list `dependencies` in a `[project]` section in the `pyproject.toml`. This list is equivalent to `install_requires` in setuptools:
|
|
206
208
|
|
|
@@ -210,7 +212,7 @@ name = "my-project"
|
|
|
210
212
|
dependencies = ["flask~=1.1.0", "toml==0.10.0"]
|
|
211
213
|
```
|
|
212
214
|
|
|
213
|
-
Pip allows adding so called console scripts, which are shell commands that execute some function in
|
|
215
|
+
Pip allows adding so called console scripts, which are shell commands that execute some function in your program. You can add console scripts in a section `[project.scripts]`.
|
|
214
216
|
The keys are the script names while the values are the path to the function in the format `some.module.path:class.function`, where the `class` part is optional. The function is called with no arguments. Example:
|
|
215
217
|
|
|
216
218
|
```toml
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
maturin-1.5.0.dist-info/METADATA,sha256=13ok0mHMKq_Wb8Rkx50p2ls3mNrGDUyBH7KugkSj_PE,18228
|
|
2
|
+
maturin-1.5.0.dist-info/WHEEL,sha256=iG3XR4BDvfFIvEZxG6jG9XMejD3XG92qtYZ362HJ_qg,96
|
|
3
|
+
maturin/import_hook.py,sha256=4Uwi4mBhMh3OlrWYpz2bwRU1mBG7HP2YObpo3vPcNYI,5602
|
|
4
|
+
maturin/__main__.py,sha256=4CyZAGqzmFsCl0FMlxAcG4vHFepE2lRZiPu4MKXyY4Y,987
|
|
5
|
+
maturin/__init__.py,sha256=aIJTh4e2q5Ixr3r7rZRKx6wz0iuPcGutvCqPaBCYVUA,6522
|
|
6
|
+
maturin-1.5.0.data/scripts/maturin,sha256=sMfaama17h2gmoOLFHb7LccJk9zTJbupj726DWWolwY,27588852
|
|
7
|
+
maturin-1.5.0.dist-info/RECORD,,
|
maturin-1.3.0.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
maturin-1.3.0.dist-info/METADATA,sha256=OGjAEsKlj_W2eYotEMM-f6p5sp1wG7qLv7tz0z00zaA,18256
|
|
2
|
-
maturin-1.3.0.dist-info/WHEEL,sha256=27qWxfRNIYKGuqiTmR4CVfzw1_YC-AZKadv1iE_dj34,96
|
|
3
|
-
maturin/__init__.py,sha256=QL3acPHs2FW14092hdtGXVPPWfqHpnKE0ZwAbtpfQP0,6793
|
|
4
|
-
maturin/import_hook.py,sha256=hQ4DpJrpKqYWgiElpirnGwYUxdzE0c_Vq8jKnqasbeU,5714
|
|
5
|
-
maturin/__main__.py,sha256=4CyZAGqzmFsCl0FMlxAcG4vHFepE2lRZiPu4MKXyY4Y,987
|
|
6
|
-
maturin-1.3.0.data/scripts/maturin,sha256=QOpc3vAlVn2FXKfDBGH74ltLVQMKUkGKPyLPzBzi86g,26439624
|
|
7
|
-
maturin-1.3.0.dist-info/RECORD,,
|