Merge pull request #3411 from OliverFM/main

Update docs with fresher bazel example
This commit is contained in:
David Hewitt 2023-08-29 06:17:51 +00:00 committed by GitHub
commit cc1aa598cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -88,7 +88,12 @@ You can then open a Python shell in the output directory and you'll be able to r
If you're packaging your library for redistribution, you should indicated the Python interpreter your library is compiled for by including the [platform tag](#platform-tags) in its name. This prevents incompatible interpreters from trying to import your library. If you're compiling for PyPy you *must* include the platform tag, or PyPy will ignore the module.
See, as an example, Bazel rules to build PyO3 on Linux at https://github.com/TheButlah/rules_pyo3.
#### Bazel builds
To use PyO3 with bazel one needs to manually configure PyO3, PyO3-ffi and PyO3-macros. In particular, one needs to make sure that it is compiled with the right python flags for the version you intend to use.
For example see:
1. https://github.com/OliverFM/pytorch_with_gazelle -- for a minimal example of a repo that can use PyO3, PyTorch and Gazelle to generate python Build files.
2. https://github.com/TheButlah/rules_pyo3 -- which has more extensive support, but is outdated.
#### Platform tags