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

Big list of functions in the top-level namespace missing types #16546

Closed
person142 opened this issue Apr 16, 2020 · 39 comments · Fixed by #20217
Closed

Big list of functions in the top-level namespace missing types #16546

person142 opened this issue Apr 16, 2020 · 39 comments · Fixed by #20217

Comments

@person142
Copy link
Member

person142 commented Apr 16, 2020

This is a big list of functions in the main numpy namespace that are missing types. You can regenerate an updated version of it with a

./runtests.py --find-missing numpy

If you are interested in contributing, adding stubs for one of these functions is a good place to start!

Last updated: 28 October 2021

  • DataSource
  • ScalarType
  • angle
  • append
  • apply_along_axis
  • apply_over_axes
  • arange
  • array_split
  • asarray_chkfinite
  • asfarray
  • asmatrix
  • average
  • bartlett
  • bincount
  • bitwise_not
  • blackman
  • bmat
  • broadcast
  • broadcast_arrays
  • broadcast_to
  • busday_count
  • busday_offset
  • busdaycalendar
  • byte_bounds
  • c_
  • can_cast
  • cast
  • chararray
  • column_stack
  • common_type
  • compare_chararrays
  • concatenate
  • conj
  • copy
  • copyto
  • corrcoef
  • cov
  • cumproduct
  • datetime_as_string
  • datetime_data
  • delete
  • deprecate
  • deprecate_with_doc
  • diag
  • diag_indices
  • diag_indices_from
  • diagflat
  • diff
  • digitize
  • disp
  • divide
  • dot
  • dsplit
  • dstack
  • ediff1d
  • einsum
  • einsum_path
  • expand_dims
  • extract
  • eye
  • fill_diagonal
  • finfo
  • fix
  • flip
  • fliplr
  • flipud
  • format_parser
  • frombuffer
  • fromfile
  • fromiter
  • frompyfunc
  • fromregex
  • fromstring
  • genfromtxt
  • get_include
  • geterrobj
  • gradient
  • hamming
  • hanning
  • histogram
  • histogram2d
  • histogram_bin_edges
  • histogramdd
  • hsplit
  • i0
  • iinfo
  • imag
  • in1d
  • index_exp
  • info
  • inner
  • insert
  • interp
  • intersect1d
  • is_busday
  • iscomplex
  • iscomplexobj
  • isin
  • isneginf
  • isposinf
  • isreal
  • isrealobj
  • iterable
  • ix_
  • kaiser
  • kron
  • lexsort
  • load
  • loadtxt
  • lookfor
  • mask_indices
  • mat
  • matrix
  • max
  • may_share_memory
  • median
  • memmap
  • meshgrid
  • mgrid
  • min
  • min_scalar_type
  • mintypecode
  • mod
  • msort
  • nan_to_num
  • nanargmax
  • nanargmin
  • nancumprod
  • nancumsum
  • nanmax
  • nanmean
  • nanmedian
  • nanmin
  • nanpercentile
  • nanprod
  • nanquantile
  • nanstd
  • nansum
  • nanvar
  • nbytes
  • ndenumerate
  • ndindex
  • nditer
  • nested_iters
  • newaxis
  • ogrid
  • packbits
  • pad
  • percentile
  • piecewise
  • place
  • poly
  • poly1d
  • polyadd
  • polyder
  • polydiv
  • polyfit
  • polyint
  • polymul
  • polysub
  • polyval
  • product
  • promote_types
  • put_along_axis
  • putmask
  • quantile
  • r_
  • ravel_multi_index
  • real
  • real_if_close
  • recarray
  • recfromcsv
  • recfromtxt
  • record
  • result_type
  • roots
  • rot90
  • round
  • round_
  • row_stack
  • s_
  • save
  • savetxt
  • savez
  • savez_compressed
  • select
  • setdiff1d
  • seterrobj
  • setxor1d
  • shares_memory
  • show_config
  • sinc
  • sort_complex
  • source
  • split
  • take_along_axis
  • tile
  • trapz
  • tri
  • tril
  • tril_indices
  • tril_indices_from
  • trim_zeros
  • triu
  • triu_indices
  • triu_indices_from
  • typecodes
  • typename
  • union1d
  • unique
  • unpackbits
  • unravel_index
  • unwrap
  • vander
  • vdot
  • vectorize
  • vsplit
  • where
  • who
@person142
Copy link
Member Author

person142 commented Apr 16, 2020

