Skip to content

Commit

Permalink
docs: rust (#1816)
Browse files Browse the repository at this point in the history
* docs: add FAQ entry on Rust

Signed-off-by: Henry Schreiner <[email protected]>

* ci: make readthedocs faster

Signed-off-by: Henry Schreiner <[email protected]>

* Update docs/faq.md

* Update docs/faq.md

* Update faq.md

* Update docs/faq.md

* Update docs/faq.md

Co-authored-by: Matthieu Darbois <[email protected]>

* Apply suggestions from code review

---------

Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: Matthieu Darbois <[email protected]>
  • Loading branch information
henryiii and mayeut authored May 12, 2024
1 parent 44c4742 commit 6dd4f15
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
19 changes: 8 additions & 11 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,11 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"

python:
install:
- method: pip
path: .
extra_requirements:
- docs

mkdocs:
configuration: mkdocs.yml
python: "3.12"
commands:
- asdf plugin add uv
- asdf install uv latest
- asdf global uv latest
- uv venv
- uv pip install .[docs]
- .venv/bin/python -m mkdocs build --site-dir $READTHEDOCS_OUTPUT/html
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -307,4 +307,4 @@ See also

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.

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.
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.
21 changes: 21 additions & 0 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,27 @@ For these reasons, it's strongly recommended to not use brew for native library
[Homebrew]: https://brew.sh/
[delocate]: https://github.com/matthew-brett/delocate

### Building Rust wheels

If you build Rust wheels, you need to download the Rust compilers in manylinux.
If you support 32-bit Windows, you need to add this as a potential target. You
can do this on GitHub Actions, for example, with:

```yaml
CIBW_BEFORE_ALL_LINUX: curl -sSf https://sh.rustup.rs | sh -s -- -y
CIBW_BEFORE_ALL_WINDOWS: rustup target add i686-pc-windows-msvc
CIBW_ENVIRONMENT_LINUX: "PATH=$HOME/.cargo/bin:$PATH"
```

Rust does not provide Cargo for musllinux 32-bit, so that needs to be skipped:

```toml
[tool.cibuildwheel]
skip = ["*-musllinux_i686"]
```

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).

### macOS: ModuleNotFoundError

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.
Expand Down

0 comments on commit 6dd4f15

Please sign in to comment.