Skip to content
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

MAINT: remove the entropy c-extension module #14519

Merged
merged 4 commits into from Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions doc/release/upcoming_changes/14498.changes.rst
@@ -0,0 +1,7 @@
Remove ``numpy.random.entropy`` without a deprecation
-----------------------------------------------------

``numpy.random.entropy`` was added to the `numpy.random` namespace in 1.17.0.
It was meant to be a private c-extension module, but was exposed as public.
It has been replaced by `numpy.random.SeedSequence` so the module was
completely removed.
6 changes: 0 additions & 6 deletions doc/source/reference/random/entropy.rst

This file was deleted.

4 changes: 0 additions & 4 deletions doc/source/reference/random/index.rst
Expand Up @@ -151,9 +151,6 @@ What's New or Different
select distributions
* Optional ``out`` argument that allows existing arrays to be filled for
select distributions
* `~entropy.random_entropy` provides access to the system
source of randomness that is used in cryptographic applications (e.g.,
``/dev/urandom`` on Unix).
* All BitGenerators can produce doubles, uint64s and uint32s via CTypes
(`~.PCG64.ctypes`) and CFFI (`~.PCG64.cffi`). This allows the bit generators
to be used in numba.
Expand Down Expand Up @@ -203,7 +200,6 @@ Features
new-or-different
Comparing Performance <performance>
extending
Reading System Entropy <entropy>

Original Source
~~~~~~~~~~~~~~~
Expand Down
3 changes: 0 additions & 3 deletions doc/source/reference/random/new-or-different.rst
Expand Up @@ -45,9 +45,6 @@ Feature Older Equivalent Notes

And in more detail:

* `~.entropy.random_entropy` provides access to the system
source of randomness that is used in cryptographic applications (e.g.,
``/dev/urandom`` on Unix).
* Simulate from the complex normal distribution
(`~.Generator.complex_normal`)
* The normal, exponential and gamma generators use 256-step Ziggurat
Expand Down
1 change: 0 additions & 1 deletion numpy/random/__init__.py
Expand Up @@ -181,7 +181,6 @@
from . import _pickle
from . import common
from . import bounded_integers
from . import entropy

from .mtrand import *
from .generator import Generator, default_rng
Expand Down
155 changes: 0 additions & 155 deletions numpy/random/entropy.pyx

This file was deleted.

7 changes: 4 additions & 3 deletions numpy/random/mt19937.pyx
Expand Up @@ -5,7 +5,6 @@ cimport numpy as np

from .common cimport *
from .bit_generator cimport BitGenerator, SeedSequence
from .entropy import random_entropy

__all__ = ['MT19937']

Expand Down Expand Up @@ -156,7 +155,8 @@ cdef class MT19937(BitGenerator):
Random seed initializing the pseudo-random number generator.
Can be an integer in [0, 2**32-1], array of integers in
[0, 2**32-1], a `SeedSequence, or ``None``. If `seed`
is ``None``, then sample entropy for a seed.
is ``None``, then fresh, unpredictable entropy will be pulled from
the OS.
Raises
------
Expand All @@ -167,7 +167,8 @@ cdef class MT19937(BitGenerator):
with self.lock:
try:
if seed is None:
val = random_entropy(RK_STATE_LEN)
seed = SeedSequence()
val = seed.generate_state(RK_STATE_LEN)
# MSB is 1; assuring non-zero initial array
self.rng_state.key[0] = 0x80000000UL
for i in range(1, RK_STATE_LEN):
Expand Down
12 changes: 0 additions & 12 deletions numpy/random/setup.py
Expand Up @@ -61,18 +61,6 @@ def generate_libraries(ext, build_dir):
# One can force emulated 128-bit arithmetic if one wants.
#PCG64_DEFS += [('PCG_FORCE_EMULATED_128BIT_MATH', '1')]

config.add_extension('entropy',
sources=['entropy.c', 'src/entropy/entropy.c'] +
[generate_libraries],
libraries=EXTRA_LIBRARIES,
extra_compile_args=EXTRA_COMPILE_ARGS,
extra_link_args=EXTRA_LINK_ARGS,
depends=[join('src', 'splitmix64', 'splitmix.h'),
join('src', 'entropy', 'entropy.h'),
'entropy.pyx',
],
define_macros=defs,
)
for gen in ['mt19937']:
# gen.pyx, src/gen/gen.c, src/gen/gen-jump.c
config.add_extension(gen,
Expand Down
114 changes: 0 additions & 114 deletions numpy/random/src/entropy/entropy.c

This file was deleted.

14 changes: 0 additions & 14 deletions numpy/random/src/entropy/entropy.h

This file was deleted.