maturin 0.14.17__py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl → 0.15.1__py3-none-manylinux_2_17_s390x.manylinux2014_s390x.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 CHANGED
@@ -8,21 +8,22 @@ On windows, apparently pip's subprocess handling sets stdout to some windows enc
8
8
  even though the terminal supports utf8. Writing directly to the binary stdout buffer avoids encoding errors due to
9
9
  maturin's emojis.
10
10
  """
11
+ from __future__ import annotations
11
12
 
12
13
  import os
13
14
  import platform
14
15
  import shlex
15
16
  import shutil
17
+ import struct
16
18
  import subprocess
17
19
  import sys
18
- import struct
19
20
  from subprocess import SubprocessError
20
- from typing import Dict
21
+ from typing import Any, Dict, Mapping
21
22
 
22
23
  try:
23
24
  import tomllib
24
25
  except ModuleNotFoundError:
25
- import tomli as tomllib
26
+ import tomli as tomllib # type: ignore
26
27
 
27
28
 
28
29
  def get_config() -> Dict[str, str]:
@@ -31,12 +32,12 @@ def get_config() -> Dict[str, str]:
31
32
  return pyproject_toml.get("tool", {}).get("maturin", {})
32
33
 
33
34
 
34
- def get_maturin_pep517_args():
35
+ def get_maturin_pep517_args() -> list[str]:
35
36
  args = shlex.split(os.getenv("MATURIN_PEP517_ARGS", ""))
36
37
  return args
37
38
 
38
39
 
39
- def _additional_pep517_args():
40
+ def _additional_pep517_args() -> list[str]:
40
41
  # Support building for 32-bit Python on x64 Windows
41
42
  if platform.system().lower() == "windows" and platform.machine().lower() == "amd64":
42
43
  pointer_width = struct.calcsize("P") * 8
@@ -47,8 +48,11 @@ def _additional_pep517_args():
47
48
 
48
49
  # noinspection PyUnusedLocal
49
50
  def _build_wheel(
50
- wheel_directory, config_settings=None, metadata_directory=None, editable=False
51
- ):
51
+ wheel_directory: str,
52
+ config_settings: Mapping[str, Any] | None = None,
53
+ metadata_directory: str | None = None,
54
+ editable: bool = False,
55
+ ) -> str:
52
56
  # PEP 517 specifies that only `sys.executable` points to the correct
53
57
  # python interpreter
54
58
  command = [
@@ -86,12 +90,18 @@ def _build_wheel(
86
90
 
87
91
 
88
92
  # noinspection PyUnusedLocal
89
- def build_wheel(wheel_directory, config_settings=None, metadata_directory=None):
93
+ def build_wheel(
94
+ wheel_directory: str,
95
+ config_settings: Mapping[str, Any] | None = None,
96
+ metadata_directory: str | None = None,
97
+ ) -> str:
90
98
  return _build_wheel(wheel_directory, config_settings, metadata_directory)
91
99
 
92
100
 
93
101
  # noinspection PyUnusedLocal
94
- def build_sdist(sdist_directory, config_settings=None):
102
+ def build_sdist(
103
+ sdist_directory: str, config_settings: Mapping[str, Any] | None = None
104
+ ) -> str:
95
105
  command = ["maturin", "pep517", "write-sdist", "--sdist-directory", sdist_directory]
96
106
 
97
107
  print("Running `{}`".format(" ".join(command)))
@@ -109,7 +119,9 @@ def build_sdist(sdist_directory, config_settings=None):
109
119
 
110
120
 
111
121
  # noinspection PyUnusedLocal
112
- def get_requires_for_build_wheel(config_settings=None):
122
+ def get_requires_for_build_wheel(
123
+ config_settings: Mapping[str, Any] | None = None
124
+ ) -> list[str]:
113
125
  if get_config().get("bindings") == "cffi":
114
126
  return ["cffi"]
115
127
  else:
@@ -117,7 +129,11 @@ def get_requires_for_build_wheel(config_settings=None):
117
129
 
118
130
 
119
131
  # noinspection PyUnusedLocal
120
- def build_editable(wheel_directory, config_settings=None, metadata_directory=None):
132
+ def build_editable(
133
+ wheel_directory: str,
134
+ config_settings: Mapping[str, Any] | None = None,
135
+ metadata_directory: str | None = None,
136
+ ) -> str:
121
137
  return _build_wheel(
122
138
  wheel_directory, config_settings, metadata_directory, editable=True
123
139
  )
@@ -128,12 +144,16 @@ get_requires_for_build_editable = get_requires_for_build_wheel
128
144
 
129
145
 
130
146
  # noinspection PyUnusedLocal
131
- def get_requires_for_build_sdist(config_settings=None):
147
+ def get_requires_for_build_sdist(
148
+ config_settings: Mapping[str, Any] | None = None
149
+ ) -> list:
132
150
  return []
133
151
 
134
152
 
135
153
  # noinspection PyUnusedLocal
136
- def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
154
+ def prepare_metadata_for_build_wheel(
155
+ metadata_directory: str, config_settings: Mapping[str, Any] | None = None
156
+ ) -> str:
137
157
  print("Checking for Rust toolchain....")
138
158
  is_cargo_installed = False
139
159
  try:
@@ -171,13 +191,13 @@ def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None):
171
191
 
172
192
  print("Running `{}`".format(" ".join(command)))
173
193
  try:
174
- output = subprocess.check_output(command)
194
+ _output = subprocess.check_output(command)
175
195
  except subprocess.CalledProcessError as e:
176
196
  sys.stderr.write(f"Error running maturin: {e}\n")
177
197
  sys.exit(1)
178
- sys.stdout.buffer.write(output)
198
+ sys.stdout.buffer.write(_output)
179
199
  sys.stdout.flush()
180
- output = output.decode(errors="replace")
200
+ output = _output.decode(errors="replace")
181
201
  return output.strip().splitlines()[-1]
182
202
 
183
203
 
maturin/__main__.py CHANGED
@@ -1,17 +1,18 @@
1
+ from __future__ import annotations
2
+
1
3
  import os
2
4
  import sys
3
5
  from pathlib import Path
4
6
  import sysconfig
5
- from typing import Optional
6
7
 
7
8
 
8
- def get_maturin_path() -> Optional[Path]:
9
+ def get_maturin_path() -> Path | None:
9
10
  SCRIPT_NAME = "maturin"
10
11
 
11
- def script_dir(scheme: str) -> Path:
12
+ def script_dir(scheme: str) -> str:
12
13
  return sysconfig.get_path("scripts", scheme)
13
14
 
14
- def script_exists(dir: Path) -> bool:
15
+ def script_exists(dir: str) -> bool:
15
16
  for _, _, files in os.walk(dir):
16
17
  for f in files:
17
18
  name, *_ = os.path.splitext(f)
maturin/import_hook.py CHANGED
@@ -1,31 +1,39 @@
1
+ from __future__ import annotations
2
+
1
3
  import contextlib
2
4
  import importlib
3
5
  import importlib.util
4
- from importlib import abc
5
- from importlib.machinery import ModuleSpec
6
6
  import os
7
7
  import pathlib
8
8
  import shutil
9
- import sys
10
9
  import subprocess
11
- from typing import Optional
10
+ import sys
11
+ from importlib import abc
12
+ from importlib.machinery import ModuleSpec
13
+ from types import ModuleType
14
+ from typing import Sequence
12
15
 
13
16
  try:
14
17
  import tomllib
15
18
  except ModuleNotFoundError:
16
- import tomli as tomllib
19
+ import tomli as tomllib # type: ignore
17
20
 
18
21
 
19
22
  class Importer(abc.MetaPathFinder):
20
23
  """A meta-path importer for the maturin based packages"""
21
24
 
22
- def __init__(self, bindings: Optional[str] = None, release: bool = False):
25
+ def __init__(self, bindings: str | None = None, release: bool = False):
23
26
  self.bindings = bindings
24
27
  self.release = release
25
28
 
26
- def find_spec(self, fullname, path, target=None):
29
+ def find_spec(
30
+ self,
31
+ fullname: str,
32
+ path: Sequence[str | bytes] | None = None,
33
+ target: ModuleType | None = None,
34
+ ) -> ModuleSpec | None:
27
35
  if fullname in sys.modules:
28
- return
36
+ return None
29
37
  mod_parts = fullname.split(".")
30
38
  module_name = mod_parts[-1]
31
39
 
@@ -51,17 +59,21 @@ class Importer(abc.MetaPathFinder):
51
59
  cargo_toml = project_dir / "Cargo.toml"
52
60
  return self._build_and_load(fullname, cargo_toml)
53
61
 
54
- def _build_and_load(self, fullname: str, cargo_toml: pathlib.Path) -> ModuleSpec:
62
+ return None
63
+
64
+ def _build_and_load(
65
+ self, fullname: str, cargo_toml: pathlib.Path
66
+ ) -> ModuleSpec | None:
55
67
  build_module(cargo_toml, bindings=self.bindings)
56
68
  loader = Loader(fullname)
57
69
  return importlib.util.spec_from_loader(fullname, loader)
58
70
 
59
71
 
60
72
  class Loader(abc.Loader):
61
- def __init__(self, fullname):
73
+ def __init__(self, fullname: str):
62
74
  self.fullname = fullname
63
75
 
64
- def load_module(self, fullname):
76
+ def load_module(self, fullname: str) -> ModuleType:
65
77
  return importlib.import_module(self.fullname)
66
78
 
67
79
 
@@ -84,7 +96,7 @@ def generate_project(rust_file: pathlib.Path, bindings: str = "pyo3") -> pathlib
84
96
  if project_dir.exists():
85
97
  shutil.rmtree(project_dir)
86
98
 
87
- command = ["maturin", "new", "-b", bindings, project_dir]
99
+ command: list[str] = ["maturin", "new", "-b", bindings, str(project_dir)]
88
100
  result = subprocess.run(command, stdout=subprocess.PIPE)
89
101
  if result.returncode != 0:
90
102
  sys.stderr.write(
@@ -101,9 +113,9 @@ def generate_project(rust_file: pathlib.Path, bindings: str = "pyo3") -> pathlib
101
113
 
102
114
 
103
115
  def build_module(
104
- manifest_path: pathlib.Path, bindings: Optional[str] = None, release: bool = False
105
- ):
106
- command = ["maturin", "develop", "-m", manifest_path]
116
+ manifest_path: pathlib.Path, bindings: str | None = None, release: bool = False
117
+ ) -> None:
118
+ command = ["maturin", "develop", "-m", str(manifest_path)]
107
119
  if bindings:
108
120
  command.append("-b")
109
121
  command.append(bindings)
@@ -126,7 +138,7 @@ def _have_importer() -> bool:
126
138
  return False
127
139
 
128
140
 
129
- def install(bindings: Optional[str] = None, release: bool = False):
141
+ def install(bindings: str | None = None, release: bool = False) -> Importer | None:
130
142
  """
131
143
  Install the import hook.
132
144
 
@@ -136,13 +148,13 @@ def install(bindings: Optional[str] = None, release: bool = False):
136
148
  :param release: Build in release mode, otherwise debug mode by default
137
149
  """
138
150
  if _have_importer():
139
- return
151
+ return None
140
152
  importer = Importer(bindings=bindings, release=release)
141
153
  sys.meta_path.append(importer)
142
154
  return importer
143
155
 
144
156
 
145
- def uninstall(importer: Importer):
157
+ def uninstall(importer: Importer) -> None:
146
158
  """
147
159
  Uninstall the import hook.
148
160
  """
@@ -1,12 +1,12 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: maturin
3
- Version: 0.14.17
3
+ Version: 0.15.1
4
4
  Classifier: Topic :: Software Development :: Build Tools
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
7
7
  Classifier: Programming Language :: Python :: Implementation :: PyPy
8
- Requires-Dist: tomli >= 1.1.0 ; python_version < '3.11'
9
- Requires-Dist: ziglang ~= 0.10.0 ; extra == 'zig'
8
+ Requires-Dist: tomli >=1.1.0 ; python_version < '3.11'
9
+ Requires-Dist: ziglang ~=0.10.0 ; extra == 'zig'
10
10
  Requires-Dist: patchelf ; extra == 'patchelf'
11
11
  Provides-Extra: zig
12
12
  Provides-Extra: patchelf
@@ -16,7 +16,7 @@ Home-Page: https://github.com/pyo3/maturin
16
16
  Author: konstin <konstin@mailbox.org>, messense <messense@icloud.com>
17
17
  Author-email: konstin <konstin@mailbox.org>, messense <messense@icloud.com>
18
18
  License: MIT OR Apache-2.0
19
- Requires-Python: >= 3.7
19
+ Requires-Python: >=3.7
20
20
  Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
21
21
  Project-URL: Source Code, https://github.com/PyO3/maturin
22
22
  Project-URL: Issues, https://github.com/PyO3/maturin/issues
@@ -164,6 +164,7 @@ my-project
164
164
  ```
165
165
 
166
166
  > **Note**
167
+ >
167
168
  > This structure is recommended to avoid [a common `ImportError` pitfall](https://github.com/PyO3/maturin/issues/490)
168
169
 
169
170
  maturin will add the native extension as a module in your python folder. When using develop, maturin will copy the native library and for cffi also the glue code to your python folder. You should add those files to your gitignore.
@@ -205,7 +206,7 @@ The keys are the script names while the values are the path to the function in t
205
206
  get_42 = "my_project:DummyClass.get_42"
206
207
  ```
207
208
 
208
- You can also specify [trove classifiers](https://pypi.org/classifiers/) in your Cargo.toml under `project.classifiers`:
209
+ You can also specify [trove classifiers](https://pypi.org/classifiers/) in your `pyproject.toml` under `project.classifiers`:
209
210
 
210
211
  ```toml
211
212
  [project]
@@ -0,0 +1,7 @@
1
+ maturin-0.15.1.dist-info/METADATA,sha256=TaFtxobvSBAvw7h6QJfyKWLWt-6bNura2O7aDs4UAE8,17753
2
+ maturin-0.15.1.dist-info/WHEEL,sha256=lkEbBBNKltfxfYjmo9uuymhSBcX2U-86PF05Q_gj9fg,131
3
+ maturin/__main__.py,sha256=hDlP-5HIi0cJ_glQYNPENWOtOb5Hh7TMDeCIos5mPX8,956
4
+ maturin/__init__.py,sha256=PIXDyJHtVGdXe2OzmNYudC0s4Z1d7OIBv-yvq7sLiqs,6236
5
+ maturin/import_hook.py,sha256=ZuSpyCxJ7j_vw2KW4SoyHWQeaxQDo8dl6XsN9BAUZWk,5162
6
+ maturin-0.15.1.data/scripts/maturin,sha256=FdTb9Nb6a-fVyTtAt6b3jJP5UDFutL6kYP-juSYBb4E,31836808
7
+ maturin-0.15.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.0.0-beta.7)
2
+ Generator: maturin (1.0.0-beta.9)
3
3
  Root-Is-Purelib: false
4
4
  Tag: py3-none-manylinux_2_17_s390x.manylinux2014_s390x
@@ -1,7 +0,0 @@
1
- maturin-0.14.17.dist-info/METADATA,sha256=Qt0ksLm4_X4_E8UkadcD976rRJa6DPyKYqLgU98gLDs,17749
2
- maturin-0.14.17.dist-info/WHEEL,sha256=XCycZvuzWC9oXXMXG51hIWS3JAzD4EM_8Zsp5EhkNo8,131
3
- maturin/import_hook.py,sha256=yg1ffV6WFRncQ6iUXPFDFMscZkwE9E-BbqEvxRtUjYg,4835
4
- maturin/__init__.py,sha256=b6BRnt-3sJXjk9Leh9gOrM-tg4dLonFL-zz1d7Qg1Pg,5748
5
- maturin/__main__.py,sha256=5Drhx-fkJD3t8fT69IZhaQR12lSaZu81ck-oBbm6Uj0,953
6
- maturin-0.14.17.data/scripts/maturin,sha256=R1mSsPEe_hl4VOTXVxwTqGwPKigv7bexd_OfNrH5PL8,35842440
7
- maturin-0.14.17.dist-info/RECORD,,