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
18 changes: 11 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ classifiers = [
"Typing :: Stubs Only",
"Typing :: Typed",
]
packages = [
{include = "src/numpy-stubs"},
{include = "src/numtype"},
]
requires-python = ">=3.10"
packages = [{include = "src/numpy-stubs"}]
dependencies = []

[project.optional-dependencies]
Expand All @@ -53,7 +56,7 @@ dev = [


[tool.hatch.build]
packages = ["src/numpy-stubs"]
packages = ["src/numpy-stubs", "src/numtype"]

[tool.hatch.build.targets.sdist]
exclude = [
Expand All @@ -64,6 +67,7 @@ packages = ["src/numpy-stubs"]
"/test",
"/tool",
".libcst.codemod.yaml",
".pre-commit-config.yaml",
"CONTRIBUTING.md",
"uv.lock",
]
Expand Down Expand Up @@ -98,10 +102,9 @@ warn_unreachable = false
[tool.pyright]
include = [
"src/numpy-stubs",
"test/runtime/accept",
"test/static/accept",
"test/static/reject",
"test/static/sanity",
"src/numtype",
"test/runtime",
"test/static",
"tool",
]
ignore = [".venv", "test/.venv"]
Expand Down Expand Up @@ -139,7 +142,7 @@ strictGenericNarrowing = true


[tool.ruff]
src = ["src/numpy-stubs", "test/runtime", "test/static", "tool"]
src = ["src/numpy-stubs", "src/numtype", "test", "tool"]
extend-exclude = [".git", ".mypy_cache", ".tox", ".venv"]
force-exclude = true
# https://typing.readthedocs.io/en/latest/guides/writing_stubs.html#maximum-line-length
Expand Down Expand Up @@ -189,6 +192,7 @@ preview = true
"datetime" = "dt"
"numpy" = "np"
"numpy.typing" = "npt"
"numtype" = "nt"

[tool.ruff.lint.isort]
case-sensitive = true
Expand Down
2 changes: 1 addition & 1 deletion src/ruff.toml → src/numpy-stubs/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
extend = "../pyproject.toml"
extend = "../../pyproject.toml"
line-length = 130

[lint]
Expand Down
7 changes: 7 additions & 0 deletions src/numtype/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""A superset of `numpy.typing`. Will be expanded in the future."""

from numpy.typing import ArrayLike, DTypeLike, NBitBase, NDArray # noqa: ICN003

from .version import __version__

__all__ = ["ArrayLike", "DTypeLike", "NBitBase", "NDArray", "__version__"]
2 changes: 2 additions & 0 deletions src/numtype/ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
extend = "../../pyproject.toml"
line-length = 88
7 changes: 7 additions & 0 deletions src/numtype/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"""Module to expose more detailed version info for the installed `numtype`."""

import importlib.metadata
from typing import Final

__all__ = ["__version__"]
__version__: Final = importlib.metadata.version(__package__ or __file__.split("/")[-1])
18 changes: 18 additions & 0 deletions test/runtime/test_numtype.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import numtype as nt
import pytest

import numpy as np
import numpy.typing as npt


def test_superset() -> None:
assert set(nt.__all__) > set(npt.__all__)


@pytest.mark.parametrize("name", npt.__all__)
def test_reexport(name: str) -> None:
assert getattr(nt, name) is getattr(npt, name)


def test_version() -> None:
assert nt.__version__.startswith(np.__version__)