maturin 1.8.3__py3-none-macosx_10_12_x86_64.whl → 1.8.6__py3-none-macosx_10_12_x86_64.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
@@ -34,7 +34,10 @@ def get_config() -> Dict[str, str]:
34
34
 
35
35
 
36
36
  def get_maturin_pep517_args(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
37
- build_args = config_settings.get("build-args") if config_settings else None
37
+ build_args = None
38
+ if config_settings:
39
+ # TODO: Deprecate and remove build-args in favor of maturin.build-args in maturin 2.0
40
+ build_args = config_settings.get("maturin.build-args", config_settings.get("build-args"))
38
41
  if build_args is None:
39
42
  env_args = os.getenv("MATURIN_PEP517_ARGS", "")
40
43
  args = shlex.split(env_args)
@@ -65,6 +68,17 @@ def _additional_pep517_args() -> List[str]:
65
68
  return []
66
69
 
67
70
 
71
+ def _get_env() -> Optional[Dict[str, str]]:
72
+ if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
73
+ from puccinialin import setup_rust
74
+
75
+ print("Rust not found, installing into a temporary directory")
76
+ extra_env = setup_rust()
77
+ return {**os.environ, **extra_env}
78
+ else:
79
+ return None
80
+
81
+
68
82
  # noinspection PyUnusedLocal
69
83
  def _build_wheel(
70
84
  wheel_directory: str,
@@ -97,7 +111,7 @@ def _build_wheel(
97
111
 
98
112
  print("Running `{}`".format(" ".join(command)))
99
113
  sys.stdout.flush()
100
- result = subprocess.run(command, stdout=subprocess.PIPE)
114
+ result = subprocess.run(command, stdout=subprocess.PIPE, env=_get_env())
101
115
  sys.stdout.buffer.write(result.stdout)
102
116
  sys.stdout.flush()
103
117
  if result.returncode != 0:
@@ -125,7 +139,7 @@ def build_sdist(sdist_directory: str, config_settings: Optional[Mapping[str, Any
125
139
 
126
140
  print("Running `{}`".format(" ".join(command)))
127
141
  sys.stdout.flush()
128
- result = subprocess.run(command, stdout=subprocess.PIPE)
142
+ result = subprocess.run(command, stdout=subprocess.PIPE, env=_get_env())
129
143
  sys.stdout.buffer.write(result.stdout)
130
144
  sys.stdout.flush()
131
145
  if result.returncode != 0:
@@ -138,9 +152,12 @@ def build_sdist(sdist_directory: str, config_settings: Optional[Mapping[str, Any
138
152
  # noinspection PyUnusedLocal
139
153
  def get_requires_for_build_wheel(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
140
154
  if get_config().get("bindings") == "cffi":
141
- return ["cffi"]
155
+ requirements = ["cffi"]
142
156
  else:
143
- return []
157
+ requirements = []
158
+ if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
159
+ requirements += ["puccinialin"]
160
+ return requirements
144
161
 
145
162
 
146
163
  # noinspection PyUnusedLocal
@@ -158,7 +175,10 @@ get_requires_for_build_editable = get_requires_for_build_wheel
158
175
 
159
176
  # noinspection PyUnusedLocal
160
177
  def get_requires_for_build_sdist(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
161
- return []
178
+ requirements = []
179
+ if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
180
+ requirements += ["puccinialin"]
181
+ return requirements
162
182
 
163
183
 
164
184
  # noinspection PyUnusedLocal
@@ -168,7 +188,7 @@ def prepare_metadata_for_build_wheel(
168
188
  print("Checking for Rust toolchain....")
169
189
  is_cargo_installed = False
170
190
  try:
171
- output = subprocess.check_output(["cargo", "--version"]).decode("utf-8", "ignore")
191
+ output = subprocess.check_output(["cargo", "--version"], env=_get_env()).decode("utf-8", "ignore")
172
192
  if "cargo" in output:
173
193
  is_cargo_installed = True
174
194
  except (FileNotFoundError, SubprocessError):
@@ -200,7 +220,7 @@ def prepare_metadata_for_build_wheel(
200
220
 
201
221
  print("Running `{}`".format(" ".join(command)))
202
222
  try:
203
- _output = subprocess.check_output(command)
223
+ _output = subprocess.check_output(command, env=_get_env())
204
224
  except subprocess.CalledProcessError as e:
205
225
  sys.stderr.write(f"Error running maturin: {e}\n")
206
226
  sys.exit(1)
maturin/bootstrap.py ADDED
@@ -0,0 +1,31 @@
1
+ """Support installing rust before compiling (bootstrapping) maturin.
2
+
3
+ Installing a package that uses maturin as build backend on a platform without maturin
4
+ binaries, we install rust in a cache directory if the user doesn't have a rust
5
+ installation already. Since this bootstrapping requires more dependencies but is only
6
+ required if rust is missing, we check if cargo is present before requesting those
7
+ dependencies.
8
+
9
+ https://setuptools.pypa.io/en/stable/build_meta.html#dynamic-build-dependencies-and-other-build-meta-tweaks
10
+ """
11
+
12
+ from __future__ import annotations
13
+
14
+ import os
15
+ import shutil
16
+ from typing import Any
17
+
18
+ # noinspection PyUnresolvedReferences
19
+ from setuptools.build_meta import * # noqa:F403
20
+
21
+
22
+ def get_requires_for_build_wheel(_config_settings: dict[str, Any] | None = None) -> list[str]:
23
+ if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
24
+ return ["puccinialin>=0.1,<0.2"]
25
+ return []
26
+
27
+
28
+ def get_requires_for_build_sdist(_config_settings: dict[str, Any] | None = None) -> list[str]:
29
+ if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
30
+ return ["puccinialin>=0.1,<0.2"]
31
+ return []
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: maturin
3
- Version: 1.8.3
3
+ Version: 1.8.6
4
4
  Classifier: Topic :: Software Development :: Build Tools
5
5
  Classifier: Programming Language :: Rust
6
6
  Classifier: Programming Language :: Python :: Implementation :: CPython
@@ -30,9 +30,7 @@ _formerly pyo3-pack_
30
30
  [![Maturin User Guide](https://img.shields.io/badge/user-guide-brightgreen?logo=readthedocs&style=flat-square)](https://maturin.rs)
31
31
  [![Crates.io](https://img.shields.io/crates/v/maturin.svg?logo=rust&style=flat-square)](https://crates.io/crates/maturin)
32
32
  [![PyPI](https://img.shields.io/pypi/v/maturin.svg?logo=python&style=flat-square)](https://pypi.org/project/maturin)
33
- [![Actions Status](https://github.com/PyO3/maturin/actions/workflows/test.yml/badge.svg)](https://github.com/PyO3/maturin/actions)
34
- [![FreeBSD](https://img.shields.io/cirrus/github/PyO3/maturin/main?logo=CircleCI&style=flat-square)](https://cirrus-ci.com/github/PyO3/maturin)
35
- [![discord server](https://img.shields.io/discord/1209263839632424990?logo=discord)](https://discord.gg/33kcChzH7f)
33
+ [![discord server](https://img.shields.io/discord/1209263839632424990?logo=discord&style=flat-square)](https://discord.gg/33kcChzH7f)
36
34
 
37
35
  Build and publish crates with [pyo3, cffi and uniffi bindings](https://maturin.rs/bindings) as well as rust binaries as python packages with minimal configuration.
38
36
  It supports building wheels for python 3.8+ on Windows, Linux, macOS and FreeBSD, can upload them to [pypi](https://pypi.org/) and has basic PyPy and GraalPy support.
@@ -41,10 +39,13 @@ Check out the [User Guide](https://maturin.rs/)!
41
39
 
42
40
  ## Usage
43
41
 
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/):
42
+ 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/) or [uv](https://github.com/astral-sh/uv):
45
43
 
46
44
  ```shell
45
+ # pipx
47
46
  pipx install maturin
47
+ # uv
48
+ uv tool install maturin
48
49
  ```
49
50
 
50
51
  > [!NOTE]
@@ -55,10 +56,10 @@ There are four main commands:
55
56
 
56
57
  - `maturin new` creates a new cargo project with maturin configured.
57
58
  - `maturin publish` builds the crate into python packages and publishes them to pypi.
58
- - `maturin build` builds the wheels and stores them in a folder (`target/wheels` by default), but doesn't upload them. It's possible to upload those with [twine](https://github.com/pypa/twine) or `maturin upload`.
59
+ - `maturin build` builds the wheels and stores them in a folder (`target/wheels` by default), but doesn't upload them. It's recommended to publish packages with [uv](https://github.com/astral-sh/uv) using `uv publish`.
59
60
  - `maturin develop` builds the crate and installs it as a python module directly in the current virtualenv. Note that while `maturin develop` is faster, it doesn't support all the feature that running `pip install` after `maturin build` supports.
60
61
 
61
- maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust or milksnake configuration.
62
+ maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust configuration.
62
63
  You can even integrate it with testing tools such as [tox](https://tox.readthedocs.io/en/latest/).
63
64
  There are examples for the different bindings in the `test-crates` folder.
64
65
 
@@ -79,7 +80,7 @@ which requires the right compilers to be installed. Installing a wheel is much f
79
80
 
80
81
  When you publish a package to be installable with `pip install`, you upload it to [pypi](https://pypi.org/), the official package repository.
81
82
  For testing, you can use [test pypi](https://test.pypi.org/) instead, which you can use with `pip install --index-url https://test.pypi.org/simple/`.
82
- Note that for publishing for linux, [you need to use the manylinux docker container](#manylinux-and-auditwheel), while for publishing from your repository you can use the [PyO3/maturin-action github action](https://github.com/PyO3/maturin-action).
83
+ Note that for [publishing for linux](#manylinux-and-auditwheel), you need to use the manylinux docker container or zig, while for publishing from your repository you can use the [PyO3/maturin-action](https://github.com/PyO3/maturin-action) github action.
83
84
 
84
85
  ## Mixed rust/python projects
85
86
 
@@ -149,7 +150,7 @@ When doing this also be sure to set the module name in your code to match the la
149
150
  ```rust
150
151
  #[pymodule]
151
152
  #[pyo3(name="_lib_name")]
152
- fn my_lib_name(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
153
+ fn my_lib_name(m: &Bound<'_, PyModule>) -> PyResult<()> {
153
154
  m.add_class::<MyPythonRustClass>()?;
154
155
  Ok(())
155
156
  }
@@ -165,10 +166,10 @@ To specify python dependencies, add a list `dependencies` in a `[project]` secti
165
166
  ```toml
166
167
  [project]
167
168
  name = "my-project"
168
- dependencies = ["flask~=1.1.0", "toml==0.10.0"]
169
+ dependencies = ["flask~=1.1.0", "toml>=0.10.2,<0.11.0"]
169
170
  ```
170
171
 
171
- 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]`.
172
+ You can add so called console scripts, which are shell commands that execute some function in your program in the `[project.scripts]` section.
172
173
  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:
173
174
 
174
175
  ```toml
@@ -229,7 +230,7 @@ There's a `maturin sdist` command for only building a source distribution as wor
229
230
 
230
231
  For portability reasons, native python modules on linux must only dynamically link a set of very few libraries which are installed basically everywhere, hence the name manylinux.
231
232
  The pypa offers special docker images and a tool called [auditwheel](https://github.com/pypa/auditwheel/) to ensure compliance with the [manylinux rules](https://peps.python.org/pep-0599/#the-manylinux2014-policy).
232
- If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or [build with zig](#use-zig)**.
233
+ If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or build with zig**.
233
234
 
234
235
  The Rust compiler since version 1.64 [requires at least glibc 2.17](https://blog.rust-lang.org/2022/08/01/Increasing-glibc-kernel-requirements.html), so you need to use at least manylinux2014.
235
236
  For publishing, we recommend enforcing the same manylinux version as the image with the manylinux flag, e.g. use `--manylinux 2014` if you are building in `quay.io/pypa/manylinux2014_x86_64`.
@@ -269,7 +270,9 @@ maturin itself is manylinux compliant when compiled for the musl target.
269
270
  - [robyn](https://github.com/sansyrox/robyn) - A fast and extensible async python web server with a Rust runtime
270
271
  - [ruff](https://github.com/charliermarsh/ruff) - An extremely fast Python linter, written in Rust
271
272
  - [rnet](https://github.com/0x676e67/rnet) - Asynchronous Python HTTP Client with Black Magic
273
+ - [rustpy-xlsxwriter](https://github.com/rahmadafandi/rustpy-xlsxwriter): A high-performance Python library for generating Excel files, utilizing the [rust_xlsxwriter](https://github.com/jmcnamara/rust_xlsxwriter) crate for efficient data handling.
272
274
  - [tantivy-py](https://github.com/quickwit-oss/tantivy-py) - Python bindings for Tantivy
275
+ - [tpchgen-cli](https://github.com/clflushopt/tpchgen-rs/tree/main/tpchgen-cli) - Python CLI binding for `tpchgen`, a blazing fast TPC-H benchmark data generator built in pure Rust with zero dependencies.
273
276
  - [watchfiles](https://github.com/samuelcolvin/watchfiles) - Simple, modern and high performance file watching and code reload in python
274
277
  - [wonnx](https://github.com/webonnx/wonnx/tree/master/wonnx-py) - Wonnx is a GPU-accelerated ONNX inference run-time written 100% in Rust
275
278
 
@@ -0,0 +1,7 @@
1
+ maturin-1.8.6.data/scripts/maturin,sha256=f8i1gdnyptFy81WZRNZF0jo9C_3Sn9GZouep8P1-DHc,18920496
2
+ maturin-1.8.6.dist-info/METADATA,sha256=szN7dmimkjblGzI4DANWGEVL9X2SlueLU1c1UK13TtM,16552
3
+ maturin-1.8.6.dist-info/WHEEL,sha256=Z9EvJcq5N96b4rSqg-ys1OmbbWPCugqwpJtF9hM4jHw,103
4
+ maturin/__init__.py,sha256=PnrUq1TbEWzMXTvshio2m5JzVy42DLFsjzsiRvPxC9M,8080
5
+ maturin/__main__.py,sha256=Fg40Rg6srWYrH0s2ZgbIOysRDnZf2tX-z5VJAPyOs4Y,1145
6
+ maturin/bootstrap.py,sha256=6IKq0Y-mDUTP19ziOT4TdPFYkcuWdDpNGzUj8FJ_5sQ,1174
7
+ maturin-1.8.6.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: maturin (1.8.3)
2
+ Generator: maturin (1.8.6)
3
3
  Root-Is-Purelib: false
4
4
  Tag: py3-none-macosx_10_12_x86_64
@@ -1,6 +0,0 @@
1
- maturin-1.8.3.dist-info/METADATA,sha256=KvnnR0jOAjvV50P_wIUUQpPsqdWv5q92BLApx3Pk-7I,16322
2
- maturin-1.8.3.dist-info/WHEEL,sha256=iynIFuruP98iAQ_vbgENee_L7CnfkfNjTMl4i53tE2Q,103
3
- maturin/__init__.py,sha256=S6HX3ljHfTCeA0ONi2M2or4QitPkT2wcU0D1b7YOUIk,7187
4
- maturin/__main__.py,sha256=Fg40Rg6srWYrH0s2ZgbIOysRDnZf2tX-z5VJAPyOs4Y,1145
5
- maturin-1.8.3.data/scripts/maturin,sha256=JF-TsPMFy3Basy5n-u6sjRDLXN2HT0PVbOUZzPUwv_w,18835096
6
- maturin-1.8.3.dist-info/RECORD,,