Metadata-Version: 2.4
Name: scipy-stubs
Version: 1.16.0.0
Summary: Type annotations for SciPy
Project-URL: Homepage, https://scipy.org/
Project-URL: Repository, https://github.com/scipy/scipy-stubs/
Project-URL: Issues, https://github.com/scipy/scipy-stubs/issues
Project-URL: Changelog, https://github.com/scipy/scipy-stubs/releases
Author-email: Joren Hammudoglu <jhammudoglu@gmail.com>
Maintainer-email: Joren Hammudoglu <jhammudoglu@gmail.com>, SciPy Developers <scipy-dev@python.org>
License-Expression: BSD-3-Clause
License-File: LICENSE
Keywords: mypy,pep484,pep561,pyright,scipy,scipy-stubs,stubs,typing
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Stubs Only
Requires-Python: >=3.11
Requires-Dist: optype<1,>=0.10.0
Provides-Extra: scipy
Requires-Dist: scipy<1.17,>=1.16.0rc2; extra == 'scipy'
Description-Content-Type: text/markdown

# scipy-stubs

Precise type hints for **all** of <a href="https://github.com/scipy/scipy">SciPy</a>.

[![PyPI](https://img.shields.io/pypi/v/scipy-stubs?color=blue&style=flat-square)](https://pypi.org/project/scipy-stubs/)
[![scipy-stubs - conda-forge](https://anaconda.org/conda-forge/scipy-stubs/badges/version.svg)](https://anaconda.org/conda-forge/scipy-stubs)
![Python Versions](https://img.shields.io/pypi/pyversions/scipy-stubs?color=blue&style=flat-square)
![license](https://img.shields.io/github/license/scipy/scipy-stubs?color=violet&style=flat-square)
![PyPI Downloads](https://img.shields.io/pypi/dm/scipy-stubs?color=violet&style=flat-square)

[![ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![basedpyright](https://img.shields.io/badge/basedpyright-checked-42b983)](https://detachhead.github.io/basedpyright)
[![pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://github.com/microsoft/pyright)
[![mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://github.com/python/mypy)
![typed](https://img.shields.io/pypi/types/scipy-stubs?color=white)

## Quick Start

Install `scipy-stubs` and start getting better type hints immediately:

```bash
pip install scipy-stubs
```

That's it! Your IDE and type checker will now provide precise type information for SciPy functions:

![scipy-stubs demo](https://github.com/user-attachments/assets/2cf05d30-9a4c-41f9-8bc2-bbf12998ff26)

## Why use scipy-stubs?

### Enhanced Development Experience

- **Better IDE support**: Get accurate autocompletion, parameter hints, and return type information
- **Catch errors early**: Type checkers can detect mistakes before runtime
- **Improved code documentation**: Type hints serve as inline documentation for function signatures

### Zero Configuration Required

- **Drop-in replacement**: Works immediately after installation, no configuration needed
- **No runtime impact**: Type stubs are only used during development and type checking
- **IDE agnostic**: Works with VSCode, PyCharm, Vim, Emacs, and any editor with Python language server support

### Precise and Complete

- **Array shape awareness**: Many functions include shape-type information for better array handling
- **Generic types**: Supports generic types for sparse arrays, distributions, and more
- **Complete coverage**: Type hints are provided for the entire SciPy API

<!-- NOTE: SciPy permalinks to the following `#installation` anchor; don't modify it! -->

## Installation

The source code is hosted on GitHub at [github.com/scipy/scipy-stubs](https://github.com/scipy/scipy-stubs/).

Binary distributions are available on [PyPI](https://pypi.org/project/scipy-stubs/) and
[conda-forge](https://anaconda.org/conda-forge/scipy-stubs).

### Using pip (PyPI)

To install from the [PyPI](https://pypi.org/project/scipy-stubs/), run:

```bash
pip install scipy-stubs
```

In case you haven't installed `scipy` yet, both can be installed with:

```bash
pip install scipy-stubs[scipy]
```

### Using conda (conda-forge)

To install using Conda from the [conda-forge channel](https://anaconda.org/conda-forge/scipy-stubs), run:

```bash
conda install conda-forge::scipy-stubs
```

It's also possible to install both `scipy` and `scipy-stubs` together through the bundled
[`scipy-typed`](https://anaconda.org/conda-forge/scipy-typed) package:

```bash
conda install conda-forge::scipy-typed
```

## Frequently Asked Questions

### Q: Do I need to change my existing code?

**A:** No! `scipy-stubs` works with your existing code without any modifications.
    Just install it and your type checker and IDE will automatically use the type information.

### Q: Will this slow down my code?

**A:** Not at all. Type stubs are only used during development and type checking.
    They have zero runtime overhead since they're not imported when your code runs.

### Q: What if I don't use type hints in my code?

**A:** You'll still benefit! Your IDE will provide better autocompletion and error detection
    even without explicit type annotations in your code.

### Q: Can I use this with Jupyter notebooks?

**A:** Yes! Most modern Jupyter environments (JupyterLab, VS Code notebooks) support
    type checking and will benefit from `scipy-stubs`.

### Q: What's the difference between this and the built-in scipy typing?

**A:** SciPy itself has limited type annotations. `scipy-stubs` provides comprehensive,
    precise type information for the entire SciPy API, including shape-typing and advanced type features.

### Q: How do I know if it's working?

**A:** You should see improved autocompletion in your IDE and more precise type information.
    You can also run `pyright` or another type checker on your code to see type checking in action.

### Q: How much of SciPy is covered?

**A:** All of it! If you find any missing or incorrect type annotations, please open an issue on [GitHub](https://github.com/scipy/scipy-stubs/issues).

### Q: What static type-checkers are supported?

**A:** `scipy-stubs` is compatible with [`pyright`](https://pyright.readthedocs.io/en/latest/index.html) (a.k.a. pylance),
    [`basedpyright`](https://github.com/DetachHead/basedpyright), and [`mypy`](https://github.com/python/mypy).
    We only support the latest versions of these type-checkers, so make sure to keep them up to date.

## Versioning and requirements

The versioning scheme of `scipy-stubs` includes the compatible `scipy` version as `{scipy_version}.{stubs_version}`.
Even though `scipy-stubs` doesn't enforce an upper bound on the `scipy` version, later `scipy` versions aren't guaranteed to be
fully compatible.

There are no additional restrictions enforced by `scipy-stubs` on the `numpy` requirements.
For `scipy-stubs==1.16.*` that is `numpy >= 1.25.2`.

Currently, `scipy-stubs` has one required dependency: [`optype`](https://github.com/jorenham/optype).
This is essential for `scipy-stubs` to work properly, as it relies heavily on it for annotating (shaped) array-likes,
scalar-likes, shape-typing in general, and much more. At the moment, `scipy-stubs` requires the latest version `optype`.

The exact version requirements are specified in the [`pyproject.toml`](pyproject.toml).

## Contributing

We welcome contributions from the community! There are many ways to help improve `scipy-stubs`:

### Ways to Contribute

- **Report issues**: Found a bug or incorrect type annotation? [Open an issue](https://github.com/scipy/scipy-stubs/issues)
- **Improve stubs**: Fix or enhance `.pyi` files (see [CONTRIBUTING.md](https://github.com/scipy/scipy-stubs/blob/master/CONTRIBUTING.md))
- **Add tests**: Help with type-testing (see the `README.md` in [`tests/`](https://github.com/scipy/scipy-stubs/tree/master/tests))
- **Documentation**: Write guides, examples, or improve existing documentation
- **Spread the word**: Help others discover `scipy-stubs`

### Development Setup

See the [CONTRIBUTING.md](https://github.com/scipy/scipy-stubs/blob/master/CONTRIBUTING.md) for detailed instructions.

## License

`scipy-stubs` is licensed under the [BSD 3-Clause License](https://github.com/scipy/scipy-stubs/blob/master/LICENSE),
the same as SciPy itself.
