Icxolu
aef0a05719
deprecate implicit default for trailing optional arguments ( #4078 )
...
* deprecate "trailing optional arguments" implicit default behaviour
* add newsfragment
* generate individual deprecation messages per function
* add migration guide entry
2024-05-10 10:34:58 +00:00
Icxolu
21c02484d0
feature gate APIs using `into_gil_ref` (Part 2) ( #4166 )
2024-05-09 22:21:48 +00:00
Icxolu
7beb64a8ca
allow constructor customization of complex enum variants ( #4158 )
...
* allow `#[pyo3(signature = ...)]` on complex enum variants to specify constructor signature
* rename keyword to `constructor`
* review feedback
* add docs in guide
* add newsfragment
2024-05-09 21:08:23 +00:00
Icxolu
635cb8075c
feature gate APIs using `into_gil_ref` (Part 1) ( #4160 )
2024-05-09 07:58:44 +00:00
Icxolu
e835ff0ec3
handle `#[pyo3(from_py_with = ...)]` on dunder (`__magic__`) methods ( #4117 )
...
* handle `#[pyo3(from_py_with = ...)]` on dunder (__magic__) methods
* add newsfragment
2024-05-04 07:39:40 +00:00
Icxolu
cd3f3ed67c
ci: updates for Rust 1.78 ( #4150 )
...
* ci: updates for Rust 1.78
* ci: fix clippy
* restrict `invalid_pymethods_duplicates` to unlimited api with `full`
2024-05-03 07:42:30 +00:00
Icxolu
cc7e16f4d6
Refactoring of `FnArg` ( #4033 )
...
* refactor `FnArg`
* add UI tests
* use enum variant types
* add comment
* remove dead code
* remove last FIXME
* review feedback davidhewitt
2024-04-14 14:19:57 +00:00
Icxolu
c8b59d7117
add `#[doc(hidden)]` to the Rust module created by `#[pymodule]` ( #4067 )
...
* add `#[doc(hidden)]` to the Rust module created by `#[pymodule]`
* add newsfragment
2024-04-12 06:34:08 +00:00
Icxolu
7a00b4d357
add descriptive error msg for `__traverse__` receivers other than `&self` ( #4045 )
...
* add descriptive error msg for `__traverse__` receivers other than `self`
* add newsfragment
* improve error message
2024-04-04 19:08:51 +00:00
Icxolu
8f87b8636d
refactor `#[setter]` argument extraction ( #4002 )
2024-04-01 12:10:18 +00:00
Icxolu
dd1710256d
use `extract_argument` for `#[setter]` extraction ( #3998 )
...
* use `extract_argument` for `#[setter]` extraction
* add newsfragment
2024-03-27 15:41:04 +00:00
Icxolu
35faeff6f1
handle `#[pyo3(from_py_with = "")]` in `#[setter]` methods ( #3995 )
...
* handle `#[pyo3(from_py_with = "")]` in `#[setter]` methods
* add newsfragment
2024-03-26 18:53:11 +00:00
David Hewitt
d0f5b6af46
ci: updates for Rust 1.77 ( #3978 )
...
* ci: updates for Rust 1.77
* move `SendablePtr` inside of test which uses it
2024-03-22 20:43:23 +00:00
David Hewitt
351c6a0a49
deprecate optional GIL Ref in function argument ( #3975 )
2024-03-21 07:24:40 +00:00
David Hewitt
870a4bb20d
deprecate GIL refs in function argument ( #3847 )
...
* deprecate GIL Refs in function arguments
* fix deprecated gil refs in function arguments
* add notes on deprecations limitations to migration guide
* Apply suggestions from code review
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* review: Icxolu
* fix proto method extract failure for option
* fix gil refs in examples
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-03-20 22:35:08 +00:00
Icxolu
2736cf670c
deprecate gil-refs in `from_py_with` (Part 2) ( #3972 )
...
* deprecate `from_py_with` in `#[derive(FromPyObject)]` (NewType)
* deprecate `from_py_with` in `#[derive(FromPyObject)]` (Enum, Struct)
2024-03-20 09:27:38 +00:00
David Hewitt
02e188e4b4
adjust path for GIL Refs deprecation warnings ( #3968 )
2024-03-19 21:08:20 +00:00
Icxolu
b06e95727b
deprecate gil-refs in `from_py_with` ( #3967 )
...
* deprecate gil-refs in `from_py_with`
* review feedback davidhewitt
2024-03-19 08:58:41 +00:00
David Hewitt
dcba984b51
deprecate `GILPool` ( #3947 )
...
* deprecate `GILPool`
* review: adamreichold
* fix deprecation warnings in tests
2024-03-15 10:25:27 +00:00
Icxolu
ee89b2e8e2
deprecate `wrap_pyfunction` with `py` argument ( #3954 )
...
* deprecate `wrap_pyfunction` with `py` argument
The Python token in `wrap_pyfunction` is not handled automatically by
`WrapPyFunctionArg`, for backwards compatibility. This uses deref
specialization to deprecate this variant.
* merge `Extractor`s
* add deprecation ui test, revert closure variant due to test failure
* fix nightly
2024-03-12 22:57:03 +00:00
Icxolu
908e661237
deprecate gil-refs in "self" position ( #3943 )
...
* deprecate gil-refs in "self" position
* feature gate explicit gil-ref tests
* fix MSRV
* adjust bracketing
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-03-09 09:52:12 +00:00
David Hewitt
770d9b7f01
add `FromPyObjectBound` trait for extracting `&str` without GIL Refs ( #3928 )
...
* add `FromPyObjectBound` adjustment for `&str` without GIL Refs
* review: alex, Icxolu feedback
* add newsfragment
* add newsfragment for `FromPyObject` trait change
* make some examples compatible with abi3 < 3.10
* seal `FromPyObjectBound`
* fixup chrono_tz conversion
2024-03-08 07:43:48 +00:00
Icxolu
31c4820010
deprecate `&PyModule` as `#[pymodule]` argument type ( #3936 )
...
* deprecate `&PyModule` as `#[pymodule]` argument type
* cleanup
* add ui tests
* fix deprecations in tests
* fix maturin and setuptools-rust starters
* run `deprecated` ui test only when `gil-refs` as disabled
2024-03-08 00:28:11 +00:00
David Hewitt
57bbc32e7c
add `experimental-async` feature ( #3931 )
...
* add `experimental-async` feature
* gate async doctests on feature
2024-03-06 00:54:45 +00:00
Thomas Tanon
fe84fed966
Allow inline struct, enum, fn and mod inside of declarative modules ( #3902 )
...
* Inline struct, enum, fn and mod inside of declarative modules
* remove news fragment
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-03-06 00:31:56 +00:00
Bruno Kolenbrander
4114dcb1a0
Thread pyo3's path through the builder functions ( #3907 )
...
* Thread pyo3's path through the builder functions
* preserve span of pyo3_path
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-03-04 07:54:04 +00:00
Icxolu
70a7aa808d
deprecate the use of `PyCell` in favor of `Bound` and `Py` ( #3916 )
...
* deprecate the use of `PyCell` in favor of `Bound` and `Py`
* update `FromPyObject` for `T: PyClass + Clone` impl
* move `PyCell` deprecation to the `gil-refs` feature gate and add a migration note
2024-03-03 14:47:25 +00:00
Lily Foote
56683ed553
deprecate Py::as_ref ( #3864 )
...
* Deprecate Py::as_ref
* Reword as_ref deprecation note
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Tidy up remaining uses of Py::as_ref
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Pass hello into println! explicitly
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-29 07:15:34 +00:00
Matthew Neeley
68ec6de0c9
Use single-arg form of `#[pymodule]` function in docs and tests ( #3899 )
...
* Use single-arg form for `#[pymodule]` functions in docs and tests
* Update guide/src/function.md
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Add test of two-argument module function
* Fix new test
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-02-28 22:36:50 +00:00
Lily Foote
5c41ea0ade
Implement `From<Bound<'py, T>>` for PyErr ( #3881 )
...
* Implement `From<Bound<'py, T>>` for PyErr
* Replace PyErr::from_value_bound calls with .into
* Fix From<MyError> expected error message
* Add a trait bound to From<Bound<'py, T>> for PyErr
2024-02-26 23:14:41 +00:00
Icxolu
7c10ff4327
allow `Bound<'_, T>` in #[pymethods] `self` position ( #3896 )
...
* allow `Bound<'_, T>` in #[pymethods] `self` position
* rename `TryFromPyCell` -> `TryFromBoundRef`
* remove unneccessary unsafe
2024-02-25 07:13:36 +00:00
Thomas Tanon
e0e3981e17
#[pymodule] mod some_module { ... } v3 ( #3815 )
...
* #[pymodule] mod some_module { ... } v3
Based on #2367 and #3294
Allows to export classes, native classes, functions and submodules and provide an init function
See test/test_module.rs for an example
Future work:
- update examples, README and guide
- investigate having #[pyclass] and #[pyfunction] directly in the #[pymodule]
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Georg Brandl <georg@python.org>
* tests: group exported imports
* Consolidate pymodule macro code to avoid duplicates
* Makes pymodule_init take Bound<'_, PyModule>
* Renames #[pyo3] to #[pymodule_export]
* Gates #[pymodule] mod behind the experimental-declarative-modules feature
* Properly fails on functions inside of declarative modules
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Georg Brandl <georg@python.org>
2024-02-24 13:50:18 +00:00
Lily Foote
e145ae851a
Update new_closure_bound closure signature ( #3883 )
...
* Update new_closure_bound closure signature
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Use anonymous lifetimes in closure bounds
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Take &Bound in PyCFunction closures
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-23 14:07:54 +00:00
David Hewitt
ec6d587218
support `Bound` for `classmethod` and `pass_module` ( #3831 )
...
* support `Bound` for `classmethod` and `pass_module`
* `from_ref_to_ptr` -> `ref_from_ptr`
* add detailed docs to `ref_from_ptr`
2024-02-16 00:36:11 +00:00
Icxolu
0c12d9137f
port `Python::import` to `Bound` API ( #3832 )
...
* port `Python::import` to `Bound` API
* tidy up imports in tests/test_datetime_import.rs
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-02-14 00:24:37 +00:00
Icxolu
c359f5ca1d
deprecate `PyDict::new` constructor ( #3823 )
...
* deprecate `PyDict::new`
* update benchmarks
* convert `test_frompyobject`
2024-02-11 23:55:56 +00:00
David Hewitt
bcb7b88c23
ci: updates for rust 1.76
2024-02-08 21:13:58 +00:00
Blaž Šnuderl
aa3c938b5e
PyCFunction bound api
2024-02-06 18:44:53 +01:00
David Hewitt
8f8d4d33fa
Merge pull request #3776 from davidhewitt/bound-extract
...
migrate `FromPyObject` for `Bound` and `Py` to new APIs
2024-02-02 23:10:47 +00:00
David Hewitt
a60c1821af
implement `PyFunctionArgument` for `&Bound<T>`
2024-02-01 13:22:53 +00:00
David Hewitt
c47565666d
add `PyString::new_bound`
2024-01-29 13:14:00 +00:00
Icxolu
7fddd983b4
update `test_compile_error` ui test output
2024-01-27 12:37:26 +01:00
Mate Kovacs
3ed5ddb0ec
feat: support pyclass on complex enums
2024-01-18 22:04:42 +09:00
David Hewitt
50e33d86c7
add `call_bound` and `call_method_bound`
2024-01-03 13:24:14 +00:00
David Hewitt
e42d8cf612
ci: updates for Rust 1.75
2023-12-29 13:36:46 +00:00
David Hewitt
0f242c399d
make `DowncastError` and `DowncastIntoError` public
2023-12-21 13:03:59 +00:00
David Hewitt
1451418ee4
Add `Py2` variants of `PyDowncastError`
2023-12-19 20:59:57 +00:00
Joseph Perez
8a674c2bd3
feat: add `coroutine::CancelHandle`
2023-12-04 07:46:51 +01:00
David Hewitt
5c6d49084f
remove all functionality deprecated in 0.19
2023-11-27 22:02:19 +00:00
David Hewitt
5ac56b8eb0
improve error for invalid `#[classmethod]` receivers
2023-11-24 03:24:46 +00:00