diff --git a/ci/azure-sdist.yml b/ci/azure-sdist.yml index cc801b91..876a33c8 100644 --- a/ci/azure-sdist.yml +++ b/ci/azure-sdist.yml @@ -16,7 +16,7 @@ steps: displayName: ensure toolchain - bash: PATH=$(path) $(interpreter) -m pip install --user --upgrade pip "maturin>=0.12.18,<0.13" wheel displayName: build dependencies -- bash: PATH=$(path) $(interpreter) -m pip install --user -r test/requirements.txt -r integration/requirements.txt +- bash: PATH=$(path) $(interpreter) -m pip install --user -r test/requirements.txt -r integration/requirements.txt mypy==0.960 displayName: test dependencies - bash: PATH=$(path) maturin sdist displayName: package sdist @@ -28,6 +28,8 @@ steps: displayName: thread - bash: PATH=$(path) ./integration/run http displayName: http +- bash: PATH=$(path) ./integration/run typestubs + displayName: typestubs - bash: PATH=$(path) ./ci/deploy target/wheels/*.tar.gz displayName: deploy env: diff --git a/integration/run b/integration/run index d73effb3..89a95e9a 100755 --- a/integration/run +++ b/integration/run @@ -18,3 +18,8 @@ if [[ $to_run == *"http"* ]]; then pkill -f 'wsgi:app' # pkill not present on manylinux_2_24_x86_64 set -e fi + +if [[ $to_run == *"typestubs"* ]]; then + python "${_dir}"/typestubs.py + mypy "${_dir}"/typestubs.py +fi diff --git a/integration/typestubs.py b/integration/typestubs.py new file mode 100644 index 00000000..e7527e99 --- /dev/null +++ b/integration/typestubs.py @@ -0,0 +1,5 @@ +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +import orjson + +orjson.JSONDecodeError(msg="the_msg", doc="the_doc", pos=1) diff --git a/orjson.pyi b/orjson.pyi index 0ab800b7..5e5d697b 100644 --- a/orjson.pyi +++ b/orjson.pyi @@ -1,3 +1,4 @@ +import json from typing import Any, Callable, Optional, Union __version__: str @@ -9,7 +10,7 @@ def dumps( ) -> bytes: ... def loads(__obj: Union[bytes, bytearray, memoryview, str]) -> Any: ... -class JSONDecodeError(ValueError): ... +class JSONDecodeError(json.JSONDecodeError): ... class JSONEncodeError(TypeError): ... OPT_APPEND_NEWLINE: int