[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-11 Thread Robert Kern
On Wed, Oct 11, 2023 at 11:50 PM Aaron Meurer wrote: > Is there a way to make pickle not depend on the specific submodule > that a class is defined in? No. `Unpickler` somehow has to locate the class/reconstruction function. It will have to use the name given by the `__reduce_ex__` during

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-11 Thread Aaron Meurer
Is there a way to make pickle not depend on the specific submodule that a class is defined in? Wouldn't this happen again if you ever decided to rename _core. The underscores in numpy._core._reconstruct don't actually do anything here in terms of making the interface not public, and if anything,

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-11 Thread Nathan
On Wed, Oct 11, 2023 at 4:24 PM Mateusz Sokol wrote: > Hi! Thank you for all your feedback this week! > > We have made a decision to take a less disruptive option that we > considered and that came up in this discussion. > > We back out of the `NumpyUnpickler` class solution for reading pickles

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-11 Thread Mateusz Sokol
Hi! Thank you for all your feedback this week! We have made a decision to take a less disruptive option that we considered and that came up in this discussion. We back out of the `NumpyUnpickler` class solution for reading pickles across major NumPy versions. Instead, we will retain

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-10 Thread Nathan
On Tue, Oct 10, 2023 at 7:03 AM Ronald van Elburg < r.a.j.van.elb...@hetnet.nl> wrote: > I have one more useCase to consider from our ecosystem. > > We dump numpy arrays into a MongoDB using GridFS for subsequent > visualization, some snippets: > > '''Python > with BytesIO() as BIO: >

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-10 Thread Ronald van Elburg
I have one more useCase to consider from our ecosystem. We dump numpy arrays into a MongoDB using GridFS for subsequent visualization, some snippets: '''Python with BytesIO() as BIO: np.save(BIO, numpy_array) serialized_A = BIO.getvalue() filehandle_id =

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Oscar Benjamin
On Mon, 9 Oct 2023 at 23:12, Nathan wrote: > On Mon, Oct 9, 2023 at 3:58 PM Oscar Benjamin > wrote: >> >> On Mon, 9 Oct 2023 at 22:30, Nathan wrote: >> > >> > On Mon, Oct 9, 2023 at 3:12 PM Oscar Benjamin >> > wrote: >> >> >> >> I guess that makes it possible in some way to convert formats

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Nathan
On Mon, Oct 9, 2023 at 3:58 PM Oscar Benjamin wrote: > On Mon, 9 Oct 2023 at 22:30, Nathan wrote: > > > > On Mon, Oct 9, 2023 at 3:12 PM Oscar Benjamin < > oscar.j.benja...@gmail.com> wrote: > >> > >> On Mon, 9 Oct 2023 at 21:57, Nathan wrote: > >> > > >> > On Mon, Oct 9, 2023 at 2:44 PM Oscar

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Stephan Hoyer
On Mon, Oct 9, 2023 at 2:29 PM Nathan wrote: > However, one thing we can do now is, for that one particular symbol that > we know is going to be in every pickle file and probably never elsewhere, > is intercept that one import and instead of generating a generic warning > about np.core being

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Oscar Benjamin
On Mon, 9 Oct 2023 at 22:30, Nathan wrote: > > On Mon, Oct 9, 2023 at 3:12 PM Oscar Benjamin > wrote: >> >> On Mon, 9 Oct 2023 at 21:57, Nathan wrote: >> > >> > On Mon, Oct 9, 2023 at 2:44 PM Oscar Benjamin >> > wrote: >> >> Suppose that there is NumPy v1 and that in future there will be

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Nathan
On Mon, Oct 9, 2023 at 3:12 PM Oscar Benjamin wrote: > On Mon, 9 Oct 2023 at 21:57, Nathan wrote: > > > > On Mon, Oct 9, 2023 at 2:44 PM Oscar Benjamin < > oscar.j.benja...@gmail.com> wrote: > >> Suppose that there is NumPy v1 and that in future there will be NumPy > >> v2. Also suppose that

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Oscar Benjamin
On Mon, 9 Oct 2023 at 21:57, Nathan wrote: > > On Mon, Oct 9, 2023 at 2:44 PM Oscar Benjamin > wrote: >> Suppose that there is NumPy v1 and that in future there will be NumPy >> v2. Also suppose that there will be two NumPy pickle formats fmtA and >> a future fmtB. One possibility is that NumPy

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Nathan
On Mon, Oct 9, 2023 at 2:44 PM Oscar Benjamin wrote: > On Mon, 9 Oct 2023 at 17:03, Nathan wrote: > > > > On Mon, Oct 9, 2023 at 12:57 AM Aaron Meurer wrote: > >> > >> Is it possible to convert a NumPy 1 pickle file into a generic pickle > >> file that works in both NumPy 1 and 2? As far as I

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Oscar Benjamin
On Mon, 9 Oct 2023 at 17:03, Nathan wrote: > > On Mon, Oct 9, 2023 at 12:57 AM Aaron Meurer wrote: >> >> Is it possible to convert a NumPy 1 pickle file into a generic pickle >> file that works in both NumPy 1 and 2? As far as I understand, pickle >> is Turing complete, so I imagine it should be

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Nathan
On Mon, Oct 9, 2023 at 12:57 AM Aaron Meurer wrote: > Is it possible to convert a NumPy 1 pickle file into a generic pickle > file that works in both NumPy 1 and 2? As far as I understand, pickle > is Turing complete, so I imagine it should be theoretically possible, > but I don't know how easy

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Ronald van Elburg
OK. Then we will just weight for 2.x and test then. ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org https://mail.python.org/mailman3/lists/numpy-discussion.python.org/

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-09 Thread Aaron Meurer
Is it possible to convert a NumPy 1 pickle file into a generic pickle file that works in both NumPy 1 and 2? As far as I understand, pickle is Turing complete, so I imagine it should be theoretically possible, but I don't know how easy it would be to actually do this or how it would affect the

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-08 Thread Nathan
I don’t think this will be a problem for using pickle for IPC. For the python multiprocessing module, all processes would be running the same numpy version, so there wouldn’t be a problem. It could be an issue if pickle is used to communicate numpy arrays between a subset of workers running

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-08 Thread Ronald van Elburg
If needed I can try to construct a minimal example for testing purposes. ___ NumPy-Discussion mailing list -- numpy-discussion@python.org To unsubscribe send an email to numpy-discussion-le...@python.org

[Numpy-discussion] Re: Adding NumpyUnpickler to Numpy 1.26 and future Numpy 2.0

2023-10-08 Thread Ronald van Elburg
Our Numpy arrays are pickled when they are transported over Pipes between Processors (using multiprocessing). Just to point out that there uses of pickling not involving files. Would that affect your analysis? ___ NumPy-Discussion mailing list --