FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

MAINT: backport Cython API cleanup to 1.17.x, remove docs by rgommers · Pull Request #14593 · numpy/numpy · GitHub

/ numpy Public

MAINT: backport Cython API cleanup to 1.17.x, remove docs - #14593

Merged
charris merged 4 commits into
numpy:maintenance/1.17.xfrom
rgommers:bport-cythonapi
Nov 19, 2019
Merged

charris merged 4 commits into
numpy:maintenance/1.17.xfrom
rgommers:bport-cythonapi

Conversation

Copy link
Copy Markdown
Member

Backport of gh-14562 and removal of the docs on extending with Cython and Numba.

The Numba part says:
Both CTypes and CFFI allow the more complicated distributions to be used directly in Numba after compiling the file distributions.c into a DLL or so.
So that seems broken to and should be taken out.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Perhaps I misread this. I think the Numba example above still works so perhaps we should leave that in. Compiling distributions.c doesn't work I think, so prefer to remove that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Seems to have been broken in some of the reorganization due to the includes changing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I triple checked and it still is possible to build the DLL/so from the src dist. Not possible form the wheel though since there are no c files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This document is deleted in the backport, since it is unclear and the examples don't work.

bashtage left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Probably not important, but some of the removed lines are still true statements.

Comment thread doc/source/reference/random/index.rst Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This statement is still true on 1.17.x.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@rgommers Comment?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no idea, I have no reason to doubt @bashtage's comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Should we omit the deletion here, or is reasonable for 1.17 and we will cover things better in 1.18? I'd like to put this backport in. Maybe have another if there are changes in master?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Happy to omit this deletion, will verify later today or tomorrow and change if it still works.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

OK, will wait. @bashtage makes the same comment in several places.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@rgommers Still want to look at this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

sorry, failed to make time - not going to happen until end of next week at the earliest. added the 1.17.4 milestone, it seems that it should go into that release

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

reverted the deletion: BitGenerator.ctypes still exists

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Same comment.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

reverted

Comment thread doc/source/reference/random/index.rst Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Technically this statement is also True, since bit generator all export a capsule that can be unpacked in Cython get
the function pointers.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

reverted the deletion

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

on second thought, I think that use is too obscure to be practical. Let's remove that from this release.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Seems to have been broken in some of the reorganization due to the includes changing.

Copy link
Copy Markdown
Contributor

A quick check

In [19]: import numpy as np
    ...: bg = np.random.PCG64()
    ...: bg.ctypes
    ...:
Out[19]: interface(state_address=140611115848248, state=c_void_p(140611115848248), next_uint64=<CFunctionType object at 0x7fe293dd6bb0>, next_uint32=<CFunctionType object at 0x7fe293dd6c80>, next_double=<CFunctionType object at 0x7fe293dd6d50>, bit_generator=c_void_p(140611115848176))

shows that the cffi and the ctypes interfaces to the bit generators are still there.

rgommers added this to the 1.17.4 release. milestone Oct 31, 2019
charris added the 08 - Backport Used to tag backport PRs label Nov 12, 2019
See https://mail.python.org/pipermail/numpy-discussion/2019-September/080088.html
for discussion. We need to do this right, and add tests and docs.
All this PR does is not install bitgen.h, common.pxd and bit_generator.pxd
(they're still shipped in the sdist, that is needed).

Should be backported to 1.17.x

(cherry picked from commit 09ee875)
This was broken in 1.17.x and is being removed completely in 1.17.3
(to be reintroduced in 1.18.0, so this commit is not in master).

mattip commented Nov 18, 2019

Copy link
Copy Markdown
Member

Rebased and touched up. The cffi and ctypes interfaces still are there so I left the reference. If one digs deeply they can expose the cython PyCapsule interface, but I do not think it is worth mentioning.

#include "numpy/npy_common.h"
#include "numpy/npy_math.h"
#include "numpy/random/bitgen.h"
#include "src/bitgen.h"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This isn't correct for 1.17, and it looks like 1.17 will be the same as 1.18 after the C-API changes go in.

charris@fc [numpy.git ((v1.17.4))]$ find . -name 'bitgen\.h'
./numpy/core/include/numpy/random/bitgen.h

charris Nov 18, 2019
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The current 1.17 file is renamed in this PR, do we want to do that for an existing release?

Comment thread numpy/random/common.pxd
from libc.math cimport sqrt

cdef extern from "numpy/random/bitgen.h":
cdef extern from "src/bitgen.h":

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The original is what is in 1.17 and will also be in 1.18 after the C-API changes go in.

charris commented Nov 19, 2019

Copy link
Copy Markdown
Member

The location of the two include files differs from what is proposed for 1.18. This PR puts one in numpy/random/src and leaves the other in numpy/random/src/distributions. I suppose that is OK, but in 1.18 they will both be in numpy/core/include/numpy/random.

Copy link
Copy Markdown
Member Author

The location of the two include files differs from what is proposed for 1.18.

That's on purpose: we want the 1.17 one to be unreachable because it's not public API yet. It becomes public with cleaned up names in 1.18

charris merged commit a068e7d into numpy:maintenance/1.17.x Nov 19, 2019

charris commented Nov 19, 2019

Copy link
Copy Markdown
Member

Thanks Ralf, Matti.

rgommers deleted the bport-cythonapi branch November 19, 2019 02:50

Copy link
Copy Markdown
Member Author

Thanks a lot @mattip for finishing this up!

charris removed this from the 1.17.5 release milestone Nov 19, 2019
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL