diff --git a/docs/compression/blosc.rst b/docs/compression/blosc.rst index 4a7681c9..dd87b3ac 100644 --- a/docs/compression/blosc.rst +++ b/docs/compression/blosc.rst @@ -18,15 +18,9 @@ Blosc Helper functions ---------------- -.. autofunction:: init -.. autofunction:: destroy -.. autofunction:: compname_to_compcode .. autofunction:: list_compressors .. autofunction:: get_nthreads .. autofunction:: set_nthreads -.. autofunction:: cbuffer_sizes .. autofunction:: cbuffer_complib -.. autofunction:: cbuffer_metainfo .. autofunction:: compress .. autofunction:: decompress -.. autofunction:: decompress_partial diff --git a/numcodecs/blosc.pyx b/numcodecs/blosc.pyx index 2c43dd04..b7a97b5a 100644 --- a/numcodecs/blosc.pyx +++ b/numcodecs/blosc.pyx @@ -6,6 +6,7 @@ import threading import multiprocessing import os +from deprecated import deprecated from cpython.buffer cimport PyBUF_ANY_CONTIGUOUS, PyBUF_WRITEABLE @@ -95,17 +96,22 @@ def get_mutex(): _importer_pid = os.getpid() -def init(): +def _init(): """Initialize the Blosc library environment.""" blosc_init() +init = deprecated(_init) -def destroy(): + +def _destroy(): """Destroy the Blosc library environment.""" blosc_destroy() -def compname_to_compcode(cname): +destroy = deprecated(_destroy) + + +def _compname_to_compcode(cname): """Return the compressor code associated with the compressor name. If the compressor name is not recognized, or there is not support for it in this build, -1 is returned instead.""" @@ -113,6 +119,8 @@ def compname_to_compcode(cname): cname = cname.encode('ascii') return blosc_compname_to_compcode(cname) +compname_to_compcode = deprecated(_compname_to_compcode) + def list_compressors(): """Get a list of compressors supported in the current build.""" @@ -133,7 +141,7 @@ def set_nthreads(int nthreads): return blosc_set_nthreads(nthreads) -def cbuffer_sizes(source): +def _cbuffer_sizes(source): """Return information about a compressed buffer, namely the number of uncompressed bytes (`nbytes`) and compressed (`cbytes`). It also returns the `blocksize` (which is used internally for doing the compression by blocks). @@ -160,6 +168,7 @@ def cbuffer_sizes(source): return nbytes, cbytes, blocksize +cbuffer_sizes = deprecated(_cbuffer_sizes) def cbuffer_complib(source): """Return the name of the compression library used to compress `source`.""" @@ -180,7 +189,7 @@ def cbuffer_complib(source): return complib -def cbuffer_metainfo(source): +def _cbuffer_metainfo(source): """Return some meta-information about the compressed buffer in `source`, including the typesize, whether the shuffle or bit-shuffle filters were used, and the whether the buffer was memcpyed. @@ -217,11 +226,13 @@ def cbuffer_metainfo(source): return typesize, shuffle, memcpyed +cbuffer_metainfo = deprecated(_cbuffer_metainfo) -def err_bad_cname(cname): +def _err_bad_cname(cname): raise ValueError('bad compressor or compressor not supported: %r; expected one of ' '%s' % (cname, list_compressors())) +err_bad_cname = deprecated(_err_bad_cname) def compress(source, char* cname, int clevel, int shuffle=SHUFFLE, int blocksize=AUTOBLOCKS): @@ -405,7 +416,7 @@ def decompress(source, dest=None): return dest -def decompress_partial(source, start, nitems, dest=None): +def _decompress_partial(source, start, nitems, dest=None): """**Experimental** Decompress data of only a part of a buffer. @@ -478,6 +489,7 @@ def decompress_partial(source, start, nitems, dest=None): return dest +decompress_partial = deprecated(_decompress_partial) # set the value of this variable to True or False to override the # default adaptive behaviour diff --git a/pyproject.toml b/pyproject.toml index 928d901b..50d095a6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,14 +13,10 @@ name = "numcodecs" description = """ A Python package providing buffer compression and transformation codecs \ for use in data storage and communication applications.""" -readme = "README.rst" -dependencies = [ - "numpy>=1.24", -] +readme = "README.rst" +dependencies = ["numpy>=1.24", "deprecated"] requires-python = ">=3.11" -dynamic = [ - "version", -] +dynamic = ["version"] classifiers = [ "Development Status :: 4 - Beta", "Intended Audience :: Developers", @@ -33,9 +29,7 @@ classifiers = [ "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", ] -maintainers = [ - { name = "Alistair Miles", email = "alimanfoo@googlemail.com" }, -] +maintainers = [{ name = "Alistair Miles", email = "alimanfoo@googlemail.com" }] license = { text = "MIT" } [project.urls] @@ -45,33 +39,13 @@ Documentation = "https://numcodecs.readthedocs.io/" Homepage = "https://github.com/zarr-developers/numcodecs" [project.optional-dependencies] -docs = [ - "sphinx", - "sphinx-issues", - "pydata-sphinx-theme", - "numpydoc", -] -test = [ - "coverage", - "pytest", - "pytest-cov", -] -test_extras = [ - "importlib_metadata", -] -msgpack = [ - "msgpack", -] -zfpy = [ - "zfpy>=1.0.0", - "numpy<2.0.0", -] -pcodec = [ - "pcodec>=0.2,<0.3", -] -crc32c = [ - "crc32c>=2.7", -] +docs = ["sphinx", "sphinx-issues", "pydata-sphinx-theme", "numpydoc"] +test = ["coverage", "pytest", "pytest-cov"] +test_extras = ["importlib_metadata"] +msgpack = ["msgpack"] +zfpy = ["zfpy>=1.0.0", "numpy<2.0.0"] +pcodec = ["pcodec>=0.2,<0.3"] +crc32c = ["crc32c>=2.7"] [project.entry-points."zarr.codecs"] "numcodecs.blosc" = "numcodecs.zarr3:Blosc" @@ -98,14 +72,14 @@ crc32c = [ [tool.setuptools] license-files = ["LICENSE.txt"] -package-dir = {"" = "."} +package-dir = { "" = "." } packages = ["numcodecs", "numcodecs.tests"] zip-safe = false [tool.setuptools.package-data] numcodecs = [ "tests/package_with_entrypoint/__init__.py", - "tests/package_with_entrypoint-0.1.dist-info/entry_points.txt" + "tests/package_with_entrypoint-0.1.dist-info/entry_points.txt", ] [tool.setuptools_scm] @@ -118,13 +92,25 @@ skip = "./.git,fixture" ignore-words-list = "ba, compiletime, hist, nd, unparseable" [tool.coverage.report] -exclude_lines = [ - "pragma: no cover", - "pragma: ${PY_MAJOR_VERSION} no cover", -] +exclude_lines = ["pragma: no cover", "pragma: ${PY_MAJOR_VERSION} no cover"] [tool.repo-review] -ignore = ["PY005", "PY007", "PP302", "PP308", "PP309", "GH103", "GH212", "PC111", "PC140", "PC160", "PC170", "PC180", "MY100", "RF103"] +ignore = [ + "PY005", + "PY007", + "PP302", + "PP308", + "PP309", + "GH103", + "GH212", + "PC111", + "PC140", + "PC160", + "PC170", + "PC180", + "MY100", + "RF103", +] [tool.pytest.ini_options] addopts = "-ra --strict-config --strict-markers --cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx" @@ -133,9 +119,7 @@ doctest_optionflags = [ "ELLIPSIS", "IGNORE_EXCEPTION_DETAIL", ] -testpaths = [ - "numcodecs/tests", -] +testpaths = ["numcodecs/tests"] norecursedirs = [ ".git", ".github", @@ -150,17 +134,15 @@ norecursedirs = [ ] log_cli_level = "INFO" xfail_strict = true -filterwarnings = [ - "error", -] +filterwarnings = ["error"] [tool.cibuildwheel] -environment = { DISABLE_NUMCODECS_AVX2=1 } +environment = { DISABLE_NUMCODECS_AVX2 = 1 } [tool.cibuildwheel.macos] -environment = { MACOSX_DEPLOYMENT_TARGET=10.9, DISABLE_NUMCODECS_AVX2=1, CFLAGS="$CFLAGS -Wno-implicit-function-declaration" } +environment = { MACOSX_DEPLOYMENT_TARGET = 10.9, DISABLE_NUMCODECS_AVX2 = 1, CFLAGS = "$CFLAGS -Wno-implicit-function-declaration" } [[tool.cibuildwheel.overrides]] select = "*-macosx_arm64" -environment = { DISABLE_NUMCODECS_AVX2=1, DISABLE_NUMCODECS_SSE2=1 } +environment = { DISABLE_NUMCODECS_AVX2 = 1, DISABLE_NUMCODECS_SSE2 = 1 } [tool.ruff] line-length = 100 @@ -189,13 +171,13 @@ ignore = [ "FURB101", "FURB103", "PT001", - "PT004", # deprecated - "PT005", # deprecated + "PT004", # deprecated + "PT005", # deprecated "PT011", - "RUF001", + "RUF001", "UP007", - "UP027", # deprecated - "UP038", # https://github.com/astral-sh/ruff/issues/7871 + "UP027", # deprecated + "UP038", # https://github.com/astral-sh/ruff/issues/7871 ] [tool.ruff.format]