Skip to content

Commit 6dd4f15

Browse files
henryiiimayeut
andauthored
docs: rust (#1816)
* docs: add FAQ entry on Rust Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * ci: make readthedocs faster Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> * Update docs/faq.md * Update docs/faq.md * Update faq.md * Update docs/faq.md * Update docs/faq.md Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com> * Apply suggestions from code review --------- Signed-off-by: Henry Schreiner <henryschreineriii@gmail.com> Co-authored-by: Matthieu Darbois <mayeut@users.noreply.github.com>
1 parent 44c4742 commit 6dd4f15

File tree

3 files changed

+30
-12
lines changed

3 files changed

+30
-12
lines changed

.readthedocs.yml

+8-11
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,11 @@ version: 2
55
build:
66
os: ubuntu-22.04
77
tools:
8-
python: "3.11"
9-
10-
python:
11-
install:
12-
- method: pip
13-
path: .
14-
extra_requirements:
15-
- docs
16-
17-
mkdocs:
18-
configuration: mkdocs.yml
8+
python: "3.12"
9+
commands:
10+
- asdf plugin add uv
11+
- asdf install uv latest
12+
- asdf global uv latest
13+
- uv venv
14+
- uv pip install .[docs]
15+
- .venv/bin/python -m mkdocs build --site-dir $READTHEDOCS_OUTPUT/html

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -307,4 +307,4 @@ See also
307307

308308
Another very similar tool to consider is [matthew-brett/multibuild](http://github.com/matthew-brett/multibuild). `multibuild` is a shell script toolbox for building a wheel on various platforms. It is used as a basis to build some of the big data science tools, like SciPy.
309309

310-
If you are building Rust wheels, you can get by without some of the tricks required to make GLIBC work via manylinux; this is especially relevant for cross-compiling, which is easy with Rust. See [maturin-action](https://github.com/messense/maturin-action) for a tool that is optimized for building Rust wheels and cross-compiling.
310+
If you are building Rust wheels, you can get by without some of the tricks required to make GLIBC work via manylinux; this is especially relevant for cross-compiling, which is easy with Rust. See [maturin-action](https://github.com/PyO3/maturin-action) for a tool that is optimized for building Rust wheels and cross-compiling.

docs/faq.md

+21
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,27 @@ For these reasons, it's strongly recommended to not use brew for native library
282282
[Homebrew]: https://brew.sh/
283283
[delocate]: https://github.com/matthew-brett/delocate
284284

285+
### Building Rust wheels
286+
287+
If you build Rust wheels, you need to download the Rust compilers in manylinux.
288+
If you support 32-bit Windows, you need to add this as a potential target. You
289+
can do this on GitHub Actions, for example, with:
290+
291+
```yaml
292+
CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
293+
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
294+
CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
295+
```
296+
297+
Rust does not provide Cargo for musllinux 32-bit, so that needs to be skipped:
298+
299+
```toml
300+
[tool.cibuildwheel]
301+
skip = ["*-musllinux_i686"]
302+
```
303+
304+
Also see [maturin-action](https://github.com/PyO3/maturin-action) which is optimized for Rust wheels, builds the non-Python Rust modules once, and can cross-compile (and can build 32-bit musl, for example).
305+
285306
### macOS: ModuleNotFoundError
286307

287308
Calling cibuildwheel from a python3 script and getting a `ModuleNotFoundError`? Due to a (fixed) [bug](https://bugs.python.org/issue22490) in CPython, you'll need to [unset the `__PYVENV_LAUNCHER__` variable](https://github.com/pypa/cibuildwheel/issues/133#issuecomment-478288597) before activating a venv.

0 commit comments

Comments
 (0)