Thanks to visit codestin.com
Credit goes to github.com

Skip to content
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
12 changes: 8 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ jobs:
uv run ruff check --output-format=github
uv run ruff format --check

# TODO: static acceptance tests
- name: test static (sanity)
run: uv run --directory test static all static/sanity

- name: test static (reject)
run: |
uv run mypy --hide-error-context --hide-error-code-links --no-pretty test/static/reject
uv run basedpyright test/static/reject
run: uv run --directory test static all static/reject

- name: test static (accept)
run: uv run --directory test static all static/accept
continue-on-error: true # TODO
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"evenBetterToml.formatter.compactInlineTables": true,
"evenBetterToml.formatter.indentString": " ",
"evenBetterToml.formatter.indentTables": true,
"evenBetterToml.formatter.trailingNewline": true
"evenBetterToml.formatter.trailingNewline": true,
"mypy-type-checker.path": ["uv", "run", "--directory=test", "static", "bmp"]
}
50 changes: 29 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ dependencies = []
Issues = "https://github.com/jorenham/numtype/issues"
Changelog = "https://github.com/jorenham/numtype/releases"


[dependency-groups]
numpy = ["numtype[numpy]"]
dev = [
Expand All @@ -47,45 +48,54 @@ dev = [
"libcst>=1.6.0",
]

[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
"/.vscode",
"/dist",
"/test",
"/tool",
".libcst.codemod.yaml",
"CONTRIBUTING.md",
"uv.lock",
]

[tool.hatch.build.targets.wheel]
[tool.hatch.build]
packages = ["src/numpy-stubs"]

[tool.hatch.build.targets.sdist]
exclude = [
"/.github",
"/.vscode",
"/dist",
"/docs",
"/test",
"/tool",
".libcst.codemod.yaml",
"CONTRIBUTING.md",
"uv.lock",
]

[tool.mypy]
files = ["src/numpy-stubs/**/*.pyi", "test/**/*.pyi", "tool/*.py"]
python_version = "3.10"
strict = true

disable_bytearray_promotion = true
disable_memoryview_promotion = true
enable_error_code = ["ignore-without-code", "truthy-bool"]
warn_unused_ignores = true
# TODO
disable_error_code = ["explicit-override"]
# basedmypy only
warn_unreachable = false
warn_unused_ignores = true
# basedmypy/mypy compat
bare_literals = false
default_return = false
disallow_any_explicit = false
disallow_untyped_calls = false
warn_unreachable = false


[tool.pyright]
include = ["src/numpy-stubs", "test/static/accept", "test/static/reject", "tool"]
include = [
"src/numpy-stubs",
"test/static/accept",
"test/static/reject",
"test/static/sanity",
"tool",
]
ignore = [".venv"]
stubPath = "src"
pythonPlatform = "All"
pythonVersion = "3.10"
typeCheckingMode = "standard" # TODO(jorenham): set to "all"
typeCheckingMode = "standard" # TODO(jorenham): set to "all"

deprecateTypingAliases = true
enableTypeIgnoreComments = false
Expand Down Expand Up @@ -144,12 +154,10 @@ preview = true
"PLC2701", # pylint/C: import-private-name
]

[tool.ruff.lint.flake8-annotations]
suppress-dummy-args = true

[tool.ruff.lint.flake8-import-conventions]
banned-from = [
"abc",
"basedtyping",
"ctypes",
"datetime",
"os",
Expand Down
3 changes: 3 additions & 0 deletions src/numpy-stubs/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,9 @@ __future_scalars__: Final[set[_FutureScalar]] = ...
__array_api_version__: Final = "2023.12"
test: Final[PytestTester] = ...

# NumType only
__numtype__: Final = True

@final
class dtype(Generic[_SCT_co]):
names: tuple[str, ...] | None
Expand Down
14 changes: 10 additions & 4 deletions src/numpy-stubs/_core/fromnumeric.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -140,24 +140,27 @@ def reshape( # shape: index
shape: SupportsIndex,
order: np._OrderACF = "C",
*,
newshape: None = None,
copy: bool | None = None,
) -> np.ndarray[tuple[int], np.dtype[_SCT]]: ...
@overload
def reshape( # shape: (int, ...) @ np._AnyShapeT
a: _ArrayLike[_SCT],
/,
shape: np._AnyShapeT,
shape: _ShapeT,
order: np._OrderACF = "C",
*,
newshape: None = None,
copy: bool | None = None,
) -> np.ndarray[np._AnyShapeT, np.dtype[_SCT]]: ...
) -> np.ndarray[_ShapeT, np.dtype[_SCT]]: ...
@overload # shape: Sequence[index]
def reshape(
a: _ArrayLike[_SCT],
/,
shape: Sequence[SupportsIndex],
order: np._OrderACF = "C",
*,
newshape: None = None,
copy: bool | None = None,
) -> NDArray[_SCT]: ...
@overload # shape: index
Expand All @@ -167,24 +170,27 @@ def reshape(
shape: SupportsIndex,
order: np._OrderACF = "C",
*,
newshape: None = None,
copy: bool | None = None,
) -> np.ndarray[tuple[int], np.dtype[Any]]: ...
@overload
def reshape( # shape: (int, ...) @ np._AnyShapeT
a: ArrayLike,
/,
shape: np._AnyShapeT,
shape: _ShapeT,
order: np._OrderACF = "C",
*,
newshape: None = None,
copy: bool | None = None,
) -> np.ndarray[np._AnyShapeT, np.dtype[Any]]: ...
) -> np.ndarray[_ShapeT, np.dtype[Any]]: ...
@overload # shape: Sequence[index]
def reshape(
a: ArrayLike,
/,
shape: Sequence[SupportsIndex],
order: np._OrderACF = "C",
*,
newshape: None = None,
copy: bool | None = None,
) -> NDArray[Any]: ...
@overload
Expand Down
3 changes: 0 additions & 3 deletions src/numpy-stubs/_numtype.pyi

This file was deleted.

Loading
Loading