-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New Bound
API implementation tracking issue
#3684
Comments
I'm wondering if we can kill two birds with one stone here:
That should produce a relatively small number of deprecation warnings and compile failures, while making it relatively easy for users to keep going with these APIs for now if they wish. Then in 0.22 we can get more aggressive about gating the whole lot of gil ref APIs away with a feature etc. |
Generally I've put myself down for anything that involves wrangling with the #3606 branch, as I'm quite familiar with what's on there and have been rebasing it fairly regularly to keep up with adjustments that we decide in review. I'll proceed to rebase + split that branch up into PRs so that we can get all that in. One exception: I'm going to start immediately with a PR to do the renaming of |
I know it is a lot of additional work, but we might want to treat this as a blocker, so that we are at least compatible with gevent by never touching the pool if the user code does not do it explicitly.
I also think we should definitely put the pool behind a feature, at the minimum to enable internal testing whether so a no-pool build is complete and works which I think would not be possible via deprecation. I am still undecided whether to argue for default-on or default-off though. |
Sure thing. TBH I think a very large chunk of that is on #3606 because I worked hard to get
I'd slightly prefer default-off, because we only get one time really to ask users to add |
Added item about updating |
I've added a section which lists the reviews currently outstanding, to help direct attention towards the PRs which will move this forward. |
@Icxolu @snuderl as there's now three of us implementing pieces off this list, perhaps let's message here before we start implementing things just so that we don't end up duplicating work? For my side, I have a few PRs still open for review which are listed above. Next time I have a good moment for implementation, I think my attention is best spent finishing #3744. I'd also like to write the update for |
I also added a bunch of items which I know are still missing under the "Add Bound constructor variants to all Python types" bullet above. |
Implement new API for PyNone #3684
Good idea, |
Sounds to me like Discord is easiest. |
@LilyFoote @Icxolu, as you two have been helping so much with this implementation (thank you so much, you have really sped things up), I thought I'd just take stock quickly and see what we think there is left remaining before release. There are a few bullets left unchecked, mostly around internal cleanup and documentation now.
Do you see much else remaining? Do you have items you plan to do, or want to take on from the above list? I'm hopeful we can finally release this within the next two weeks! 🚀 |
I think this sums it up quite nicely. I've just looked into allowing |
Off the back of #3897 (comment) - I think we did previously intend to seal the |
I just thought of #3928 which might solve the |
This is so close to ready now, thank you so much everyone! I just added a bunch of new bullets with ideas of further places the proc macro code could emit deprecation warnings. I hope to start taking a look at those after we've pushed a beta release. If anyone else feels like having a play with them, feel free to do so. Other than that, I'm going to hopefully see #3928 and #3906 done and then get the beta release live. Hopefully we can get the deprecation warnings solved relatively quickly and then prep the final 0.21 release! |
I think with the last couple PRs, this list is now, finally complete. What a huge effort here, thank you everyone! I've moved the follow-ups to #3960 and I think it makes sense to continue there, this issue is long enough already. |
This is a tracking issue for #3382
PRs currently waiting for review (all input is greatly appreciated, doesn't need to be an existing maintainer):
#3708
TODO (this list is a fairly good coverage of all PRs which occurred for the Bound implementation, but it is probably not complete):
What to do with constructors e.g.We have decided we will introducePyTuple::new
which return gil refs?new_bound
variants of these constructors in 0.21 and let migration be incremental over a few release cycles, eventually changingPyTuple::new
etc. in maybe 0.23.Py2
->Bound
andPy2Borrowed
->Borrowed
- make Bound and Borrowed types public API #3686PyXMethods
traits for types which have&self
methodsPyCapsuleMethods
- implementPyCapsuleMethods
#3770PyComplexMethods
- implementPyComplexMethods
#3767datetime
types - implement datetime traits forBound
#3679PyFrozenSetMethods
- implementPySetMethods
andPyFrozenSetMethods
#3694PyModuleMethods
- implementPyModuleMethods
#3703PySetMethods
- implementPySetMethods
andPyFrozenSetMethods
#3694PySliceMethods
- implementPyTracebackMethods
andPySliceMethods
#3763PyTracebackMethods
- implementPyTracebackMethods
andPySliceMethods
#3763PyTupleMethods
- implementPyTupleMethods
#3681PyTypeMethods
- implementPyTypeMethods
#3705Bound
constructor variants to all Python types, and also_bound
method variants where applicable (this list is not exhaustive, will add as things are found).PyComplex
- portPyComplex::from_complex
toBound
API #3866datetime
types - add_bound
constructors for datetime types #3778Python
(lots of methods)Python::eval
toBound
API #3806Python::run
toBound
API #3816Python::import
toBound
API #3832Python::get_type
toBound
API #3846dict
constructors - deprecatePyDict::new
constructor #3823PyEllipsis
- PyEllipsis and PyNotImplemented new get_bound api #3797PyCFunction
/PyFunction
- PyCFunction bound api #3800PyNotImplemented
- PyEllipsis and PyNotImplemented new get_bound api #3797PyModule
constructors - addPyModule::new_bound
andPyModule::import_bound
#3775PyType
- implementPyTypeMethods
#3705PyBuffer::get
- convertPyBuffer
toBound
API #3836pyo3::marshal
dumps / loads - convertmarshal
toBound
API #3796PyTypeInfo
methods - addbound
method variants forPyTypeInfo
#3782PyErr::from_type
,PyErr::value
etc. (lots of methods ofPyErr
need updating)PyErr::from_type
toBound
API #3885PyUnicodeDecodeError
constructorsFromPyObject
to take&Bound<'py, PyAny>
instead of&'py PyAny
extract_bound
method to FromPyObject #3706fn extract
withfn extract_bound
forFromPyObject
implementations - migrate manyFromPyObject
implementations toBound
API #3784FromPyObject
for&str
,Cow<[u8]>
and&[u8]
- addFromPyObjectBound
trait for extracting&str
without GIL Refs #3928#[derive(FromPyObject)]
proc macro needs generated output updated - update#[derive(FromPyObject)]
to useextract_bound
#3828Bound<T>
the replacement for&PyCell<T>
.#[pyclass]
accessors like.borrow()
,borrow_mut()
toBound<'_, T: PyClass>
- pyclass methods forBound
#3792&PyCell
member from internals ofPyRef
andPyRefMut
- storeBound<T>
insidePyRef
andPyRefMut
#3860PyCell
from proc macro code (#[pymethods]
method receivers) - allowBound<'_, T>
in #[pymethods]self
position #3896PyCell::new
- deprecatePyCell::new
in favor ofPy::new
orBound::new
#3872PyCell<T>
as a user-facing type - deprecate the use ofPyCell
in favor ofBound
andPy
#3916as_ref
,into_ref
UpdateFor now I just reverted Change return types ofpy.None()
,py.Ellipsis()
andpy.NotImplemented()
to returnBorrowed<'py, 'py, PyNone>
(etc.)py.None()
,py.NotImplemented()
andpy.Ellipsis()
to typed singletons #3578 in Revert "Merge pull request #3578 from davidhewitt/typed-helpers" #3794, to make this problem go away, will add to the polish list instead.#[classmethod]
and#[pyfunction(pass_module)]
- supportBound
forclassmethod
andpass_module
#3831#[pymodule]
macro to take&Bound<'py, PyModule>
as the argument. Pymodule bound #3897#[pyo3(from_py_with)]
on function arguments - allowfrom_py_with
on function args to take afn(&Bound) -> PyResult
#3837#[pyfunction]
argument processing - updateextract_argument
to use Bound APIs #3708Py::as_ref
- deprecate Py::as_ref #3864Py::into_ref
- Deprecate Py::into_ref #3867Python::from_owned_ptr
methods - Deprecatepy.from_owned_ptr
methods #3875Python::from_borrowed_ptr
methods - deprecatefrom_borrowed_ptr
methods #3915&PyModule
in#[pymodule]
- deprecate&PyModule
as#[pymodule]
argument type #3936&PyModule
in#[pyfunction(pass_module)]
- deprecate gil-refs in "self" position #3943&PyAny
in#[pyo3(from_py_with)]
- deprecate gil-refs infrom_py_with
#3967, deprecate gil-refs infrom_py_with
(Part 2) #3972wrap_pyfunction!(foo, py)
towrap_pyfunction_bound!(foo, py)
(just for thePython
second argument)Decide whether we continue to test this huge volume of deprecated APIs- I think for now I'm not bothering to remove tests which operate on GIL Refs. It's quite possible that when we deprecate the feature we end up with a bit of temporary deprecation, but overall if some of the GIL Ref APIs miss coverage it won't be a huge problem if they are basically all just wrappers around theBound
API.types.md
documentation forBound<T>
- docs: major rewrite for Bound API #3906Bound<T>
is cheap / shallow.PyAnyMethods
etc traits on a path other thanpyo3::prelude
- reexportPyAnyMethods
and friends frompyo3::types
#3895Deref
implementation forBound<T>
works forBound<T: PyClass>
- fixAsRef
andDeref
impls onBound<T>
#3879Possible polish to consider later: Moved to #3960
I'll try to keep this updated as we go, and probably there are items which I've missed right now.
If anyone wants to claim any of these unassigned tasks, please ping here and I'll update this so that we don't race.
The text was updated successfully, but these errors were encountered: