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

scipy.__init__ #13

Merged
merged 4 commits into from
Sep 4, 2024
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

# TODO: don't continue on error
- name: basedmypy stubtest
run: poetry run stubtest --concise --mypy-config-file=pyproject.toml --allowlist=tests/mypy_allowlist.txt scipy
run: poetry run stubtest --concise --mypy-config-file=pyproject.toml --allowlist=tests/stubtest/allowlist.txt scipy
continue-on-error: true

# TODO
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,12 @@ pip install scipy-stubs
## Development Progress

According to [basedpyright](https://github.com/DetachHead/basedpyright) (stricter than
pyright), the "type completeness score" is **39.2%**.
pyright), the "type completeness score" is **42.4%**.

| Module | Stubs status |
|---------------------------------- |---------------- |
| `scipy` | 1: skeleton |
| `scipy.__init__` | 3: ready |
| `scipy._lib` | 2: partial |
| `scipy._lib.uarray` | 3: ready |
| `scipy._lib.array_api_compat` | 2: partial |
| `scipy.cluster` | 1: skeleton |
| `scipy.constants` | 3: ready |
| `scipy.datasets` | 2: partial |
Expand Down
31 changes: 31 additions & 0 deletions scipy-stubs/__config__.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# This file is generated by SciPy's build process
# It contains system_info results at the time of building this package.
from enum import Enum
from types import ModuleType
from typing import Final, Literal, TypedDict, overload

__all__ = ["show"]

_ConfigDict = TypedDict(
"_ConfigDict",
{
"Compilers": dict[str, dict[str, str]],
"Machine Information": dict[str, dict[str, str] | bool],
"Build Dependencies": dict[str, dict[str, str | bool]],
"Python Information": dict[str, str],
},
)

_built_with_meson: Final[bool]

class DisplayModes(Enum):
stdout = "stdout"
dicts = "dicts"

CONFIG: Final[_ConfigDict]

def _check_pyyaml() -> ModuleType: ...
@overload
def show(mode: Literal["stdout"] = "stdout") -> _ConfigDict: ...
@overload
def show(mode: Literal["dicts"]) -> _ConfigDict: ...
94 changes: 82 additions & 12 deletions scipy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,12 +1,82 @@
from scipy._lib._ccallback import LowLevelCallable as LowLevelCallable
from scipy._lib._testutils import PytestTester as PytestTester
from scipy._typing import Untyped

msg: str
np_minversion: str
np_maxversion: str
test: Untyped
submodules: Untyped

def __dir__() -> Untyped: ...
def __getattr__(name) -> Untyped: ...
from collections.abc import Sequence
from typing import Final, Literal
from typing_extensions import LiteralString

from . import (
cluster,
constants,
datasets,
fft,
fftpack,
integrate,
interpolate,
io,
linalg,
misc,
ndimage,
odr,
optimize,
signal,
sparse,
spatial,
special,
stats,
)
from .__config__ import show as show_config
from ._lib._ccallback import LowLevelCallable
from ._lib._testutils import PytestTester

__all__ = [
"LowLevelCallable",
"__version__",
"cluster",
"constants",
"datasets",
"fft",
"fftpack",
"integrate",
"interpolate",
"io",
"linalg",
"misc",
"ndimage",
"odr",
"optimize",
"show_config",
"signal",
"sparse",
"spatial",
"special",
"stats",
"test",
]
__version__: Final[LiteralString]
np_minversion: Final[LiteralString]
np_maxversion: Final[LiteralString]

test: Final[PytestTester]

submodules: Final[
Sequence[
Literal[
"cluster",
"constants",
"datasets",
"fft",
"fftpack",
"integrate",
"interpolate",
"io",
"linalg",
"misc",
"ndimage",
"odr",
"optimize",
"signal",
"sparse",
"spatial",
"special",
"stats",
]
]
]
55 changes: 30 additions & 25 deletions scipy-stubs/_lib/_testutils.pyi
Original file line number Diff line number Diff line change
@@ -1,38 +1,43 @@
from scipy._typing import Untyped
from collections.abc import Callable, Iterable, Sequence
from typing import ClassVar, Final, Literal

required_version: str
IS_MUSL: bool
IS_EDITABLE: Untyped
import numpy as np

__all__ = ["IS_MUSL", "PytestTester", "_TestPythranFunc", "check_free_memory"]

IS_MUSL: Final[bool]
IS_EDITABLE: Final[bool]

class FPUModeChangeWarning(RuntimeWarning): ...

class PytestTester:
module_name: Untyped
def __init__(self, module_name) -> None: ...
module_name: Final[str]
def __init__(self, /, module_name: str) -> None: ...
def __call__(
self,
label: str = "fast",
/,
label: Literal["fast", "full"] = "fast",
verbose: int = 1,
extra_argv: Untyped | None = None,
extra_argv: Iterable[str] | None = None,
doctests: bool = False,
coverage: bool = False,
tests: Untyped | None = None,
parallel: Untyped | None = None,
) -> Untyped: ...
tests: Iterable[str] | None = None,
parallel: int | None = None,
) -> bool: ...

class _TestPythranFunc:
ALL_INTEGER: Untyped
ALL_FLOAT: Untyped
ALL_COMPLEX: Untyped
arguments: Untyped
partialfunc: Untyped
expected: Untyped
def setup_method(self): ...
def get_optional_args(self, func) -> Untyped: ...
def get_max_dtype_list_length(self) -> Untyped: ...
def get_dtype(self, dtype_list, dtype_idx) -> Untyped: ...
def test_all_dtypes(self): ...
def test_views(self): ...
def test_strided(self): ...
ALL_INTEGER: ClassVar[list[np.int8 | np.int16 | np.int32 | np.int64 | np.intc | np.intp]]
ALL_FLOAT: ClassVar[list[np.float32 | np.float64]]
ALL_COMPLEX: ClassVar[list[np.complex64 | np.complex128]]
arguments: dict[int, tuple[np.ndarray[tuple[int, ...], np.dtype[np.generic]], list[np.generic]]]
partialfunc: Callable[..., object] | None
expected: object | None
def setup_method(self) -> None: ...
def get_optional_args(self, func: Callable[..., object]) -> dict[str, object]: ...
def get_max_dtype_list_length(self) -> int: ...
def get_dtype(self, dtype_list: Sequence[np.generic], dtype_idx: int) -> np.generic: ...
def test_all_dtypes(self) -> None: ...
def test_views(self) -> None: ...
def test_strided(self) -> None: ...

def check_free_memory(free_mb): ...
def check_free_memory(free_mb: float) -> None: ...
Loading
Loading