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

Stubtest and related fixes #8

Merged
merged 21 commits into from
Aug 30, 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
4 changes: 2 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ indent_style = space
trim_trailing_whitespace = true

# 4 space indentation
[*.{py, pyi, .md}]
[*.{py,pyi,md}]
indent_size = 4

# 2 space indentation
[*.{json, jsonc, yml, yaml}]
[*.{json,jsonc,yml,yaml,toml}]
indent_size = 2
61 changes: 61 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CI

on:
push:
branches:
- master
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
lint:
timeout-minutes: 5
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: markdownlint
uses: DavidAnson/markdownlint-cli2-action@v16
with:
config: ".markdownlint.yaml"
globs: "**/*.md"

- name: install poetry
run: |
pipx install poetry
poetry config virtualenvs.create true --local
poetry config virtualenvs.in-project true --local

- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: poetry

- name: poetry install
run: poetry install

- name: ruff check
run: poetry run ruff check --output-format=github

- name: basedpyright --verifytypes
run: poetry run basedpyright --ignoreexternal --verifytypes scipy-stubs

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

# TODO: don't continue on error
- name: basedpyright --verifytypes
run: poetry run basedpyright --verifytypes scipy-stubs
continue-on-error: true

# TODO
# - uses: scientific-python/[email protected]
# with:
# plugins: sp-repo-review
10 changes: 9 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@
"[markdown]": {
"editor.rulers": [88]
},
"[toml]": {
"editor.rulers": [88],
"editor.tabSize": 4
},
"git.branchProtection": ["master"],
"mypy-type-checker.args": ["--config-file=pyproject.toml"]
"mypy-type-checker.args": [
"--config-file=pyproject.toml"
],
"yaml.format.printWidth": 88,
"prettier.printWidth": 88
}
25 changes: 13 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,32 +83,33 @@ pip install scipy-stubs
| Module | Stubs status |
|---------------------------------- |---------------- |
| `scipy` | 1: skeleton |
| `scipy._lib` | 1: skeleton |
| `scipy._lib._uarray` | 0: missing |
| `scipy._lib` | 2: partial |
| `scipy._lib.uarray` | 2: ready |
| `scipy._lib.array_api_compat` | 2: partial |
| `scipy.cluster` | 1: skeleton |
| `scipy.constants` | 3: ready |
| `scipy.datasets` | 1: skeleton |
| `scipy.fft` | 1: skeleton |
| `scipy.fft._pocketfft` | 1: skeleton |
| `scipy.fft._pocketfft` | 1: partial |
| `scipy.fftpack` | 1: skeleton |
| `scipy.integrate` | 1: skeleton |
| `scipy.integrate._ivp` | 1: skeleton |
| `scipy.interpolate` | 1: skeleton |
| `scipy.integrate` | 2: partial |
| `scipy.integrate._ivp` | 1: partial |
| `scipy.interpolate` | 2: partial |
| `scipy.io` | 1: skeleton |
| `scipy.io.arff` | 1: skeleton |
| `scipy.io.matlab` | 1: skeleton |
| `scipy.io.matlab` | 2: partial |
| `scipy.linalg` | 3: ready |
| `scipy.misc` | 0: missing |
| `scipy.ndimage` | 1: skeleton |
| `scipy.odr` | 1: skeleton |
| `scipy.optimize` | 1: skeleton |
| `scipy.optimize` | 2: partial |
| `scipy.optimize.cython_optimize` | 0: missing |
| `scipy.optimize.zeros` | 0: missing |
| `scipy.signal` | 1: skeleton |
| `scipy.signal` | 1: partial |
| `scipy.signal.windows` | 1: skeleton |
| `scipy.sparse` | 1: skeleton |
| `scipy.sparse.csgraph` | 1: skeleton |
| `scipy.sparse.linalg` | 1: skeleton |
| `scipy.sparse` | 2: partial |
| `scipy.sparse.csgraph` | 2: partial |
| `scipy.sparse.linalg` | 2: partial |
| `scipy.spatial` | 2: partial |
| `scipy.spatial.distance` | 3: ready |
| `scipy.special` | 3: ready |
Expand Down
144 changes: 102 additions & 42 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,74 +1,72 @@
[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

requires = ["poetry-core"]

[tool.poetry]
name = "scipy-stubs"
version = "1.4.1.dev0"
description = ""
authors = ["Joren Hammudoglu <[email protected]>"]
license = "BSD-3-Clause"
readme = "README.md"
packages = [{include = "scipy-stubs"}]
classifiers = [
"Development Status :: 3 - Alpha",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering",
"Typing :: Stubs Only",
"Typing :: Typed",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Development Status :: 3 - Alpha",
"Operating System :: OS Independent",
"Topic :: Scientific/Engineering",
"Typing :: Stubs Only",
"Typing :: Typed",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]
repository = "https://github.com/jorenham/scipy-stubs/"
description = ""
documentation = "https://github.com/jorenham/scipy-stubs?tab=readme-ov-file#scipy-stubs"
license = "BSD-3-Clause"
name = "scipy-stubs"
packages = [{include = "scipy-stubs"}]
readme = "README.md"
repository = "https://github.com/jorenham/scipy-stubs/"
version = "1.4.1.dev0"

[tool.poetry.urls]
"Bug Tracker" = "https://github.com/jorenham/scipy-stubs/issues"
"Changelog" = "https://github.com/jorenham/scipy-stubs/releases"

[tool.poetry.dependencies]
python = "^3.10.1"
optype = "^0.6.1"
python = "^3.10.1"
scipy = "^1.14.1"

[tool.poetry.group.lint.dependencies]
ruff = "^0.6.2"
basedmypy = "^2.6.0"
basedpyright = "^1.17.1"
ruff = "^0.6.2"

[tool.poetry.group.dev.dependencies]
pre-commit = "^3.8.0"
poethepoet = "^0.27.0"

pre-commit = "^3.8.0"

[tool.mypy]
warn_unused_ignores = true
disallow_any_explicit = false # no other way to type e.g. `np.float64 <: np.number[Any]`
disable_bytearray_promotion = true
disable_memoryview_promotion = true

disallow_any_explicit = false # no other way to type e.g. `float64 <: number[Any]`
disallow_untyped_defs = false # TODO
disallow_incomplete_defs = false # TODO
warn_unused_ignores = true

[tool.pyright]
include = ["scipy-stubs"]
stubPath = "."
venvPath = "."
venv = ".venv"
pythonVersion = "3.10"
pythonPlatform = "All"
pythonVersion = "3.10"
stubPath = "."
typeCheckingMode = "strict"
venv = ".venv"
venvPath = "."

deprecateTypingAliases = true
reportPrivateUsage = false
reportIgnoreCommentWithoutRule = true
reportImplicitRelativeImport = true
reportInvalidCast = true
reportPrivateUsage = false
reportUnnecessaryTypeIgnoreComment = true
reportUnsafeMultipleInheritance = true


[tool.ruff]
builtins = ["reveal_locals", "reveal_type"]
exclude = ["scipy-pyright", ".venv"]
Expand All @@ -82,26 +80,88 @@ src = ["scipy-stubs"]
line-ending = "lf"
skip-magic-trailing-comma = false


[tool.ruff.lint]
ignore = [
"E741",
"COM812", # ruff format compat
"ANN", # TODO
]
preview = true
select = ["E", "W", "I", "UP", "ANN", "COM", "EXE", "ICN", "INP", "PYI", "Q", "TID", "TCH", "ERA", "PGH", "RUF"]
extend-select = [
"PLC0105", "PLC0131", "PLC0132", "PLC0414",
"PLE0303", "PLE0304", "PLE0305", "PLE0307", "PLE0308", "PLE0309",
"PLE0604", "PLE0605", "PLE1132"
select = [
"E",
"W",
"I",
"UP",
"ANN",
"COM",
"EXE",
"ICN",
"INP",
"PYI",
"Q",
"TID",
"TCH",
"ERA",
"PGH",
"RUF",
"PLC0105",
"PLC0131",
"PLC0132",
"PLC0414",
"PLE0303",
"PLE0304",
"PLE0305",
"PLE0307",
"PLE0308",
"PLE0309",
"PLE0604",
"PLE0605",
"PLE1132",
]
ignore = [
"E741",
"COM812", # ruff format compat
"ANN", # TODO

[tool.ruff.lint.flake8-import-conventions]
banned-from = [
"numpy",
"numpy.dtypes",
"numpy.exceptions",
"numpy.emath",
"numpy.fft",
"numpy.linalg",
"numpy.ma",
"numpy.polynomial",
"numpy.random",
"numpy.rec",
"numpy.typing",
"numpy.strings",
"optype",
"optype.numpy",
"optype.typing",
]
[tool.ruff.lint.flake8-import-conventions.extend-aliases]
"numpy" = "np"
"numpy.polynomial" = "npp"
"numpy.typing" = "npt"
"optype" = "op"
"optype.numpy" = "onpt"
"scipy" = "sp"
"scipy._typing" = "spt"

[tool.ruff.lint.isort]
combine-as-imports = true
known-local-folder = ["scipy"]
known-first-party = ["scipy"]
no-lines-before = ["typing", "first-party", "local-folder"]
section-order = [
"standard-library",
"typing",
"third-party",
"first-party",
"local-folder",
]
split-on-trailing-comma = true

[tool.ruff.lint.isort.sections]
typing = ["collections.abc", "types", "typing", "typing_extensions"]

[tool.ruff.lint.flake8-annotations]
allow-star-arg-any = true
mypy-init-return = true
Loading
Loading