maturin 1.9.4__py3-none-manylinux_2_31_riscv64.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 +234 -0
- maturin/__main__.py +50 -0
- maturin/bootstrap.py +31 -0
- maturin-1.9.4.data/scripts/maturin +0 -0
- maturin-1.9.4.dist-info/METADATA +304 -0
- maturin-1.9.4.dist-info/RECORD +9 -0
- maturin-1.9.4.dist-info/WHEEL +4 -0
- maturin-1.9.4.dist-info/licenses/license-apache +201 -0
- maturin-1.9.4.dist-info/licenses/license-mit +25 -0
maturin/__init__.py
ADDED
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
maturin's implementation of the PEP 517 interface. Calls maturin through subprocess
|
|
4
|
+
|
|
5
|
+
Currently, the "return value" of the rust implementation is the last line of stdout
|
|
6
|
+
|
|
7
|
+
On windows, apparently pip's subprocess handling sets stdout to some windows encoding (e.g. cp1252 on my machine),
|
|
8
|
+
even though the terminal supports utf8. Writing directly to the binary stdout buffer avoids encoding errors due to
|
|
9
|
+
maturin's emojis.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from __future__ import annotations
|
|
13
|
+
|
|
14
|
+
import os
|
|
15
|
+
import platform
|
|
16
|
+
import shlex
|
|
17
|
+
import shutil
|
|
18
|
+
import struct
|
|
19
|
+
import subprocess
|
|
20
|
+
import sys
|
|
21
|
+
from subprocess import SubprocessError
|
|
22
|
+
from typing import Any, Dict, Mapping, List, Optional
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def get_config() -> Dict[str, str]:
|
|
26
|
+
try:
|
|
27
|
+
import tomllib
|
|
28
|
+
except ModuleNotFoundError:
|
|
29
|
+
import tomli as tomllib # type: ignore
|
|
30
|
+
|
|
31
|
+
with open("pyproject.toml", "rb") as fp:
|
|
32
|
+
pyproject_toml = tomllib.load(fp)
|
|
33
|
+
return pyproject_toml.get("tool", {}).get("maturin", {})
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def get_maturin_pep517_args(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
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"))
|
|
41
|
+
if build_args is None:
|
|
42
|
+
env_args = os.getenv("MATURIN_PEP517_ARGS", "")
|
|
43
|
+
args = shlex.split(env_args)
|
|
44
|
+
elif isinstance(build_args, str):
|
|
45
|
+
args = shlex.split(build_args)
|
|
46
|
+
else:
|
|
47
|
+
args = build_args
|
|
48
|
+
return args
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
def _get_sys_executable() -> str:
|
|
52
|
+
executable = sys.executable
|
|
53
|
+
if os.getenv("MATURIN_PEP517_USE_BASE_PYTHON") in {"1", "true"} or get_config().get("use-base-python"):
|
|
54
|
+
# Use the base interpreter path when running inside a venv to avoid recompilation
|
|
55
|
+
# when switching between venvs
|
|
56
|
+
base_executable = getattr(sys, "_base_executable")
|
|
57
|
+
if base_executable and os.path.exists(base_executable):
|
|
58
|
+
executable = os.path.realpath(base_executable)
|
|
59
|
+
return executable
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
def _additional_pep517_args() -> List[str]:
|
|
63
|
+
# Support building for 32-bit Python on x64 Windows
|
|
64
|
+
if platform.system().lower() == "windows" and platform.machine().lower() == "amd64":
|
|
65
|
+
pointer_width = struct.calcsize("P") * 8
|
|
66
|
+
if pointer_width == 32:
|
|
67
|
+
return ["--target", "i686-pc-windows-msvc"]
|
|
68
|
+
return []
|
|
69
|
+
|
|
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
|
+
|
|
82
|
+
# noinspection PyUnusedLocal
|
|
83
|
+
def _build_wheel(
|
|
84
|
+
wheel_directory: str,
|
|
85
|
+
config_settings: Optional[Mapping[str, Any]] = None,
|
|
86
|
+
metadata_directory: Optional[str] = None,
|
|
87
|
+
editable: bool = False,
|
|
88
|
+
) -> str:
|
|
89
|
+
# PEP 517 specifies that only `sys.executable` points to the correct
|
|
90
|
+
# python interpreter
|
|
91
|
+
base_command = [
|
|
92
|
+
"maturin",
|
|
93
|
+
"pep517",
|
|
94
|
+
"build-wheel",
|
|
95
|
+
"-i",
|
|
96
|
+
_get_sys_executable(),
|
|
97
|
+
]
|
|
98
|
+
options = _additional_pep517_args()
|
|
99
|
+
if editable:
|
|
100
|
+
options.append("--editable")
|
|
101
|
+
|
|
102
|
+
pep517_args = get_maturin_pep517_args(config_settings)
|
|
103
|
+
if pep517_args:
|
|
104
|
+
options.extend(pep517_args)
|
|
105
|
+
|
|
106
|
+
if "--compatibility" not in options and "--manylinux" not in options:
|
|
107
|
+
# default to off if not otherwise specified
|
|
108
|
+
options = ["--compatibility", "off", *options]
|
|
109
|
+
|
|
110
|
+
command = [*base_command, *options]
|
|
111
|
+
|
|
112
|
+
print("Running `{}`".format(" ".join(command)))
|
|
113
|
+
sys.stdout.flush()
|
|
114
|
+
result = subprocess.run(command, stdout=subprocess.PIPE, env=_get_env())
|
|
115
|
+
sys.stdout.buffer.write(result.stdout)
|
|
116
|
+
sys.stdout.flush()
|
|
117
|
+
if result.returncode != 0:
|
|
118
|
+
sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
|
|
119
|
+
sys.exit(1)
|
|
120
|
+
output = result.stdout.decode(errors="replace")
|
|
121
|
+
wheel_path = output.strip().splitlines()[-1]
|
|
122
|
+
filename = os.path.basename(wheel_path)
|
|
123
|
+
shutil.copy2(wheel_path, os.path.join(wheel_directory, filename))
|
|
124
|
+
return filename
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
# noinspection PyUnusedLocal
|
|
128
|
+
def build_wheel(
|
|
129
|
+
wheel_directory: str,
|
|
130
|
+
config_settings: Optional[Mapping[str, Any]] = None,
|
|
131
|
+
metadata_directory: Optional[str] = None,
|
|
132
|
+
) -> str:
|
|
133
|
+
return _build_wheel(wheel_directory, config_settings, metadata_directory)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
# noinspection PyUnusedLocal
|
|
137
|
+
def build_sdist(sdist_directory: str, config_settings: Optional[Mapping[str, Any]] = None) -> str:
|
|
138
|
+
command = ["maturin", "pep517", "write-sdist", "--sdist-directory", sdist_directory]
|
|
139
|
+
|
|
140
|
+
print("Running `{}`".format(" ".join(command)))
|
|
141
|
+
sys.stdout.flush()
|
|
142
|
+
result = subprocess.run(command, stdout=subprocess.PIPE, env=_get_env())
|
|
143
|
+
sys.stdout.buffer.write(result.stdout)
|
|
144
|
+
sys.stdout.flush()
|
|
145
|
+
if result.returncode != 0:
|
|
146
|
+
sys.stderr.write(f"Error: command {command} returned non-zero exit status {result.returncode}\n")
|
|
147
|
+
sys.exit(1)
|
|
148
|
+
output = result.stdout.decode(errors="replace")
|
|
149
|
+
return output.strip().splitlines()[-1]
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
# noinspection PyUnusedLocal
|
|
153
|
+
def get_requires_for_build_wheel(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
154
|
+
if get_config().get("bindings") == "cffi":
|
|
155
|
+
requirements = ["cffi"]
|
|
156
|
+
else:
|
|
157
|
+
requirements = []
|
|
158
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
159
|
+
requirements += ["puccinialin"]
|
|
160
|
+
return requirements
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
# noinspection PyUnusedLocal
|
|
164
|
+
def build_editable(
|
|
165
|
+
wheel_directory: str,
|
|
166
|
+
config_settings: Optional[Mapping[str, Any]] = None,
|
|
167
|
+
metadata_directory: Optional[str] = None,
|
|
168
|
+
) -> str:
|
|
169
|
+
return _build_wheel(wheel_directory, config_settings, metadata_directory, editable=True)
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
# Requirements to build an editable are the same as for a wheel
|
|
173
|
+
get_requires_for_build_editable = get_requires_for_build_wheel
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# noinspection PyUnusedLocal
|
|
177
|
+
def get_requires_for_build_sdist(config_settings: Optional[Mapping[str, Any]] = None) -> List[str]:
|
|
178
|
+
requirements = []
|
|
179
|
+
if not os.environ.get("MATURIN_NO_INSTALL_RUST") and not shutil.which("cargo"):
|
|
180
|
+
requirements += ["puccinialin"]
|
|
181
|
+
return requirements
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# noinspection PyUnusedLocal
|
|
185
|
+
def prepare_metadata_for_build_wheel(
|
|
186
|
+
metadata_directory: str, config_settings: Optional[Mapping[str, Any]] = None
|
|
187
|
+
) -> str:
|
|
188
|
+
print("Checking for Rust toolchain....")
|
|
189
|
+
is_cargo_installed = False
|
|
190
|
+
try:
|
|
191
|
+
output = subprocess.check_output(["cargo", "--version"], env=_get_env()).decode("utf-8", "ignore")
|
|
192
|
+
if "cargo" in output:
|
|
193
|
+
is_cargo_installed = True
|
|
194
|
+
except (FileNotFoundError, SubprocessError):
|
|
195
|
+
pass
|
|
196
|
+
|
|
197
|
+
if not is_cargo_installed:
|
|
198
|
+
sys.stderr.write(
|
|
199
|
+
"\nCargo, the Rust package manager, is not installed or is not on PATH.\n"
|
|
200
|
+
"This package requires Rust and Cargo to compile extensions. Install it through\n"
|
|
201
|
+
"the system's package manager or via https://rustup.rs/\n\n"
|
|
202
|
+
)
|
|
203
|
+
sys.exit(1)
|
|
204
|
+
|
|
205
|
+
command = [
|
|
206
|
+
"maturin",
|
|
207
|
+
"pep517",
|
|
208
|
+
"write-dist-info",
|
|
209
|
+
"--metadata-directory",
|
|
210
|
+
metadata_directory,
|
|
211
|
+
# PEP 517 specifies that only `sys.executable` points to the correct
|
|
212
|
+
# python interpreter
|
|
213
|
+
"--interpreter",
|
|
214
|
+
_get_sys_executable(),
|
|
215
|
+
]
|
|
216
|
+
command.extend(_additional_pep517_args())
|
|
217
|
+
pep517_args = get_maturin_pep517_args(config_settings)
|
|
218
|
+
if pep517_args:
|
|
219
|
+
command.extend(pep517_args)
|
|
220
|
+
|
|
221
|
+
print("Running `{}`".format(" ".join(command)))
|
|
222
|
+
try:
|
|
223
|
+
_output = subprocess.check_output(command, env=_get_env())
|
|
224
|
+
except subprocess.CalledProcessError as e:
|
|
225
|
+
sys.stderr.write(f"Error running maturin: {e}\n")
|
|
226
|
+
sys.exit(1)
|
|
227
|
+
sys.stdout.buffer.write(_output)
|
|
228
|
+
sys.stdout.flush()
|
|
229
|
+
output = _output.decode(errors="replace")
|
|
230
|
+
return output.strip().splitlines()[-1]
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
# Metadata for editable are the same as for a wheel
|
|
234
|
+
prepare_metadata_for_build_editable = prepare_metadata_for_build_wheel
|
maturin/__main__.py
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import sys
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import sysconfig
|
|
7
|
+
from typing import Optional
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def get_maturin_path() -> Optional[Path]:
|
|
11
|
+
SCRIPT_NAME = "maturin"
|
|
12
|
+
|
|
13
|
+
def script_dir(scheme: str) -> str:
|
|
14
|
+
return sysconfig.get_path("scripts", scheme)
|
|
15
|
+
|
|
16
|
+
def script_exists(dir: str) -> bool:
|
|
17
|
+
for _, _, files in os.walk(dir):
|
|
18
|
+
for f in files:
|
|
19
|
+
name, *_ = os.path.splitext(f)
|
|
20
|
+
if name == SCRIPT_NAME:
|
|
21
|
+
return True
|
|
22
|
+
|
|
23
|
+
return False
|
|
24
|
+
|
|
25
|
+
paths = list(
|
|
26
|
+
filter(
|
|
27
|
+
script_exists,
|
|
28
|
+
filter(os.path.exists, map(script_dir, sysconfig.get_scheme_names())),
|
|
29
|
+
)
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
if paths:
|
|
33
|
+
return Path(paths[0]) / SCRIPT_NAME
|
|
34
|
+
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
if __name__ == "__main__":
|
|
39
|
+
maturin = get_maturin_path()
|
|
40
|
+
if maturin is None:
|
|
41
|
+
print("Unable to find `maturin` script")
|
|
42
|
+
exit(1)
|
|
43
|
+
|
|
44
|
+
if sys.platform == "win32":
|
|
45
|
+
import subprocess
|
|
46
|
+
|
|
47
|
+
code = subprocess.call([str(maturin)] + sys.argv[1:])
|
|
48
|
+
sys.exit(code)
|
|
49
|
+
else:
|
|
50
|
+
os.execv(maturin, [str(maturin)] + sys.argv[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 []
|
|
Binary file
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: maturin
|
|
3
|
+
Version: 1.9.4
|
|
4
|
+
Classifier: Topic :: Software Development :: Build Tools
|
|
5
|
+
Classifier: Programming Language :: Rust
|
|
6
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
7
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
8
|
+
Classifier: Programming Language :: Python :: Implementation :: GraalPy
|
|
9
|
+
Requires-Dist: tomli>=1.1.0 ; python_full_version < '3.11'
|
|
10
|
+
Requires-Dist: ziglang>=0.10.0,<0.13.0 ; extra == 'zig'
|
|
11
|
+
Requires-Dist: patchelf ; extra == 'patchelf'
|
|
12
|
+
Provides-Extra: zig
|
|
13
|
+
Provides-Extra: patchelf
|
|
14
|
+
License-File: license-mit
|
|
15
|
+
License-File: license-apache
|
|
16
|
+
Summary: Build and publish crates with pyo3, cffi and uniffi bindings as well as rust binaries as python packages
|
|
17
|
+
Home-Page: https://github.com/pyo3/maturin
|
|
18
|
+
Author-email: konstin <konstin@mailbox.org>
|
|
19
|
+
License-Expression: MIT OR Apache-2.0
|
|
20
|
+
Requires-Python: >=3.7
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
Project-URL: Source Code, https://github.com/PyO3/maturin
|
|
23
|
+
Project-URL: Issues, https://github.com/PyO3/maturin/issues
|
|
24
|
+
Project-URL: Documentation, https://maturin.rs
|
|
25
|
+
Project-URL: Changelog, https://maturin.rs/changelog.html
|
|
26
|
+
|
|
27
|
+
# Maturin
|
|
28
|
+
|
|
29
|
+
_formerly pyo3-pack_
|
|
30
|
+
|
|
31
|
+
[](https://maturin.rs)
|
|
32
|
+
[](https://crates.io/crates/maturin)
|
|
33
|
+
[](https://pypi.org/project/maturin)
|
|
34
|
+
[](https://discord.gg/33kcChzH7f)
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
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.
|
|
38
|
+
|
|
39
|
+
Check out the [User Guide](https://maturin.rs/)!
|
|
40
|
+
|
|
41
|
+
## Usage
|
|
42
|
+
|
|
43
|
+
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):
|
|
44
|
+
|
|
45
|
+
```shell
|
|
46
|
+
# pipx
|
|
47
|
+
pipx install maturin
|
|
48
|
+
# uv
|
|
49
|
+
uv tool install maturin
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> [!NOTE]
|
|
53
|
+
>
|
|
54
|
+
> `pip install maturin` should also work if you don't want to use pipx.
|
|
55
|
+
|
|
56
|
+
There are four main commands:
|
|
57
|
+
|
|
58
|
+
- `maturin new` creates a new cargo project with maturin configured.
|
|
59
|
+
- `maturin publish` builds the crate into python packages and publishes them to pypi.
|
|
60
|
+
- `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`.
|
|
61
|
+
- `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.
|
|
62
|
+
|
|
63
|
+
maturin doesn't need extra configuration files and doesn't clash with an existing setuptools-rust configuration.
|
|
64
|
+
You can even integrate it with testing tools such as [tox](https://tox.readthedocs.io/en/latest/).
|
|
65
|
+
There are examples for the different bindings in the `test-crates` folder.
|
|
66
|
+
|
|
67
|
+
The name of the package will be the name of the cargo project, i.e. the name field in the `[package]` section of `Cargo.toml`.
|
|
68
|
+
The name of the module, which you are using when importing, will be the `name` value in the `[lib]` section (which defaults to the name of the package). For binaries, it's simply the name of the binary generated by cargo.
|
|
69
|
+
|
|
70
|
+
When using `maturin build` and `maturin develop` commands, you can compile a performance-optimized program by adding the `-r` or `--release` flag.
|
|
71
|
+
|
|
72
|
+
## Python packaging basics
|
|
73
|
+
|
|
74
|
+
Python packages come in two formats:
|
|
75
|
+
A built form called wheel and source distributions (sdist), both of which are archives.
|
|
76
|
+
A wheel can be compatible with any python version, interpreter (cpython and pypy, mainly), operating system and hardware architecture (for pure python wheels),
|
|
77
|
+
can be limited to a specific platform and architecture (e.g. when using ctypes or cffi) or to a specific python interpreter and version on a specific architecture and operating system (e.g. with pyo3).
|
|
78
|
+
|
|
79
|
+
When using `pip install` on a package, pip tries to find a matching wheel and install that. If it doesn't find one, it downloads the source distribution and builds a wheel for the current platform,
|
|
80
|
+
which requires the right compilers to be installed. Installing a wheel is much faster than installing a source distribution as building wheels is generally slow.
|
|
81
|
+
|
|
82
|
+
When you publish a package to be installable with `pip install`, you upload it to [pypi](https://pypi.org/), the official package repository.
|
|
83
|
+
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/`.
|
|
84
|
+
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.
|
|
85
|
+
|
|
86
|
+
## Mixed rust/python projects
|
|
87
|
+
|
|
88
|
+
To create a mixed rust/python project, create a folder with your module name (i.e. `lib.name` in Cargo.toml) next to your Cargo.toml and add your python sources there:
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
my-project
|
|
92
|
+
├── Cargo.toml
|
|
93
|
+
├── my_project
|
|
94
|
+
│ ├── __init__.py
|
|
95
|
+
│ └── bar.py
|
|
96
|
+
├── pyproject.toml
|
|
97
|
+
├── README.md
|
|
98
|
+
└── src
|
|
99
|
+
└── lib.rs
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
You can specify a different python source directory in `pyproject.toml` by setting `tool.maturin.python-source`, for example
|
|
103
|
+
|
|
104
|
+
**pyproject.toml**
|
|
105
|
+
|
|
106
|
+
```toml
|
|
107
|
+
[tool.maturin]
|
|
108
|
+
python-source = "python"
|
|
109
|
+
module-name = "my_project._lib_name"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
then the project structure would look like this:
|
|
113
|
+
|
|
114
|
+
```
|
|
115
|
+
my-project
|
|
116
|
+
├── Cargo.toml
|
|
117
|
+
├── python
|
|
118
|
+
│ └── my_project
|
|
119
|
+
│ ├── __init__.py
|
|
120
|
+
│ └── bar.py
|
|
121
|
+
├── pyproject.toml
|
|
122
|
+
├── README.md
|
|
123
|
+
└── src
|
|
124
|
+
└── lib.rs
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
> [!NOTE]
|
|
128
|
+
>
|
|
129
|
+
> This structure is recommended to avoid [a common `ImportError` pitfall](https://github.com/PyO3/maturin/issues/490)
|
|
130
|
+
|
|
131
|
+
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.
|
|
132
|
+
|
|
133
|
+
With cffi you can do `from .my_project import lib` and then use `lib.my_native_function`, with pyo3 you can directly `from .my_project import my_native_function`.
|
|
134
|
+
|
|
135
|
+
Example layout with pyo3 after `maturin develop`:
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
my-project
|
|
139
|
+
├── Cargo.toml
|
|
140
|
+
├── my_project
|
|
141
|
+
│ ├── __init__.py
|
|
142
|
+
│ ├── bar.py
|
|
143
|
+
│ └── _lib_name.cpython-36m-x86_64-linux-gnu.so
|
|
144
|
+
├── README.md
|
|
145
|
+
└── src
|
|
146
|
+
└── lib.rs
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
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):
|
|
150
|
+
|
|
151
|
+
```rust
|
|
152
|
+
#[pymodule]
|
|
153
|
+
#[pyo3(name="_lib_name")]
|
|
154
|
+
fn my_lib_name(m: &Bound<'_, PyModule>) -> PyResult<()> {
|
|
155
|
+
m.add_class::<MyPythonRustClass>()?;
|
|
156
|
+
Ok(())
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Python metadata
|
|
161
|
+
|
|
162
|
+
maturin supports [PEP 621](https://www.python.org/dev/peps/pep-0621/), you can specify python package metadata in `pyproject.toml`.
|
|
163
|
+
maturin merges metadata from `Cargo.toml` and `pyproject.toml`, `pyproject.toml` takes precedence over `Cargo.toml`.
|
|
164
|
+
|
|
165
|
+
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:
|
|
166
|
+
|
|
167
|
+
```toml
|
|
168
|
+
[project]
|
|
169
|
+
name = "my-project"
|
|
170
|
+
dependencies = ["flask~=1.1.0", "toml>=0.10.2,<0.11.0"]
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
You can add so called console scripts, which are shell commands that execute some function in your program in the `[project.scripts]` section.
|
|
174
|
+
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:
|
|
175
|
+
|
|
176
|
+
```toml
|
|
177
|
+
[project.scripts]
|
|
178
|
+
get_42 = "my_project:DummyClass.get_42"
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
You can also specify [trove classifiers](https://pypi.org/classifiers/) in your `pyproject.toml` under `project.classifiers`:
|
|
182
|
+
|
|
183
|
+
```toml
|
|
184
|
+
[project]
|
|
185
|
+
name = "my-project"
|
|
186
|
+
classifiers = ["Programming Language :: Python"]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
## Source distribution
|
|
190
|
+
|
|
191
|
+
maturin supports building through `pyproject.toml`. To use it, create a `pyproject.toml` next to your `Cargo.toml` with the following content:
|
|
192
|
+
|
|
193
|
+
```toml
|
|
194
|
+
[build-system]
|
|
195
|
+
requires = ["maturin>=1.0,<2.0"]
|
|
196
|
+
build-backend = "maturin"
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
If a `pyproject.toml` with a `[build-system]` entry is present, maturin can build a source distribution of your package when `--sdist` is specified.
|
|
200
|
+
The source distribution will contain the same files as `cargo package`. To only build a source distribution, pass `--interpreter` without any values.
|
|
201
|
+
|
|
202
|
+
You can then e.g. install your package with `pip install .`. With `pip install . -v` you can see the output of cargo and maturin.
|
|
203
|
+
|
|
204
|
+
You can use the options `compatibility`, `skip-auditwheel`, `bindings`, `strip` and common Cargo build options such as `features` under `[tool.maturin]` the same way you would when running maturin directly.
|
|
205
|
+
The `bindings` key is required for cffi and bin projects as those can't be automatically detected. Currently, all builds are in release mode (see [this thread](https://discuss.python.org/t/pep-517-debug-vs-release-builds/1924) for details).
|
|
206
|
+
|
|
207
|
+
For a non-manylinux build with cffi bindings you could use the following:
|
|
208
|
+
|
|
209
|
+
```toml
|
|
210
|
+
[build-system]
|
|
211
|
+
requires = ["maturin>=1.0,<2.0"]
|
|
212
|
+
build-backend = "maturin"
|
|
213
|
+
|
|
214
|
+
[tool.maturin]
|
|
215
|
+
bindings = "cffi"
|
|
216
|
+
compatibility = "linux"
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
`manylinux` option is also accepted as an alias of `compatibility` for backward compatibility with old version of maturin.
|
|
220
|
+
|
|
221
|
+
To include arbitrary files in the sdist for use during compilation specify `include` as an array of `path` globs with `format` set to `sdist`:
|
|
222
|
+
|
|
223
|
+
```toml
|
|
224
|
+
[tool.maturin]
|
|
225
|
+
include = [{ path = "path/**/*", format = "sdist" }]
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
There's a `maturin sdist` command for only building a source distribution as workaround for [pypa/pip#6041](https://github.com/pypa/pip/issues/6041).
|
|
229
|
+
|
|
230
|
+
## Manylinux and auditwheel
|
|
231
|
+
|
|
232
|
+
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.
|
|
233
|
+
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).
|
|
234
|
+
If you want to publish widely usable wheels for linux pypi, **you need to use a manylinux docker image or build with zig**.
|
|
235
|
+
|
|
236
|
+
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.
|
|
237
|
+
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`.
|
|
238
|
+
The [PyO3/maturin-action](https://github.com/PyO3/maturin-action) github action already takes care of this if you set e.g. `manylinux: 2014`.
|
|
239
|
+
|
|
240
|
+
maturin contains a reimplementation of auditwheel automatically checks the generated library and gives the wheel the proper platform tag.
|
|
241
|
+
If your system's glibc is too new or you link other shared libraries, it will assign the `linux` tag.
|
|
242
|
+
You can also manually disable those checks and directly use native linux target with `--manylinux off`.
|
|
243
|
+
|
|
244
|
+
For full manylinux compliance you need to compile in a CentOS docker container. The [pyo3/maturin](https://ghcr.io/pyo3/maturin) image is based on the manylinux2014 image,
|
|
245
|
+
and passes arguments to the `maturin` binary. You can use it like this:
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
docker run --rm -v $(pwd):/io ghcr.io/pyo3/maturin build --release # or other maturin arguments
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
Note that this image is very basic and only contains python, maturin and stable rust. If you need additional tools, you can run commands inside the manylinux container.
|
|
252
|
+
See [konstin/complex-manylinux-maturin-docker](https://github.com/konstin/complex-manylinux-maturin-docker) for a small educational example or [nanoporetech/fast-ctc-decode](https://github.com/nanoporetech/fast-ctc-decode/blob/b226ea0f2b2f4f474eff47349703d57d2ea4801b/.github/workflows/publish.yml) for a real world setup.
|
|
253
|
+
|
|
254
|
+
maturin itself is manylinux compliant when compiled for the musl target.
|
|
255
|
+
|
|
256
|
+
## Examples
|
|
257
|
+
|
|
258
|
+
- [agg-python-bindings](https://pypi.org/project/agg-python-bindings) - A Python Library that binds to Asciinema Agg terminal record renderer and Avt terminal emulator
|
|
259
|
+
- [ballista-python](https://github.com/apache/arrow-ballista-python) - A Python library that binds to Apache Arrow distributed query engine Ballista
|
|
260
|
+
- [bleuscore](https://github.com/shenxiangzhuang/bleuscore) - A BLEU score calculation library, written in pure Rust
|
|
261
|
+
- [chardetng-py](https://github.com/john-parton/chardetng-py) - Python binding for the chardetng character encoding detector.
|
|
262
|
+
- [connector-x](https://github.com/sfu-db/connector-x/tree/main/connectorx-python) - ConnectorX enables you to load data from databases into Python in the fastest and most memory efficient way
|
|
263
|
+
- [datafusion-python](https://github.com/apache/arrow-datafusion-python) - a Python library that binds to Apache Arrow in-memory query engine DataFusion
|
|
264
|
+
- [deltalake-python](https://github.com/delta-io/delta-rs/tree/main/python) - Native Delta Lake Python binding based on delta-rs with Pandas integration
|
|
265
|
+
- [opendal](https://github.com/apache/incubator-opendal/tree/main/bindings/python) - OpenDAL Python Binding to access data freely
|
|
266
|
+
- [orjson](https://github.com/ijl/orjson) - A fast, correct JSON library for Python
|
|
267
|
+
- [polars](https://github.com/pola-rs/polars/tree/master/py-polars) - Fast multi-threaded DataFrame library in Rust | Python | Node.js
|
|
268
|
+
- [pydantic-core](https://github.com/pydantic/pydantic-core) - Core validation logic for pydantic written in Rust
|
|
269
|
+
- [pyrus-cramjam](https://github.com/milesgranger/pyrus-cramjam) - Thin Python wrapper to de/compression algorithms in Rust
|
|
270
|
+
- [pyxel](https://github.com/kitao/pyxel) - A retro game engine for Python
|
|
271
|
+
- [roapi](https://github.com/roapi/roapi) - ROAPI automatically spins up read-only APIs for static datasets without requiring you to write a single line of code
|
|
272
|
+
- [robyn](https://github.com/sansyrox/robyn) - A fast and extensible async python web server with a Rust runtime
|
|
273
|
+
- [ruff](https://github.com/charliermarsh/ruff) - An extremely fast Python linter, written in Rust
|
|
274
|
+
- [rnet](https://github.com/0x676e67/rnet) - Asynchronous Python HTTP Client with Black Magic
|
|
275
|
+
- [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.
|
|
276
|
+
- [tantivy-py](https://github.com/quickwit-oss/tantivy-py) - Python bindings for Tantivy
|
|
277
|
+
- [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.
|
|
278
|
+
- [watchfiles](https://github.com/samuelcolvin/watchfiles) - Simple, modern and high performance file watching and code reload in python
|
|
279
|
+
- [wonnx](https://github.com/webonnx/wonnx/tree/master/wonnx-py) - Wonnx is a GPU-accelerated ONNX inference run-time written 100% in Rust
|
|
280
|
+
|
|
281
|
+
## Contributing
|
|
282
|
+
|
|
283
|
+
Everyone is welcomed to contribute to maturin! There are many ways to support the project, such as:
|
|
284
|
+
|
|
285
|
+
- help maturin users with issues on GitHub and Gitter
|
|
286
|
+
- improve documentation
|
|
287
|
+
- write features and bugfixes
|
|
288
|
+
- publish blogs and examples of how to use maturin
|
|
289
|
+
|
|
290
|
+
Our [contributing notes](https://github.com/PyO3/maturin/blob/main/guide/src/contributing.md) have more resources if you wish to volunteer time for maturin and are searching where to start.
|
|
291
|
+
|
|
292
|
+
If you don't have time to contribute yourself but still wish to support the project's future success, some of our maintainers have GitHub sponsorship pages:
|
|
293
|
+
|
|
294
|
+
- [messense](https://github.com/sponsors/messense)
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
Licensed under either of:
|
|
299
|
+
|
|
300
|
+
- Apache License, Version 2.0, ([LICENSE-APACHE](https://github.com/PyO3/maturin/blob/main/license-apache) or http://www.apache.org/licenses/LICENSE-2.0)
|
|
301
|
+
- MIT license ([LICENSE-MIT](https://github.com/PyO3/maturin/blob/main/license-mit) or http://opensource.org/licenses/MIT)
|
|
302
|
+
|
|
303
|
+
at your option.
|
|
304
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
maturin-1.9.4.data/scripts/maturin,sha256=tiGN43OAPOrGBZDrxdPZCm5EB6Pg3cJ8ZTU55wK9wIM,20256480
|
|
2
|
+
maturin-1.9.4.dist-info/METADATA,sha256=yS1gtFlwXKoYyqktZgLnBzBMOtzYd-vog-bBlFu9f_I,16746
|
|
3
|
+
maturin-1.9.4.dist-info/WHEEL,sha256=niq_m0puTMFR_j50YBZQ7X32fV3RBFT0khWiJDUnngI,106
|
|
4
|
+
maturin-1.9.4.dist-info/licenses/license-apache,sha256=pg7qgXUUUxZo1-AHZXMUSf4U0FnTJJ4LyTs23kX3WfI,10847
|
|
5
|
+
maturin-1.9.4.dist-info/licenses/license-mit,sha256=6niCxVlzN2atCDQ73h0eyApJZ8A6c4-44AWO9iife3w,1051
|
|
6
|
+
maturin/__init__.py,sha256=D4vwQz8nQmcHfAQYVq1w-22BW2aYzUwqUoS9BDN41vM,8135
|
|
7
|
+
maturin/__main__.py,sha256=Fg40Rg6srWYrH0s2ZgbIOysRDnZf2tX-z5VJAPyOs4Y,1145
|
|
8
|
+
maturin/bootstrap.py,sha256=U_jynfhC471rOty8unVExBqf4RCZQxhxl_wyl0shCO4,1172
|
|
9
|
+
maturin-1.9.4.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
Copyright (c) 2018 konstin
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any
|
|
4
|
+
person obtaining a copy of this software and associated
|
|
5
|
+
documentation files (the "Software"), to deal in the
|
|
6
|
+
Software without restriction, including without
|
|
7
|
+
limitation the rights to use, copy, modify, merge,
|
|
8
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
9
|
+
the Software, and to permit persons to whom the Software
|
|
10
|
+
is furnished to do so, subject to the following
|
|
11
|
+
conditions:
|
|
12
|
+
|
|
13
|
+
The above copyright notice and this permission notice
|
|
14
|
+
shall be included in all copies or substantial portions
|
|
15
|
+
of the Software.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
18
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
19
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
20
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
21
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
22
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
24
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
25
|
+
DEALINGS IN THE SOFTWARE.
|