We'll probably want to start excluding some of these-e.g. this includes the deprecated financial functions, which we probably just shouldn't bother with.

person142 referenced this issue in numpy/numpy-stubs Apr 18, 2020
See https://github.com/numpy/numpy-stubs/issues/54.

Added annotations and tests for:
* np.ModuleDeprecationWarning
* np.VisibleDeprecationWarning
* np.ComplexWarning
* np.RankWarning
* np.TooHardError
* np.AxisError
@person142
Copy link
Member Author

person142 commented Apr 18, 2020

Things I've excluded so far:

  • np.absolute_import (this is from __future__ import absolute_import)
  • np.add_docstring (don't think this is supposed to be public)
  • np.add_newdoc (don't think this is supposed to be public)
  • np.add_newdoc_ufunc (don't think this is supposed to be public)
  • np.float (this is float)
  • np.fv (use numpy_financial)
  • np.ipmt (use numpy_financial)
  • np.irr (use numpy_financial)
  • np.mirr (use numpy_financial)
  • np.nper (use numpy_financial)
  • np.npv (use numpy_financial)
  • np.pmt (use numpy_financial)
  • np.ppmt (use numpy_financial)
  • np.pv (use numpy_financial)
  • np.rate (use numpy_financial)
  • np.warnings (this is the stdlib warnings module)

@rgommers
Copy link
Member

we should del absolute_import and warnings

@BvB93
Copy link
Member

BvB93 commented Apr 18, 2020

A couple of other ones from builtins (just like np.float):

  • np.bool
  • np.complex
  • np.int
  • np.long
  • np.object
  • np.str
  • np.unicode

@person142
Copy link
Member Author

person142 commented Apr 18, 2020

Thanks @BvB93. I just pushed a commit to numpy/numpy-stubs#53 which adds an exclude list; once that's merged we can make PRs updating it as we find things we don't want to include.

@person142 person142 transferred this issue from numpy/numpy-stubs Jun 9, 2020
@BvB93
Copy link
Member

BvB93 commented Jun 20, 2020

Removed np.alen() from the list as it has been deprecated since #14181.

@BvB93
Copy link
Member

BvB93 commented Jun 23, 2020

Removed the 8 functions implemented in #16647.

@BvB93
Copy link
Member

BvB93 commented Aug 28, 2020

Removed the 8 functions implemented in #16729:

  • prod()
  • cumprod()
  • ndim()
  • size()
  • around()
  • mean()
  • std()
  • var()

@BvB93
Copy link
Member

BvB93 commented Sep 30, 2020

@BvB93
Copy link
Member

BvB93 commented Oct 1, 2020

Removed the 5 functions implemented in #17326:

  • asarray()
  • asanyarray()
  • ascontiguousarray()
  • asfortranarray()
  • require()

@BvB93
Copy link
Member

BvB93 commented Oct 7, 2020

Removed 13 modules which where annotated in #17104.

Note that "annotated" herein refers the modules being recognized as types.ModuleType
instances, the individual objects within the respective modules are not properly annotated
yet (which is a task beyond the scope of this particular issue):

  • char
  • ctypeslib
  • emath
  • fft
  • lib
  • linalg
  • ma
  • matrixlib
  • polynomial
  • random
  • rec
  • testing
  • version

Removed three functions annotated in #17144:

  • geomspace
  • linspace
  • logspace

Removed three private/builtin modules:

  • compat (private module)
  • sys (builtin module)
  • math (builtin module)

@BvB93
Copy link
Member

BvB93 commented Oct 9, 2020

Removed two type aliases annotated in #17479:

  • str0
  • unicode_

@BvB93
Copy link
Member

BvB93 commented Oct 16, 2020

Removed three constants annotated in #17572:

  • True_
  • False_
  • UFUNC_PYVALS_NAME

@BvB93
Copy link
Member

BvB93 commented Oct 19, 2020

Removed two dictionaries annotated in #17584:

  • sctypes
  • sctypeDict

@BvB93
Copy link
Member

BvB93 commented Nov 1, 2020

Removed 7 functions annotated in #17644:

  • atleast_1d
  • atleast_2d
  • atleast_3d
  • vstack
  • hstack
  • stack
  • block

@BvB93
Copy link
Member

BvB93 commented Nov 16, 2020

Removed 7 objects annotated in #17643:

  • errstate
  • getbufsize
  • geterr
  • geterrcall
  • setbufsize
  • seterr
  • seterrcall

@BvB93
Copy link
Member

BvB93 commented Dec 19, 2020

Removed 9 functions annotated in #18032:

  • set_printoptions
  • get_printoptions
  • array2string
  • format_float_scientific
  • format_float_positional
  • array_repr
  • array_str
  • set_string_function
  • printoptions

@BvB93
Copy link
Member

BvB93 commented Dec 22, 2020

Removed the 28 classes/aliases annotated in #17843:

  • byte
  • cdouble
  • cfloat
  • clongdouble
  • clongfloat
  • compelx_
  • csingle
  • double
  • float_
  • half
  • int0
  • int_
  • intc
  • intp
  • longcomplex
  • longdouble
  • longfloat
  • longlong
  • short
  • single
  • singlecomplex
  • ubyte
  • uint
  • uint0
  • uintc
  • uintp
  • ulonglong
  • ushort

@jinwuxia
Copy link

jinwuxia commented Feb 4, 2021

I have a look at NumPy repo, and find that not every Python file has a corresponding stub file, and not every function is type-annotated.

It seems like, there is a certain decision or choice to select/decide which Python files or functions should be added type annotations in priority.

I am curious that what is the selection decision?
Besides the top-level functions listed here, do Numpy consider any other plan?

Thanks. :-)

@BvB93
Copy link
Member

BvB93 commented Feb 4, 2021

Hi @jinwuxia,

Due to the sheer size and complexity of the numpy library, a large number of functions are currently defined (as Any-based placeholders) in the main namespace. The general idea is to move them to their own stub file once the annotations are properly implemented.

@BvB93
Copy link
Member

BvB93 commented Apr 19, 2021

Ideally we could get basic annotations for all functions in the main numpy namespace for the 1.21 release,
with full dtype support wrapping up in 1.22.

@charris charris modified the milestones: 1.21.0 release, 1.22.0 release May 5, 2021
@rgommers rgommers added sprintable Issue fits the time-frame and setting of a sprint and removed sprintable Issue fits the time-frame and setting of a sprint labels May 8, 2021
@BvB93
Copy link
Member

BvB93 commented May 12, 2021

Removed 10 functions annotated in #18944:

  • get_include
  • deprecate
  • deprecate_with_doc
  • byte_bounds
  • who
  • info
  • source
  • lookfor
  • safe_eval

Removed 1 class annotated in #18545:

  • Arrayterator (exclusive to the np.lib namespace)

Removed 12 objects annotated in #18944:

  • ravel_multi_index
  • unravel_index
  • mgrid
  • ogrid
  • r_
  • c_
  • s_
  • index_exp
  • ix_
  • fill_diagonal
  • diag_indices
  • diag_indices_from

@BvB93 BvB93 modified the milestones: 1.21.0 release, 1.22.0 release May 14, 2021
@BvB93
Copy link
Member

BvB93 commented May 14, 2021

Moving this to the 1.22 release, as things are very unlikely to get wrapped up before 1.21.

@BvB93
Copy link
Member

BvB93 commented May 17, 2021

Removed 2 classes annotated in #19002:

  • broadcast
  • DataSource

@BvB93
Copy link
Member

BvB93 commented Jun 11, 2021

Removed 14 functions annotated in #19060:

  • can_cast
  • concatenate
  • copyto
  • dot
  • inner
  • lexsort
  • may_share_memory
  • min_scalar_type
  • putmask
  • result_type
  • shares_memory
  • vdot
  • where
  • bincount

Removed 1 function annotated in #19223:

  • pad

Removed 4 ufunc aliases annotated in #18765:

  • bitwise_not
  • conj
  • divide
  • mod

@BvB93
Copy link
Member

BvB93 commented Jun 13, 2021

Removed 15 functions + 1 class annotated in #19237:

  • arange
  • busday_count
  • busday_offset
  • compare_chararrays
  • datetime_as_string
  • datetime_data
  • frombuffer
  • fromfile
  • fromiter
  • is_busday
  • promote_types
  • seterrobj
  • geterrobj
  • fromstring
  • frompyfunc
  • busdaycalendar

Removed 4 objects annotated in #18818:

  • cast
  • nbytes
  • ScalarType
  • typecodes

Removed 1 object deprecated in #17586:

  • typeDict

@BvB93
Copy link
Member

BvB93 commented Jun 17, 2021

Removed 14 functions annotated in #19261:

  • fliplr
  • flipud
  • diag
  • diagflat
  • tri
  • tril
  • triu
  • vander
  • histogram2d
  • mask_indices
  • tril_indices
  • tril_indices_from
  • triu_indices
  • triu_indices_from

Removed 1 function annotated in #18475:

  • eye

Removed 1 constant annotated in #18765:

  • newaxis

@BvB93
Copy link
Member

BvB93 commented Jun 24, 2021

Removed 13 functions annotated in #19286:

  • mintypecode
  • asfarray
  • real
  • imag
  • iscomplex
  • isreal
  • iscomplexobj
  • isrealobj
  • nan_to_num
  • real_if_close
  • asscalar (deprecated)
  • typename
  • common_type

@BvB93
Copy link
Member

BvB93 commented Jul 19, 2021

Removed 9 functions annotated in #19408:

  • round
  • round_
  • max
  • min
  • product
  • cumproduct
  • sometrue
  • alltrue
  • sow_config

Removed 2 classes annotated in #19421:

  • iinfo
  • finfo

Removed 15 functions annotated in #19444:

  • row_stack
  • take_along_axis
  • put_along_axis
  • apply_along_axis
  • apply_over_axes
  • expand_dims
  • column_stack
  • dstack
  • array_split
  • split
  • hsplit
  • vsplit
  • dsplit
  • kron
  • tile

@BvB93
Copy link
Member

BvB93 commented Aug 16, 2021

Removed 10 functions annotated in #19667:

  • load
  • save
  • savez
  • savez_compressed
  • loadtxt
  • savetxt
  • fromregex
  • genfromtxt
  • recfromtxt
  • recfromcsv

Removed 4 deprecated functions:

  • loads
  • ndfromtxt
  • mafromtxt
  • numarray

@BvB93
Copy link
Member

BvB93 commented Aug 16, 2021

Removed 2 functions annotated in #19683:

  • broadcast_to
  • broadcast_arrays

@BvB93
Copy link
Member

BvB93 commented Sep 22, 2021

Remove 7 functions annotated in #19917:

  • ediff1d
  • unique
  • intersect1d
  • setxor1d
  • in1d
  • union1d
  • setdiff1d

@BvB93
Copy link
Member

BvB93 commented Sep 26, 2021

Removed 3 classes annotated in #19949:

  • recarray
  • record
  • format_parser

Removed 1 class and 1 function annotated in #19953:

  • nditer
  • nested_iters

@BvB93
Copy link
Member

BvB93 commented Oct 5, 2021

Removed 1 class annotated in #19979:

  • memmap

Removed 14 functions (implicitly) annotated in #20027:

  • nansum
  • nanmax
  • nanmin
  • nanargmax
  • nanargmin
  • nanmean
  • nanmedian
  • nanpercentile
  • nanvar
  • nanstd
  • nanprod
  • nancumsum
  • nancumprod
  • nanquantile

Removed 19 functions annotated in #20006:

  • vectorize
  • add_newdoc
  • rot90
  • flip
  • iterable
  • average
  • asarray_chkfinite
  • piecewise
  • select
  • copy
  • gradient
  • diff
  • angle
  • unwrap
  • sort_complex
  • trim_zeros
  • extract
  • place
  • disp

Removed 12 functions annotated in #20034:

  • interp
  • cov
  • corrcoef
  • blackman
  • bartlett
  • hanning
  • hamming
  • i0
  • kaiser
  • sinc
  • msort
  • median

Removed 9 functions annotated in #20036:

  • add_newdoc_ufunc
  • quantile
  • percentile
  • trapz
  • meshgrid
  • delete
  • insert
  • append
  • digitize

@BvB93
Copy link
Member

BvB93 commented Oct 5, 2021

Removed 3 functions annotated in #18377:

  • fix
  • isneginf
  • isposinf

@BvB93
Copy link
Member

BvB93 commented Oct 9, 2021

Removed 3 functions annotated in #20063:

  • histogram_bin_edges
  • histogram
  • histogramdd

Removed 10 functions and 1 class annotated in #20065:

  • poly1d
  • poly
  • roots
  • polyint
  • polyder
  • polyfit
  • polyval
  • polyadd
  • polysub
  • polymul
  • polydiv

@BvB93
Copy link
Member

BvB93 commented Oct 28, 2021

Removed 1 class annotated in #20165:

  • chararray

Removed 1 class annotated in #20105:

  • matrix

Removed 1 class deprecated in #20201:

  • MachAr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants