[build-system]
build-backend = "mesonpy"
requires = [
    "meson-python>=0.18.0",
    "Cython>=3.0.6",  # keep in sync with version check in meson.build
]

[project]
name = "numpy"
version = "2.5.1"
description = "Fundamental package for array computing in Python"
authors = [{name = "Travis E. Oliphant et al."}]
maintainers = [
    {name = "NumPy Developers", email="numpy-discussion@python.org"},
]
requires-python = ">=3.12"
readme = "README.md"
classifiers = [
    'Development Status :: 5 - Production/Stable',
    'Intended Audience :: Science/Research',
    'Intended Audience :: Developers',
    'Programming Language :: C',
    'Programming Language :: Python',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.12',
    'Programming Language :: Python :: 3.13',
    'Programming Language :: Python :: 3.14',
    'Programming Language :: Python :: 3 :: Only',
    'Programming Language :: Python :: Implementation :: CPython',
    'Topic :: Software Development',
    'Topic :: Scientific/Engineering',
    'Typing :: Typed',
    'Operating System :: Microsoft :: Windows',
    'Operating System :: POSIX',
    'Operating System :: Unix',
    'Operating System :: MacOS',
]
# License info:
#   - The main NumPy project license is BSD-3-Clause.
#   - The SPDX license expression below reflects installed numpy packages when
#     built from source (e.g., with `python -m build --wheel`), with no vendoring.
#   - That SPDX expression is therefore incomplete for:
#     (a) sdists - see the comment below `license-files` for other licenses
#         included in the sdist
#     (b) wheels on PyPI - most wheels include vendored libraries with additional licenses:
#         - libopenblas : BSD-3-Clause AND BSD-3-Clause-Attribution (all except arm64 macOS>=14)
#         - libgfortran : GPL-3.0-with-GCC-exception                (all except arm64 macOS>=14)
#         - libquadmath : LGPL-2.1-or-later                         (all except arm64 macOS>=14 and Windows)
#         The licenses for these vendored components are dynamically included
#         in the build process for PyPI wheels.
license = 'BSD-3-Clause AND 0BSD AND MIT AND Zlib AND CC0-1.0'
license-files = [
    'LICENSE.txt',                                       # BSD-3-Clause
    'numpy/_core/include/numpy/libdivide/LICENSE.txt',   # Zlib
    'numpy/_core/src/common/pythoncapi-compat/COPYING',  # 0BSD
    'numpy/_core/src/highway/LICENSE',                   # Dual-licensed: Apache 2.0 or BSD 3-Clause
    'numpy/_core/src/multiarray/dragon4_LICENSE.txt',    # MIT
    'numpy/_core/src/npysort/x86-simd-sort/LICENSE.md',  # BSD-3-Clause
    'numpy/_core/src/umath/svml/LICENSE',                # BSD-3-Clause
    'numpy/fft/pocketfft/LICENSE.md',                    # BSD-3-Clause
    'numpy/ma/LICENSE',                                  # BSD-3-Clause
    'numpy/linalg/lapack_lite/LICENSE.txt',              # BSD-3-Clause
    'numpy/random/LICENSE.md',                           # BSD-3-Clause
    'numpy/random/src/distributions/LICENSE.md',         # BSD-3-Clause AND MIT
    'numpy/random/src/mt19937/LICENSE.md',               # BSD-3-Clause AND MIT
    'numpy/random/src/pcg64/LICENSE.md',                 # MIT
    'numpy/random/src/philox/LICENSE.md',                # BSD-3-Clause
    'numpy/random/src/sfc64/LICENSE.md',                 # MIT
    'numpy/random/src/splitmix64/LICENSE.md',            # CC0-1.0
]
# The license files below apply only to files in the repo and sdist, not to
# installed `numpy` packages or wheels (build/doc tools don't affect the
# license of the installed package). We have to make a choice whether to add
# those to the SPDX expression above since PEP 639 is unclear on the
# differences; we choose to make the SPDX expression reflect *a wheel built
# from the sources*.
#    '.spin/LICENSE',                                    # BSD-3-Clause
#    'doc/source/_static/scipy-mathjax/LICENSE',         # Apache-2.0
#    'numpy/_build_utils/tempita/LICENSE.txt',           # BSD-3-Clause
#    'vendored-meson/meson/COPYING',                     # Apache-2.0
# Note that the commented out license files are still included in the sdist,
# just not in Core Metadata and in the .dist-info directory.


[project.scripts]
f2py = 'numpy.f2py.f2py2e:main'
numpy-config = 'numpy._configtool:main'

[project.entry-points.pkg_config]
numpy = 'numpy._core.lib.pkgconfig'

[project.entry-points.array_api]
numpy = 'numpy'

[project.entry-points.pyinstaller40]
hook-dirs = 'numpy:_pyinstaller_hooks_dir'

[project.urls]
homepage = "https://numpy.org"
documentation = "https://numpy.org/doc/"
source = "https://github.com/numpy/numpy"
download = "https://pypi.org/project/numpy/#files"
tracker = "https://github.com/numpy/numpy/issues"
"release notes" = "https://numpy.org/doc/stable/release"

[tool.towncrier]
    single_file = false
    filename = "doc/source/release/notes-towncrier.rst"
    directory = "doc/release/upcoming_changes/"
    issue_format = "`gh-{issue} <https://github.com/numpy/numpy/pull/{issue}>`__"
    template = "doc/release/upcoming_changes/template.rst"
    underlines = "~="
    all_bullets = false


    [[tool.towncrier.type]]
        directory = "highlight"
        name = "Highlights"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "new_function"
        name = "New functions"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "python_removal"
        name = "NumPy 2.0 Python API removals"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "deprecation"
        name = "Deprecations"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "future"
        name = "Future Changes"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "expired"
        name = "Expired deprecations"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "compatibility"
        name = "Compatibility notes"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "c_api"
        name = "C API changes"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "c_api_removal"
        name = "NumPy 2.0 C API removals"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "new_feature"
        name = "New Features"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "improvement"
        name = "Improvements"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "performance"
        name = "Performance improvements and changes"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "typing"
        name = "Typing improvements and changes"
        showcontent = true

    [[tool.towncrier.type]]
        directory = "change"
        name = "Changes"
        showcontent = true


[tool.cibuildwheel]
# Note: the below skip command doesn't do much currently, the platforms to
# build wheels for in CI are controlled in `.github/workflows/wheels.yml`.
# universal2 wheels are not supported (see gh-21233), use `delocate-fuse` if you need them
skip = ["*_i686", "*_ppc64le", "*_s390x", "*_universal2"]
before-build = "bash {project}/tools/wheels/cibw_before_build.sh {project}"
before-test = "pip install -r {project}/requirements/test_requirements.txt"
test-command = "bash {project}/tools/wheels/cibw_test_command.sh {project}"
enable = ["cpython-prerelease"]

# The build will use openblas64 everywhere, except on arm64 macOS >=14.0 (uses Accelerate)
[tool.cibuildwheel.config-settings]
setup-args = ["-Duse-ilp64=true", "-Dallow-noblas=false"]
build-dir = "build"

[tool.cibuildwheel.linux]
manylinux-x86_64-image = "manylinux_2_28"
manylinux-aarch64-image = "manylinux_2_28"
musllinux-x86_64-image = "musllinux_1_2"
musllinux-aarch64-image = "musllinux_1_2"

[tool.cibuildwheel.linux.environment]
# RUNNER_OS is a GitHub Actions specific env var; define it here so it's
# defined when running cibuildwheel locally
RUNNER_OS="Linux"
# /project will be the $PWD equivalent inside the docker used to build the wheel
PKG_CONFIG_PATH="/project/.openblas"

[tool.cibuildwheel.windows]
config-settings = {setup-args = ["--vsenv", "-Dallow-noblas=false"], build-dir="build"}
repair-wheel-command = "bash -el ./tools/wheels/repair_windows.sh {wheel} {dest_dir}"

[[tool.cibuildwheel.overrides]]
select = ["*-win32"]
config-settings = {setup-args = ["--vsenv", "-Dallow-noblas=true"], build-dir="build"}
repair-wheel-command = ""

[tool.cibuildwheel.pyodide]
before-test = "pip install -r {project}/requirements/emscripten_test_requirements.txt"
# Pyodide ensures that the wheels are already repaired by auditwheel-emscripten
repair-wheel-command = ""
test-command = """
    python -m pytest --pyargs numpy \
        -m 'not slow' \
        -W ignore::PendingDeprecationWarning \
        -p no:cacheprovider
"""

[tool.cibuildwheel.pyodide.config-settings]
build-dir = "build"
setup-args = ["--cross-file=$PWD/tools/ci/emscripten/emscripten.meson.cross", "-Dblas=none", "-Dlapack=none"]



[tool.meson-python]
meson = 'vendored-meson/meson/meson.py'

[tool.meson-python.args]
install = ['--tags=runtime,python-runtime,tests,devel']


[tool.spin]
package = 'numpy'

[tool.spin.meson]
cli = 'vendored-meson/meson/meson.py'

[tool.spin.commands]
"Build" = [
  ".spin/cmds.py:build",
  ".spin/cmds.py:test",
  ".spin/cmds.py:mypy",
  ".spin/cmds.py:pyrefly",
  ".spin/cmds.py:stubtest",
  ".spin/cmds.py:config_openblas",
  ".spin/cmds.py:lint",
]
"Environments" = [
  "spin.cmds.meson.run",
  ".spin/cmds.py:ipython",
  ".spin/cmds.py:python",
  "spin.cmds.meson.gdb",
  "spin.cmds.meson.lldb"
]
"Documentation" = [
  ".spin/cmds.py:docs",
  ".spin/cmds.py:changelog",
  ".spin/cmds.py:notes",
  ".spin/cmds.py:check_docs",
  ".spin/cmds.py:check_tutorials",
]
"Metrics" = [".spin/cmds.py:bench"]


[tool.pyrefly]
project-includes = ["numpy/**/*.pyi"]
project-excludes = ["numpy/typing/tests/**"]

[tool.pyrefly.errors]
implicit-any = "error"
unannotated-parameter = "error"
unannotated-return = "error"

[[tool.pyrefly.sub-config]]
matches = "numpy/__init__.pyi"
errors = { bad-override = "ignore" }

[[tool.pyrefly.sub-config]]
matches = "numpy/_typing/_nbit_base.pyi"
errors = { invalid-inheritance = "ignore" }

[[tool.pyrefly.sub-config]]
matches = "numpy/ma/core.pyi"
errors = { bad-override = "ignore" }

[[tool.pyrefly.sub-config]]
matches = "numpy/matrixlib/defmatrix.pyi"
errors = { bad-override = "ignore" }
