| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
| |
minor style cleanup
|
|
|
|
|
|
|
|
| |
This adds a warning when the main NumPy module is reloaded
with the assumption that in this case objects such as `np.matrix`,
`np._NoValue` or exceptions may be cached internally.
It also gives a warning when NumPy is imported in a sub-interpreter.
|
|
|
|
|
|
|
|
|
|
|
|
| |
The new tags look like '1.21.0.dev0+98.gaa0453721f', where '98' is the
number of commits since the 1.21.0 branch was started and 'aa0453721f'.
The chosen form may be specified in the 'setup.cfg' file. This PR adds
two new files 'numpy/_version.py' and 'numpy/version.py'. The latter
is kept because it is part of the public API and is actually used by
some downstream projects, but it is no longer dynamically created.
See https://github.com/python-versioneer/python-versioneer/ for more
information.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Most end-users will probably not care about the warning in any case,
since they will not just import the function but also use it.
We can't just remove it, due to gh-17143: Astropy currently pulls
in these functions (but doesn't use them), so that plain removal
would lead to an unusable astropy if a new NumPy is installed.
Even more annoying, due to a (faulty?) astropy pytest plugin, this
affects all pytest runs (which do not use `PYTEST_DISABLE_PLUGIN_AUTOLOAD`).
Changing it to a DeprecationWarning seems to remove the issue from
pytest runs, this may make the warning less visible in rare cases
where it should be seen, but hopefully it will still be visible enough.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In a previous commit, the expired financial functions were removed
from NumPy, and code was added to __init__.py using the module
__getattr__ to raise a customized AttributeError on any attempt to
reference the expired names in the numpy namespace.
That change broke released versions astropy, which has code that
imports the financial functions. astropy never calls the functions,
so they never saw the deprecation warnings that have been in place
since numpy 1.18. This means that attempting to use a released
version of astropy with numpy 1.20 will cause astropy to crash
with the custom AttributeError.
In this commit, instead of raising an exception when one of the
expired names is referenced, a warning is generated. If the
function is *called*, an exception is raised.
|
|
|
|
|
|
|
|
|
| |
As explained in NEP 32, the financial functions are to be removed
from version 1.20.
They are now replaced with module level `__getattr__` to give a useful
error message for those surprised by the `AttributeError`.
This only works for Python 3.7+, but it is expected that by the 1.20 release
Python 3.6 will not be supported.
|
| |
|
| |
|
| |
|
|\
| |
| | |
DEP: Deprecate aliases of builtin types in python 3.7+
|
| |
| |
| |
| |
| |
| |
| |
| | |
This:
* Makes accessing these attributes emit a deprecation warning
* Removes them from `dir(numpy)`, so as not to emit warnings for user of `inspect.getmembers`
These aliases are a continual source of confusion for beginners, and are still often used by accident by experts.
|
|/ |
|
|
|
|
|
|
| |
Add a deprecation warning in the `numpy.dual` module, and
remove the use of `numpy.dual` from the few places where it
is used in the numpy code.
|
|\
| |
| | |
ENH: Allow toggling madvise hugepage and fix default
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
By default this disables madvise hugepage on kernels before 4.6, since
we expect that these typically see large performance regressions when
using hugepages due to slow defragementation code presumably fixed by:
https://github.com/torvalds/linux/commit/7cf91a98e607c2f935dbcc177d70011e95b8faff
This adds support to set the behaviour at startup time through the
``NUMPY_MADVISE_HUGEPAGE`` environment variable.
Fixes gh-15545
|
|/
|
|
|
| |
types (#15816)
Cleanup from the dropping of python 2
|
|
|
|
|
|
|
| |
* TST: Test during import to detect bugs with Accelerate(MacOS) LAPACK
fixes #15647
* Pipeline update for Accelerate(MacOS) testing
|
|
|
|
| |
Reference multiple relevant discussions on GH
|
|
|
|
|
|
|
| |
Clarifies a FIXME comment in numpy/__init__.py by referencing
relevant discussion in issue tracker.
Closes #15668.
|
|
|
|
|
| |
Modified __dir__() to remove duplicate "Tester/Testing" attribute. Also added a test to verify this.
Closes gh-15383
|
| |
|
|
|
|
|
| |
As numpy is Python 3 only, these import statements are now unnecessary
and don't alter runtime behavior.
|
|
|
|
|
|
|
|
| |
This was introduced in 3ca0eb1136102ff01bcc171f53c106326fa4445b, due to an incorrect implementation of `__dir__` (fixed in the previous commit).
It was never released, so this is not a breaking change.
In that commit, `from numpy import *` would reset all the builtins to their defaults, and set `unicode = str`, `long = int`.
|
|
|
|
|
|
|
|
|
|
| |
Previously this would fail, but only on python 3.7+
```
np.new_member = 1
assert 'new_member' in dir(np)
```
While this isn't something we support anyway, it certainly wasn't intentional.
|
|
|
|
| |
[ci skip]
|
|
|
|
|
|
|
| |
Also finish the TODO about figuring out which np.lib.<submodule>'s
are public.
This is a giant mess ...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before this fix, a reference such as `numpy.wxyz` produced an
incorrect error message because of the invalid format specifiers
in the error message string:
>>> import numpy
>>> numpy.wxyz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../numpy/__init__.py", line 206, in __getattr__
"module %s has no attribute $s".format(__name__, attr))
AttributeError: module %s has no attribute $s
After the fix:
>>> import numpy
>>> numpy.wxyz
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/.../numpy/__init__.py", line 206, in __getattr__
"{!r}".format(__name__, attr))
AttributeError: module 'numpy' has no attribute 'wxyz'
|
|
|
|
|
| |
On new python versions, the module level `__getattr__` can be used to import testing and
Tester only when needed (at no speed cost, except for the first time import). Since most users
never use testing, this avoids an expensive import.
|
| |
|
|
|
|
|
|
|
| |
getlimits previously called numpy code before all of numpy was loaded,
which often causes circular import issues. This delays getlimits init.
Fixes #12063
|
|
|
|
|
|
|
|
| |
Attempts to use this on either cpython27 or cpython35, in either a shell or a script, gives:
NameError: name '__path__' is not defined
Perhaps I'm calling it wrong, but it might just be broken.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
unnecessary import dependencies
pytesttester is used by every single subpackage, so making it depend on np.testing just creates cyclic dependencies that can lead to circular imports
Relates to #11457
|
| |
|
|
|
|
| |
This checks for potential BLAS issues, which are useful to catch early.
|
|
|
|
|
|
|
|
| |
Numpy can now be tested using the standard
`python -c"import numpy; numpy.test()"`
construct.
|
|
|
|
|
| |
The "bench" testing with the old bench files is no longer supported.
These days we use `runtests.py` and `asv`.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The aim here is to separate out the nose dependent files prior to adding
pytest support. This could be done by adding new files to the general
numpy/testing directory, but I felt that it was to have the relevant
files separated out as it makes it easier to completely remove nose
dependencies when needed.
Many places were accessing submodules in numpy/testing directly, and in
some cases incorrectly. That presented a backwards compatibility
problem. The solution adapted here is to have "dummy" files whose
contents will depend on whether of not pytest is active. That way the
module looks the same as before from the outside.
In the case of numpy itself, direct accesses have been fixed. Having
proper `__all__` lists in the submodules helped in that.
|
|
|
|
| |
The strings in error messages were left untouched
|
|
|
|
|
|
|
|
|
|
|
|
| |
Reloading currently causes problems because global classes defined in
numpy/__init__.py change their identity (a is b) after reload. The
solution taken here is to move those classes to a new non-reloadable
module numpy/_globals and import them into numpy from there.
Classes moved are ModuleDeprecationWarning, VisibleDeprecationWarning,
and _NoValue.
Closes #7844.
|
|
|
|
|
|
|
|
|
|
| |
There seems to be little use in reloading numpy as any changed modules
that are imported into numpy would need to be reloaded first in order to
see any changes. Furthermore, reloading causes problems as global
classes defined in numpy/__init__.py change their identity. Hence we
raise a RuntimeError when an attempt to reload numpy is made.
Closes #7844.
|
|
|
|
|
|
| |
Give hook to allow platform-specific installs to modify the
initialization of numpy. Particular use-case is to allow check for SSE2
on Windows when shipping with ATLAS wheel.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Our test-runner's raise_warning mode traditionally has varied depending
on whether we have a development or release version of numpy: for
development versions we raise on warnings, and for release versions we
don't. This is all very sensible... *if* you're running numpy's test
suite. But our test-runner is also used by other packages like scipy,
and it doesn't make sense for scipy's raise_warning mode to vary
depending on whether *numpy* is a development or release version. (It
should vary depending on whether the scipy-under-test is a development
or release version.) So this commit moves the numpy-version-dependent
raise_warning logic out of the generic NoseTester class and into
numpy-specific code.
(See scipy/scipy#5609 for more discussion.)
|
|
|
|
|
| |
See gh-432 for details. Motivation for adding this now is the discussion
on gh-5343.
|
|
|
|
|
|
|
|
|
|
| |
Add _NoValue class at top level to make it possible to detect when
non-default values got passed to a keyword argument, as in:
def func(a, b=np._NoValue):
if b is not np._NoValue:
warnings.warn("Argument b is deprecated",
DeprecationWarning)
|