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
5 changes: 3 additions & 2 deletions .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ exclude_lines =
def __repr__
if self.debug:
if settings.DEBUG
if TYPE_CHECKING:
raise AssertionError
raise NotImplementedError
if 0:
if __name__ == .__main__.:
@overload

[run]
source = stl
source = stl
branch = True

37 changes: 37 additions & 0 deletions .github/workflows/type_check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Type-check

on:
push:
branches: [master, develop]
pull_request:
workflow_dispatch:

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

jobs:
type-check:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v6

- uses: astral-sh/setup-uv@v7
with:
activate-environment: true

- name: install
run: uv pip install cython basedpyright pyrefly mypy .

- name: run basedpyright
run: basedpyright

- name: run basedpyright --verifytypes
run: basedpyright --ignoreexternal --verifytypes stl

- name: run pyrefly check
run: pyrefly check

- name: run mypy
run: mypy --no-incremental --cache-dir=/dev/null stl
27 changes: 27 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[tool.mypy]
packages = ["stl"]
local_partial_types = true
allow_redefinition_new = true
strict = true
enable_error_code = [
"exhaustive-match",
"ignore-without-code",
"redundant-expr",
"truthy-bool",
]
warn_return_any = false


[tool.pyright]
pythonPlatform = "All"
include = ["stl"]
ignore = [".venv"]
stubPath = "."
typeCheckingMode = "strict"
reportPrivateUsage = false # dupe of PLC2701
reportUnusedParameter = false # dupe of F841
reportUnusedVariable = false # dupe of F841


[tool.pyrefly]
project-includes = ["stl"]
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ def run(self):
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Topic :: Software Development :: Libraries :: Python Modules',
'Typing :: Typed',
],
install_requires=install_requires,
cmdclass=dict(
Expand Down
16 changes: 9 additions & 7 deletions stl/__about__.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
__package_name__ = 'numpy-stl'
__import_name__ = 'stl'
__version__ = '3.2.0'
__author__ = 'Rick van Hattem'
__author_email__ = '[email protected]'
__description__ = ' '.join(
from typing import Final

__package_name__: Final[str] = 'numpy-stl'
__import_name__: Final[str] = 'stl'
__version__: Final[str] = '3.2.0'
__author__: Final[str] = 'Rick van Hattem'
__author_email__: Final[str] = '[email protected]'
__description__: Final[str] = ' '.join(
"""
Library to make reading, writing and modifying both binary and ascii STL files
easy.
""".split()
)
__url__ = 'https://github.com/WoLpH/numpy-stl/'
__url__: Final[str] = 'https://github.com/WoLpH/numpy-stl/'
9 changes: 9 additions & 0 deletions stl/_speedups.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
from typing import IO

import numpy as np
from typing_extensions import Buffer, TypeAlias

_DataArray: TypeAlias = np.ndarray[tuple[int], np.dtype[np.void]]

def ascii_read(fh: IO[bytes], buf: Buffer) -> tuple[bytes, _DataArray]: ...
def ascii_write(fh: IO[bytes], name: bytes, data: _DataArray) -> None: ...
Loading