Commit Graph

91 Commits

Author SHA1 Message Date
David Hewitt 75af678f43
docs: use kebab-case instead of snake_case for guide URLs (#3942)
* guide: use kebab-case instead of snake_case

* fixup doctest names

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>

* review: Icxolu

* fix relative url

* also remap latest pyo3

* fixup python_from_rust

---------

Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-03-09 20:10:58 +00:00
David Hewitt 4efc4b82a3
ci: fix redundant import warnings on nightly (#3873) 2024-02-19 22:07:05 +00:00
David Hewitt f5eafe23f2
add maximum Python version check (#3821)
* add maximum Python version check

* restore dependency of `pyo3-macros-backend` on `pyo3-build-config`

* fix clippy-all noxfile job
2024-02-13 21:52:53 +00:00
Alex Gaynor d92792f8ad Fixes #3645 -- added `abi3-py312` feature 2023-12-21 10:40:14 -05:00
David Hewitt 852e4fea04 add link to user guide to cross compile error message 2023-10-30 22:21:56 +00:00
David Hewitt e284f3669f add coverage for `emit_pyo3_cfgs` 2023-10-25 22:59:43 +01:00
David Hewitt f0f15edc4e remove some redundant explicit doc links 2023-09-08 15:36:24 +01:00
David Hewitt 43b37109de Revert "Fix the pydebug with trace refs and count_allocs for python > 3.7"
This reverts commit c780aa931d.
2023-08-15 08:41:22 +01:00
David Hewitt d67a8dc0a1 link against pythonXY_d.dll for debug Python on Windows 2023-02-07 07:23:17 +00:00
messense f8e2a26439
Warn about unknown config keys in `PYO3_CONFIG_FILE` 2023-01-29 10:49:27 +08:00
messense 7e89456c77
Remove `libpython.so` from cross compile error message 2023-01-05 17:07:21 +08:00
David Hewitt f2608a923c remove functionality deprecated in 0.16 2022-12-28 12:23:53 +00:00
David Hewitt 97487ffbb5 add abi3-py311 feature 2022-11-23 08:08:12 +00:00
messense dee791de90
`pyo3-build-config`: rebuild when `PYO3_ENVIRONMENT_SIGNATURE` value changed 2022-11-09 20:28:18 +08:00
David Hewitt 8102ad1a1b rust: updates for 1.64 2022-09-22 21:03:34 +02:00
messense dfe223619a
Add support for generating PyPy Windows import library 2022-07-14 14:22:33 +08:00
David Hewitt c4a2c6c912 clippy: fix some warnings from beta toolchain 2022-07-12 23:02:47 +01:00
Bruno Kolenbrander 58d4ba833e
Rust 1.62 (#2489)
* Rust 1.62

* Make rust happy

* Just use a doctest instead

Co-authored-by: mejrs <>
2022-07-02 16:08:01 +01:00
messense 2bd24565c4
Rename `fixup_import_libs` to `generate_import_libs` 2022-05-28 15:07:10 +08:00
messense 4787ad75c9
Add a `default_lib_name_for_target` function 2022-05-28 14:59:10 +08:00
messense 4986d8ee7f
Fixup `lib_name` when using `PYO3_CONFIG_FILE` 2022-05-28 13:58:54 +08:00
messense ded0d9fc93
Allow false positive `clippy::unnecessary-wraps` lint 2022-05-14 20:45:03 +08:00
messense 742774cdb5
Auto generate Windows import libraries when using a pyo3 config file 2022-05-14 20:45:02 +08:00
messense df6e9bcdb2
Change default python lib name for Windows when cross compiling
Stop treating `gnu` abi as mingw by default.
2022-05-12 14:32:21 +08:00
messense c477718fe7
Add support for generating non-abi3 python import libraries for Windows
targets
2022-05-12 14:32:20 +08:00
messense 10cb5a1f95
pyo3-build-config: switch to `python3_dll_a::ImportLibraryGenerator` 2022-05-12 14:32:17 +08:00
David Hewitt 8cd551fdfc
Merge pull request #2293 from ravenexp/abi3-no-python
pyo3-build-config: Build "abi3" extensions without an interpreter
2022-04-14 07:55:53 +01:00
Sergey Kvachonok ae7e1f5ee9 pyo3-build-config: Build "abi3" extensions without an interpreter
Support compiling portable "abi3" extension modules even when
the build host Python interpreter configuration is not available
or the discovered Python interpreter version is not supported.

Maturin already implements this by building "abi3" extension wheels
with `PYO3_NO_PYTHON` environment veriable set for cargo when
an `abi3-py3*` feature is detected.

Closes #2292
2022-04-13 10:40:08 +03:00
Adam Reichold 58b7081274 Use more robust hexadecimal escaping of interpreter configuration. 2022-04-12 20:53:03 +02:00
Sergey Kvachonok 479fe6781f pyo3-build-config: Add `python3-dll-a` crate support
Automatically generate `python3.dll` import libraries for Windows
compile targets in the build script.

Adds a new PyO3 crate feature `generate-abi3-import-lib` enabling
automatic import library generation.

Closes #2231
2022-04-10 16:45:32 +03:00
Sergey Kvachonok 8f9976ad33 pyo3-build-config: Use "m" ABI tag for libpython-3.7 by default
According to https://bugs.python.org/issue36707, this tag is useless
since version 3.4, but also the default until version 3.8.

For example, Debian 10 ships `libpython3.7m.so`.
2022-04-09 13:28:44 +03:00
Sergey Kvachonok 29476b0d0d pyo3-build-config: Inline the `PYO3_NO_PYTHON` switch
This patch folds the `PYO3_NO_PYTHON` + `abi3` special case into
the existing native and cross compilation code paths.

The cross compilation route is now guaranteed to behave the same
whether `PYO3_NO_PYTHON` is set or not (except for sysconfigdata
discovery for the Unix targets).

The native compilation route now stores the hardcoded abi3 interpreter
configuration in place of the discovered configuration blob.
2022-04-05 17:19:49 +03:00
David Hewitt 1ae0971a09 release: 0.16.3 2022-04-05 04:05:57 +01:00
Sergey Kvachonok 80675361f4 pyo3-build-config: Add `PYO3_CROSS_PYTHON_IMPLEMENTATION` env var
Adds a new cross-compile target interpreter configuration
environment variable.

This feature allows PyO3 to target PyPy on both Windows and Unix
cross compile targets.
2022-04-04 15:23:11 +03:00
Sergey Kvachonok ccda497e04 pyo3-build-config: Create per-target cross config files
Rename `$OUT_DIR/pyo3-cross-compile-config.txt` to
`$OUT_DIR/<triple>/pyo3-build-config.txt` to exclude the possibility
of using stale build configuration data when the build target changes.

Use the presence of the corresponding build configuration file
in the `pyo3-build-config` build script output directory
to detect whether we are cross compiling or not.

This patch enables cross compilation without using
any of `PYO3_CROSS_*` env variables in many cases.
2022-04-01 11:32:46 +03:00
Sergey Kvachonok 328e7d69f6 pyo3-build-config: Try "default" cross-compilation
Try to generalize `windows_hardcoded_cross_compile()`
to all supported target platforms (when possible).
Rename it to `default_cross_compile()` and add some unit tests.

Rewrite `load_cross_compile_config()` to fall back to
the default interpreter configuration when no other config
information sources are available.
2022-04-01 11:32:46 +03:00
Sergey Kvachonok 54ae025722 pyo3-build-config: Make `lib_dir` optional in `CrossCompileConfig`
Change the `CrossCompileConfig` structure definition and make
the public `lib_dir` field optional to support more flexible
cross-compilation configuration in the future.

FIXME: This change breaks the public `pyo3-build-config` crate API.

Update the sysconfigdata extraction functions to fall through
when `lib_dir` field is not set.

WIP: Add `unwrap()` stubs to the main cross compile switch.
2022-04-01 11:32:46 +03:00
Sergey Kvachonok 9b45a19161 pyo3-build-config: Replace `TargetInfo` with `target_lexicon::Triple`
Add a new public crate function `cross_compile_from_to()` using
`target_lexicon::Triple` arguments instead of plain strings
used in `cross_compile()`.

Deprecate `pyo3_build_config::cross_compile()` since v0.17.

Attempt to extract common code patterns into methods and standalone
helper functions. Add docstrings to the new private items.
Make some of the new helper functions public within the PyO3 crate
and reuse them in the build scripts.

Add PYO3_CROSS_PYTHON_VERSION parsing unit test.

Add a ChangeLog entry mentioning the new `pyo3-build-config` API.
2022-04-01 09:36:49 +03:00
David Hewitt 2813c87eaf
Merge pull request #2092 from aganders3/export-conf
Add export-config feature to pyo3-build-config
2022-03-23 11:16:04 +00:00
Sergey Kvachonok 5237000317 pyo3-build-config: Fix `abi3-py310` feature
Fix `abi3-py310` feature: use Python 3.10 ABI when available
instead of silently falling back to the 3.9 ABI.
2022-03-23 09:45:25 +03:00
Ashley Anderson 4a62a62cae Improvements based on code review: API and documentation. 2022-03-21 12:55:39 -04:00
Ashley Anderson bbe7a493d6 Refactor to serialize the whole InterpreterConfig into DEP_PYTHON_PYO3_CONFIG 2022-03-17 12:10:38 -04:00
Ashley Anderson bc356f23e0 Fix coverage for pyo3-build-config CI ("full" feature) 2022-03-17 11:20:37 -04:00
Ashley Anderson 161d79fae3 Fix test for MSRV 2022-03-17 11:20:37 -04:00
Ashley Anderson 14bd6282ad Add test for export-config round trip. 2022-03-17 11:20:37 -04:00
Ashley Anderson 04b8652612 Fix test on windows (line ending mismatch). 2022-03-17 11:20:37 -04:00
Ashley Anderson ef4b91256d Add tests for run_python_script*. 2022-03-17 11:20:36 -04:00
Ashley Anderson cb3effdb96 Additon conditional compilation for InterpreterConfig::from_pyo3_export_config 2022-03-17 11:19:27 -04:00
Ashley Anderson 755bf97fdb Add export-config feature to pyo3-build-config. 2022-03-17 11:19:27 -04:00
Kevin Phillips 34ff72f6ba Added a test for PYTHONFRAMEWORK 2022-03-17 08:41:26 +01:00