diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b31254..1311265 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Development +* Made this package PEP 561 compliant (#49). * Release GIL during the computation of the CRC32C hash. A new `gil_release_mode` argument lets users choose between always/never/automatically releasing it (#47). * Add keyword support to `crc32c` function (`crc32c(data, value=0, gil_release_mode=-1)`). * Turned ``crc32c`` from a module-only distribution into a package, diff --git a/MANIFEST.in b/MANIFEST.in index 9815da7..20dc3ad 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,5 @@ include LICENSE* include AUTHORS* include src/crc32c/ext/*.h +include src/crc32c/*.pyi +include src/crc32c/py.typed diff --git a/setup.py b/setup.py index 232ca1e..0d5d403 100644 --- a/setup.py +++ b/setup.py @@ -67,5 +67,6 @@ classifiers=classifiers, packages=['crc32c'], package_dir={'': 'src'}, + include_package_data=True, ext_modules=[crcmod_ext], test_suite="test") diff --git a/src/crc32c/__init__.pyi b/src/crc32c/__init__.pyi new file mode 100644 index 0000000..5fe0d8a --- /dev/null +++ b/src/crc32c/__init__.pyi @@ -0,0 +1,7 @@ +from collections.abc import Buffer + +big_endian: int +hardware_based: bool + +def crc32(data: Buffer, value: int = 0, gil_release_mode: int = -1) -> int: ... +def crc32c(data: Buffer, value: int = 0, gil_release_mode: int = -1) -> int: ... diff --git a/src/crc32c/py.typed b/src/crc32c/py.typed new file mode 100644 index 0000000..e69de29