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
caf80eca66
handle clippy `new_without_default` warnings ( #3971 )
...
* handle clippy `new_without_default` warnings
* add newsfragment
2024-03-19 21:41:27 +00:00
David Hewitt
02e188e4b4
adjust path for GIL Refs deprecation warnings ( #3968 )
2024-03-19 21:08:20 +00:00
David Hewitt
cbed7c11b6
ci: tidy ups for 3.7 ( #3969 )
2024-03-19 19:36:22 +00:00
David Hewitt
e29fac9c46
docs: use details to condense migration guide ( #3961 )
2024-03-19 08:59:05 +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
ebeea943fe
ci: fixes to actions caches ( #3970 )
2024-03-19 08:14:42 +00:00
Icxolu
da24f0cf93
exposes `Borrowed::to_owned` as public API ( #3963 )
...
* exposes `Borrowed::to_owned` as public API
* add newsfragment
2024-03-17 09:17:09 +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
5c86dc35c1
allow borrowed extracts with `gil-refs` disabled ( #3959 )
2024-03-15 07:53:52 +00:00
Bruno Kolenbrander
989d2c53ab
Fix non_local_definitions lint triggers ( #3955 )
2024-03-12 22:59:33 +00:00
Thomas Tanon
7cde95bba4
Documents experimental-declarative-modules feature ( #3953 )
...
* Documents experimental-declarative-modules feature
* More details on experimental-declarative-modules progress
2024-03-12 22:57:31 +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
Georg Brandl
a7fa1bdf22
fix: remove "track_caller" cfg check ( #3951 )
...
This "cfg" value does not seem to exist (any more?), and #[track_caller]
is used a lot elsewhere without cfg_attr.
Found using cargo check -Zcheck-cfg.
2024-03-11 12:40:26 +00:00
acceptacross
93323bc922
chore: remove repetitive words ( #3950 )
...
Signed-off-by: acceptacross <csqcqs@gmail.com>
2024-03-11 10:15:03 +00:00
David Hewitt
67b1b35013
release: 0.21.0-beta.0 ( #3944 )
2024-03-10 22:16:18 +00:00
David Hewitt
db0a98c040
ci: pin pytest < 8.1 ( #3946 )
2024-03-10 16:17:15 +00:00
David Hewitt
9145fcfe19
docs: major rewrite for Bound API ( #3906 )
...
* wip bound docs
* Update guide/src/python_from_rust/calling-existing-code.md
Co-authored-by: Lily Foote <code@lilyf.org>
* continue to move and tidy up
* Apply suggestions from code review
Co-authored-by: Lily Foote <code@lilyf.org>
* update URL
* complete python-from-rust.md
* progress on types.md; probably more to go
* update doctest paths
* review: Icxolu
* finish updating `types.md` to Bound API
* update remainder of the guide to Bound API
* Update guide/src/performance.md
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Update guide/src/types.md
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* Update src/lib.rs
* review: Icxolu
* Update guide/src/python-from-rust.md
Co-authored-by: Adam Reichold <adamreichold@users.noreply.github.com>
* Update guide/src/async-await.md
Co-authored-by: Adam Reichold <adamreichold@users.noreply.github.com>
* review: adamreichold
---------
Co-authored-by: Lily Foote <code@lilyf.org>
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
Co-authored-by: Adam Reichold <adamreichold@users.noreply.github.com>
2024-03-10 15:51:51 +00:00
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
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
14d1d2a9ee
docs: use `lychee` to check link URLs ( #3941 )
...
* guide: install `mdbook-linkcheck`
* use `shutil` to copy license files
* move from `mdbook-linkcheck` to `lychee`
* clean guide & doc build products before build
* fix more broken links
* review: mejrs
2024-03-08 14:10:47 +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
Thomas Tanon
fbd531195a
PyAddToModule: Properly propagate initialization error ( #3919 )
...
Better than panics
2024-03-06 18:20:02 +00:00
Thomas Tanon
0f7ddb19a5
PyPy: remove PyCode (PyCode_Type does not exist) ( #3934 )
2024-03-06 18:19:43 +00:00
Thomas Tanon
d35f41e0bf
Chrono: allow deprecation warning until upgrading to 0.4.35+ ( #3935 )
...
* Chrono: allow deprecation warning until upgrading to 0.4.35+
Requiring 0.4.35 is blocked on MSRV (Chrono: 1.61, PyO3: 1.56)
* also allow deprecated chrono in example
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-03-06 17:49:43 +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
David Hewitt
b08ee4b7e1
remove `gil-refs` feature from `full` feature ( #3930 )
2024-03-04 22:23:35 +00:00
Lily Foote
811a3e5d00
Add IntoIterator for &Bound types ( #3923 )
...
* Add IntoIterator for &Bound<'py, PyList>
* Add a test for Bound<'_, PyList>.into_iter
* Implement IntoIterator for more &Bound types
* Remove some explicit .iter() calls
* Implement IntoIterator for &Bound<'py, PyIterator>
2024-03-04 21:24:38 +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
Icxolu
00eb014623
docs: update Python function section of the guide ( #3925 )
...
* docs: update Python function section of the guide
* update `pass_module` types
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
2024-03-03 09:15:46 +00:00
David Hewitt
2e56f659ed
split `PyCell` and `PyClassObject` concepts ( #3917 )
...
* add test for refguard ref counting
* split `PyCell` and `PyClassObject` concepts
* rework `create_cell` to `create_class_object`
* Apply suggestions from code review
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
* review: Icxolu feedback
---------
Co-authored-by: Icxolu <10486322+Icxolu@users.noreply.github.com>
2024-03-03 07:00:59 +00:00
Icxolu
81be11e67a
docs: update Python modules section of the guide ( #3924 )
2024-03-02 22:55:05 +00:00
Lily Foote
d94827720e
Delete duplicate test code ( #3926 )
...
These used to explicitly call `.iter()`, but that was removed in b65cbb9
to remove lints.
2024-03-02 22:53:28 +00:00
Icxolu
1c5265e1c2
deprecate `from_borrowed_ptr` methods ( #3915 )
...
* deprecate `from_borrowed_ptr` methods
This deprecates the methods on the `Python`
marker, aswell as `FromPyPointer`
* use `BoundRef` to defer ref cnt inc until after the error case
2024-03-01 20:51:53 +00:00
Icxolu
1d224610c3
docs: update `Python classes` section of the guide ( #3914 )
...
* docs: update `Python classes` section of the guide
* review feedback davidhewitt
* migration guide entry
2024-03-01 09:21:47 +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
David Hewitt
a582fa0163
docs: update discord invite to permanent one ( #3913 )
2024-02-28 20:51:40 +00:00
Icxolu
55833365b5
seals `PyAnyMethods` and friends ( #3909 )
...
* seals `PyAnyMethods` and friends
This seals these new traits, preventing downstream
crates from implementing them on their types.
These traits are mainly a workaround for arbitrary
self receiver types, so this gives us more
flexibility if these need to be changed in the
future.
* move `PyResultExt` seal
2024-02-28 19:36:55 +00:00
David Hewitt
8a12970c96
update `extract_argument` to use Bound APIs ( #3708 )
...
* update `extract_argument` to use `Bound` APIs
* tidy up borrow in macros expression
* update `trybuild` output
* more concise form for `DowncastError::new`
Co-authored-by: Lily Foote <code@lilyf.org>
* use `Borrowed` instead of newtype
* use `Borrowed::from_ptr` methods in extract_argument
* update UI tests
* avoid double-negative `#[cfg]` clauses
Co-authored-by: Lily Foote <code@lilyf.org>
* review: LilyFoote, Icxolu feedback
---------
Co-authored-by: Lily Foote <code@lilyf.org>
2024-02-28 19:36:20 +00:00
Matthew Neeley
a15e4b1a11
Allow pymodule functions to take a single Bound<'_, PyModule> arg ( #3905 )
2024-02-27 22:24:14 +00:00
Icxolu
6f03a5464f
cleans up `PyCFunction::internal_new` ( #3910 )
...
This deduplicates some code around `PyCFunction::internal_new`
2024-02-27 22:15:35 +00:00
Lily Foote
a3ad28b70c
Pymodule bound ( #3897 )
...
* Support Bound in pymodule and pyfunction macros
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
* Remove spurious $ character
Co-authored-by: Matthew Neeley <mneeley@gmail.com>
* Rework PyCFunction::new_bound signatures
This allows us to remove the awkward `PyFunctionArgumentsBound` enum.
* Use BoundRef instead of BoundModule
* support argument deduction for `wrap_pyfunction_bound!`
* support `wrap_pyfunction!` with `Bound` input/output
* Fix docs link to `wrap_pyfunction_bound!`
* Revert back to wrap_pyfunction!
---------
Co-authored-by: David Hewitt <mail@davidhewitt.dev>
Co-authored-by: Matthew Neeley <mneeley@gmail.com>
2024-02-27 19:19:52 +00:00
David Hewitt
93704047a5
store `Bound<T>` inside `PyRef` and `PyRefMut` ( #3860 )
...
* store `Bound<T>` inside `PyRef` and `PyRefMut`
* update `FromPyObject` for `PyRef` to use `extract_bound`
* review: Icxolu feedback
2024-02-27 18:56:22 +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
David Hewitt
cd1c0dbf39
ci: move cross compile tests to their own jobs ( #3887 )
...
* ci: move cross compile tests to their own jobs
* don't run cross-compile jobs on regular PRs
2024-02-26 21:47:35 +00:00
David Hewitt
8e2219b0d9
silence non-local-definitions nightly lint ( #3901 )
...
* silence non-local-definitions nightly lint
* add newsfragment
* add FIXMEs for `non_local_definitions`
* also allow `non_local_definitions` in doctests
2024-02-26 20:28:04 +00:00