From 13b44c80bab6170a9417b0c872e34eddc805a4d2 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:15 -0700 Subject: [PATCH 01/37] Gather system `import`s and separate from external --- setup.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/setup.py b/setup.py index ed2c2383..4e8f27dd 100644 --- a/setup.py +++ b/setup.py @@ -1,11 +1,12 @@ -from glob import glob import os -from setuptools import setup, Extension -import cpuinfo import sys from distutils.command.build_ext import build_ext -from distutils.errors import CCompilerError, DistutilsExecError, \ - DistutilsPlatformError +from distutils.errors import (CCompilerError, DistutilsExecError, + DistutilsPlatformError) +from glob import glob + +from setuptools import setup, Extension +import cpuinfo from Cython.Build import cythonize # determine CPU support for SSE2 and AVX2 From b03845baec778b81431f332d4e2de0370d32f209 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:16 -0700 Subject: [PATCH 02/37] Reorder external `import`s --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4e8f27dd..5b37d321 100644 --- a/setup.py +++ b/setup.py @@ -5,9 +5,9 @@ DistutilsPlatformError) from glob import glob -from setuptools import setup, Extension import cpuinfo from Cython.Build import cythonize +from setuptools import Extension, setup # determine CPU support for SSE2 and AVX2 cpu_info = cpuinfo.get_cpu_info() From 7f41565cb01a12e3f35ad47fb112ae0373ae5c48 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:16 -0700 Subject: [PATCH 03/37] Run `import setuptools` --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 5b37d321..beda7b91 100644 --- a/setup.py +++ b/setup.py @@ -6,6 +6,7 @@ from glob import glob import cpuinfo +import setuptools from Cython.Build import cythonize from setuptools import Extension, setup From aee9b9b7e43962999180ede1c9cf655b78ac5030 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:17 -0700 Subject: [PATCH 04/37] Use `setuptools` instead of `distutils` --- setup.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index beda7b91..a4f0a010 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,13 @@ import os import sys -from distutils.command.build_ext import build_ext -from distutils.errors import (CCompilerError, DistutilsExecError, - DistutilsPlatformError) from glob import glob import cpuinfo import setuptools from Cython.Build import cythonize from setuptools import Extension, setup +from setuptools.command.build_ext import build_ext +from setuptools.errors import CCompilerError, ExecError, PlatformError # determine CPU support for SSE2 and AVX2 cpu_info = cpuinfo.get_cpu_info() @@ -248,10 +247,10 @@ def shuffle_extension(): if sys.platform == 'win32': - ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError, + ext_errors = (CCompilerError, ExecError, PlatformError, IOError, ValueError) else: - ext_errors = (CCompilerError, DistutilsExecError, DistutilsPlatformError) + ext_errors = (CCompilerError, ExecError, PlatformError) class BuildFailed(Exception): @@ -264,7 +263,7 @@ class ve_build_ext(build_ext): def run(self): try: build_ext.run(self) - except DistutilsPlatformError as e: + except PlatformError as e: error(e) raise BuildFailed() From 1833c83003704bf4a89e9230d8b503a8476bf26c Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:17 -0700 Subject: [PATCH 05/37] Drop explicit `cythonize` calls As `setuptools` will handle this for us, go ahead and drop the `cythonize` calls. --- setup.py | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/setup.py b/setup.py index a4f0a010..93a24e87 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,6 @@ import cpuinfo import setuptools -from Cython.Build import cythonize from setuptools import Extension, setup from setuptools.command.build_ext import build_ext from setuptools.errors import CCompilerError, ExecError, PlatformError @@ -111,8 +110,6 @@ def blosc_extension(): ), ] - extensions = cythonize(extensions) - return extensions @@ -147,8 +144,6 @@ def zstd_extension(): ), ] - extensions = cythonize(extensions) - return extensions @@ -176,8 +171,6 @@ def lz4_extension(): ), ] - extensions = cythonize(extensions) - return extensions @@ -203,8 +196,6 @@ def vlen_extension(): ), ] - extensions = cythonize(extensions) - return extensions @@ -222,8 +213,6 @@ def compat_extension(): extra_compile_args=extra_compile_args), ] - extensions = cythonize(extensions) - return extensions @@ -241,8 +230,6 @@ def shuffle_extension(): extra_compile_args=extra_compile_args), ] - extensions = cythonize(extensions) - return extensions From 2abad9f5fb9f3f06ce43be7485e5015d4c091a80 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:18 -0700 Subject: [PATCH 06/37] Use Cython's `build_ext` (if available) --- setup.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 93a24e87..4973a528 100644 --- a/setup.py +++ b/setup.py @@ -5,9 +5,13 @@ import cpuinfo import setuptools from setuptools import Extension, setup -from setuptools.command.build_ext import build_ext from setuptools.errors import CCompilerError, ExecError, PlatformError +try: + from Cython.Distutils.build_ext import new_build_ext as build_ext +except ImportError: + from setuptools.command.build_ext import build_ext + # determine CPU support for SSE2 and AVX2 cpu_info = cpuinfo.get_cpu_info() flags = cpu_info.get('flags', []) From e6f3a6a335760134d343330bc062e7c038b82851 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:18 -0700 Subject: [PATCH 07/37] Drop `setup_requires` Since these build requirements are already in `pyproject.toml` and that is the preferred way forward, drop them from `setup.py`. --- setup.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/setup.py b/setup.py index 4973a528..d5afa81a 100644 --- a/setup.py +++ b/setup.py @@ -294,11 +294,6 @@ def run_setup(with_extensions): 'local_scheme': 'dirty-tag', 'write_to': 'numcodecs/version.py' }, - setup_requires=[ - 'setuptools>18.0', - 'setuptools-scm>1.5.4', - 'Cython', - ], install_requires=[ 'entrypoints', 'numpy>=1.7', From 296b0acede425ede59812272dea1999ca0b66602 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:19 -0700 Subject: [PATCH 08/37] Move setuptool-scm config to `pyproject.toml` --- pyproject.toml | 7 ++++++- setup.py | 5 ----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index caea830e..a7ebaa57 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,12 @@ [build-system] -requires = ["setuptools>=40.8.0", "wheel", "Cython", "py-cpuinfo"] +requires = ["setuptools>=42", "wheel", "Cython", "py-cpuinfo"] build-backend = "setuptools.build_meta:__legacy__" [tool.codespell] skip = "./.git,fixture" ignore-words-list = "ba, compiletime, hist, nd, unparseable" + +[tool.setuptools_scm] +version_scheme = "guess-next-dev" +local_scheme = "dirty-tag" +write_to = "numcodecs/version.py" diff --git a/setup.py b/setup.py index d5afa81a..991f6fe0 100644 --- a/setup.py +++ b/setup.py @@ -289,11 +289,6 @@ def run_setup(with_extensions): name='numcodecs', description=DESCRIPTION, long_description=LONG_DESCRIPTION, - use_scm_version={ - 'version_scheme': 'guess-next-dev', - 'local_scheme': 'dirty-tag', - 'write_to': 'numcodecs/version.py' - }, install_requires=[ 'entrypoints', 'numpy>=1.7', From f4a253716b0ecec9b8aaaf8a32dd745b4053037a Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:19 -0700 Subject: [PATCH 09/37] Move nearly all of `setup.py` to `pyproject.toml` --- pyproject.toml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++- setup.py | 45 --------------------------------------- 2 files changed, 56 insertions(+), 46 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index a7ebaa57..085c78bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,11 +1,66 @@ [build-system] -requires = ["setuptools>=42", "wheel", "Cython", "py-cpuinfo"] +requires = [ + "setuptools>=64", + "setuptools_scm[toml]>=6.2", + "wheel", + "Cython", + "py-cpuinfo" +] build-backend = "setuptools.build_meta:__legacy__" +[project] +name = "numcodecs" +description = """ +A Python package providing buffer compression and transformation codecs for use +in data storage and communication applications. +""" +readme = "README.rst" +dependencies = [ + "entrypoints", + "numpy>=1.7", + "typing-extensions>=3.7.4" +] +requires-python = ">=3.7, <4" +dynamic = [ + "version", +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Information Technology", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python", + "Topic :: Software Development :: Libraries :: Python Modules", + "Operating System :: Unix", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", +] +maintainers = [ + { name = "Alistair Miles", email = "alimanfoo@googlemail.com" }, +] +license = { text = "MIT" } + +[project.urls] +Homepage = "https://github.com/zarr-developers/numcodecs" + +[project.optional-dependencies] +msgpack = ["msgpack"] + [tool.codespell] skip = "./.git,fixture" ignore-words-list = "ba, compiletime, hist, nd, unparseable" +[tool.setuptools] +license-files = ["LICENSE"] +package-dir = {"" = "."} +packages = ["numcodecs", "numcodecs.tests"] +zip-safe = false + [tool.setuptools_scm] version_scheme = "guess-next-dev" local_scheme = "dirty-tag" diff --git a/setup.py b/setup.py index 991f6fe0..0d3fb9a9 100644 --- a/setup.py +++ b/setup.py @@ -266,14 +266,6 @@ def build_extension(self, ext): raise BuildFailed() -DESCRIPTION = ("A Python package providing buffer compression and " - "transformation codecs for use in data storage and " - "communication applications.") - -with open('README.rst') as f: - LONG_DESCRIPTION = f.read() - - def run_setup(with_extensions): if with_extensions: @@ -286,45 +278,8 @@ def run_setup(with_extensions): cmdclass = {} setup( - name='numcodecs', - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - install_requires=[ - 'entrypoints', - 'numpy>=1.7', - 'typing-extensions>=3.7.4', - ], - extras_require={ - 'msgpack': ["msgpack"], - }, ext_modules=ext_modules, cmdclass=cmdclass, - package_dir={"": "."}, - python_requires=">=3.7, <4", - packages=["numcodecs", "numcodecs.tests"], - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "Intended Audience :: Information Technology", - "Intended Audience :: Science/Research", - "License :: OSI Approved :: MIT License", - "Programming Language :: Python", - "Topic :: Software Development :: Libraries :: Python Modules", - "Operating System :: Unix", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - ], - author='Alistair Miles', - author_email='alimanfoo@googlemail.com', - maintainer='Alistair Miles', - maintainer_email='alimanfoo@googlemail.com', - url='https://github.com/zarr-developers/numcodecs', - license='MIT', - zip_safe=False, ) From 725c825f44b1d250fbe9de22a0502445facb3cac Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:20 -0700 Subject: [PATCH 10/37] Add more URLs --- pyproject.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 085c78bf..a839e528 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,6 +46,9 @@ maintainers = [ license = { text = "MIT" } [project.urls] +"Bug Tracker" = "https://github.com/zarr-developers/numcodecs/issues" +Changelog = "https://numcodecs.readthedocs.io/en/stable/release.html" +Documentation = "https://numcodecs.readthedocs.io/" Homepage = "https://github.com/zarr-developers/numcodecs" [project.optional-dependencies] From b735ef32a6c23610a4972eb06cbe0d43325f6ba5 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:21 -0700 Subject: [PATCH 11/37] Add `.txt` extension to license --- LICENSE => LICENSE.txt | 0 pyproject.toml | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename LICENSE => LICENSE.txt (100%) diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/pyproject.toml b/pyproject.toml index a839e528..f61f7095 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -59,7 +59,7 @@ skip = "./.git,fixture" ignore-words-list = "ba, compiletime, hist, nd, unparseable" [tool.setuptools] -license-files = ["LICENSE"] +license-files = ["LICENSE.txt"] package-dir = {"" = "."} packages = ["numcodecs", "numcodecs.tests"] zip-safe = false From 6cf38abd783510683032a1d0481c22fe2055c983 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:40:21 -0700 Subject: [PATCH 12/37] Use latest setuptools build backend --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index f61f7095..6256add2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -6,7 +6,7 @@ requires = [ "Cython", "py-cpuinfo" ] -build-backend = "setuptools.build_meta:__legacy__" +build-backend = "setuptools.build_meta" [project] name = "numcodecs" From 445ca7da328ea7156036f7e120fad785c35e87fc Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:44:30 -0700 Subject: [PATCH 13/37] Drop extra whitespace --- docs/release.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index b9814f96..01347dbc 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -41,7 +41,7 @@ Maintenance * Add tests for all registry classes. By :user:`Josh Moore `, :issue:`349`. - + * Update ReadTheDocs. By :user:`John Kirkham `, :issue:`383`. From 055167c107d16affc1af4e04096c158def842855 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:44:57 -0700 Subject: [PATCH 14/37] Add release note --- docs/release.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/release.rst b/docs/release.rst index 01347dbc..0704cf18 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -42,6 +42,9 @@ Maintenance * Add tests for all registry classes. By :user:`Josh Moore `, :issue:`349`. +* Finish ``pyproject.toml`` migration. + By :user:`John Kirkham ` :issue:`382`. + * Update ReadTheDocs. By :user:`John Kirkham `, :issue:`383`. From 3f216d95764aeb9a6643a25eef5ad5abb22f5876 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 01:46:03 -0700 Subject: [PATCH 15/37] Fix lint --- setup.py | 1 - 1 file changed, 1 deletion(-) diff --git a/setup.py b/setup.py index 0d3fb9a9..3a0584d4 100644 --- a/setup.py +++ b/setup.py @@ -3,7 +3,6 @@ from glob import glob import cpuinfo -import setuptools from setuptools import Extension, setup from setuptools.errors import CCompilerError, ExecError, PlatformError From 798cd684c355e73ff03f028d1b25a5274aa2bf0a Mon Sep 17 00:00:00 2001 From: jakirkham Date: Thu, 3 Nov 2022 11:06:40 -0700 Subject: [PATCH 16/37] Move `pytest` config options to `pyproject.toml` --- pyproject.toml | 7 +++++++ pytest.ini | 2 -- 2 files changed, 7 insertions(+), 2 deletions(-) delete mode 100644 pytest.ini diff --git a/pyproject.toml b/pyproject.toml index 6256add2..e3aac2b4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,13 @@ msgpack = ["msgpack"] skip = "./.git,fixture" ignore-words-list = "ba, compiletime, hist, nd, unparseable" +[tool.pytest.ini_options] +doctest_optionflags = [ + "NORMALIZE_WHITESPACE", + "ELLIPSIS", + "IGNORE_EXCEPTION_DETAIL", +] + [tool.setuptools] license-files = ["LICENSE.txt"] package-dir = {"" = "."} diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 10f311e9..00000000 --- a/pytest.ini +++ /dev/null @@ -1,2 +0,0 @@ -[pytest] -doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL From 2e48becf2ea1b4cbc12307d658f1c6ceba2d93f3 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 01:12:40 -0700 Subject: [PATCH 17/37] Move `.coveragerc` into `pyproject.toml` --- .coveragerc | 5 ----- pyproject.toml | 6 ++++++ 2 files changed, 6 insertions(+), 5 deletions(-) delete mode 100644 .coveragerc diff --git a/.coveragerc b/.coveragerc deleted file mode 100644 index 9acf355c..00000000 --- a/.coveragerc +++ /dev/null @@ -1,5 +0,0 @@ - -[report] -exclude_lines = - pragma: no cover - pragma: ${PY_MAJOR_VERSION} no cover diff --git a/pyproject.toml b/pyproject.toml index e3aac2b4..bbab874a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,6 +58,12 @@ msgpack = ["msgpack"] 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", +] + [tool.pytest.ini_options] doctest_optionflags = [ "NORMALIZE_WHITESPACE", From 45fc1b358eccc576f70ba567be864becba1100e5 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 08:51:18 -0700 Subject: [PATCH 18/37] Standardize on `setuptools-scm` with `-` --- pyproject.toml | 2 +- requirements_rtfd.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f8bde453..f6ef445f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [build-system] requires = [ "setuptools>=64", - "setuptools_scm[toml]>=6.2", + "setuptools-scm[toml]>=6.2", "Cython", "py-cpuinfo" ] diff --git a/requirements_rtfd.txt b/requirements_rtfd.txt index ad07c472..f57484b6 100644 --- a/requirements_rtfd.txt +++ b/requirements_rtfd.txt @@ -1,5 +1,5 @@ setuptools -setuptools_scm +setuptools-scm sphinx sphinx-issues numpydoc From 1c57a806b54e0272ccbe0ad58205672110dead8f Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 11:42:03 -0700 Subject: [PATCH 19/37] Add `setuptools` & `setuptools-scm` to dev reqs --- requirements_dev.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/requirements_dev.txt b/requirements_dev.txt index 9656a1f1..c0de46ad 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -2,6 +2,8 @@ Cython==0.29.30 entrypoints==0.4 msgpack==1.0.2 numpy==1.22.0 +setuptools>=64 +setuptools-scm[toml]>=6.2 zfpy==0.5.5 ; python_version < "3.11" typing-extensions>=3.7.4 py-cpuinfo==9.0.0 From 05d40f6ddc94b51a9aaedfc8bff942872ae19657 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 13:39:53 -0700 Subject: [PATCH 20/37] Consolidate requirements --- .github/workflows/ci-linux.yaml | 4 +--- .github/workflows/ci-osx.yaml | 4 +--- .github/workflows/ci-windows.yaml | 4 +--- .pyup.yml | 9 --------- .readthedocs.yaml | 3 ++- pyproject.toml | 16 ++++++++++++++++ requirements.txt | 7 ------- requirements_rtfd.txt | 12 ------------ requirements_test.txt | 7 ------- 9 files changed, 21 insertions(+), 45 deletions(-) delete mode 100644 requirements.txt delete mode 100644 requirements_rtfd.txt delete mode 100644 requirements_test.txt diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml index c9d0402a..f02e3ba5 100644 --- a/.github/workflows/ci-linux.yaml +++ b/.github/workflows/ci-linux.yaml @@ -24,8 +24,7 @@ jobs: - name: Install numcodecs run: | - python -m pip install -U pip -r requirements_test.txt -r requirements.txt - python -m pip install -v -e . + python -m pip install -v -e .[docs,test,msgpack,zfpy] - name: List installed packages run: python -m pip list @@ -38,6 +37,5 @@ jobs: - name: Build Docs run: | - pip install -r requirements_rtfd.txt cd docs sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html diff --git a/.github/workflows/ci-osx.yaml b/.github/workflows/ci-osx.yaml index 684736ac..743d0a74 100644 --- a/.github/workflows/ci-osx.yaml +++ b/.github/workflows/ci-osx.yaml @@ -37,7 +37,6 @@ jobs: conda create -n env python=${{matrix.python-version}} wheel pip compilers 'clang>=12.0.1' conda activate env which pip - pip install -r requirements_test.txt -r requirements.txt conda env export - name: Show info about `env` environment @@ -50,8 +49,7 @@ jobs: run: | conda activate env export CC=clang - python -m pip install -U pip -r requirements_test.txt -r requirements.txt - python -m pip install -v -e . + python -m pip install -v -e .[test,msgpack,zfpy] - name: Run tests shell: "bash -l {0}" diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml index aa675079..6dffa239 100644 --- a/.github/workflows/ci-windows.yaml +++ b/.github/workflows/ci-windows.yaml @@ -30,7 +30,6 @@ jobs: conda create -n env python=${{matrix.python-version}} wheel pip compilers conda activate env which pip - pip install -r requirements_test.txt -r requirements.txt conda env export - name: Install numcodecs @@ -38,8 +37,7 @@ jobs: run: | conda activate env export CC=clang - python -m pip install -U pip -r requirements_test.txt -r requirements.txt - python -m pip install -v -e . + python -m pip install -v -e .[test,msgpack,zfpy] - name: Run tests shell: "bash -l {0}" diff --git a/.pyup.yml b/.pyup.yml index 625e82c0..d7f1817b 100644 --- a/.pyup.yml +++ b/.pyup.yml @@ -4,15 +4,6 @@ schedule: every month requirements: - - requirements.txt: - pin: False - update: False - - requirements_test.txt: - pin: False - update: False - - requirements_rtfd.txt: - pin: False - update: False - requirements_dev.txt: pin: True update: all diff --git a/.readthedocs.yaml b/.readthedocs.yaml index b700223a..984ffc46 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -13,6 +13,7 @@ sphinx: python: install: - - requirements: requirements_rtfd.txt - method: pip path: . + extra_requirements: + - docs diff --git a/pyproject.toml b/pyproject.toml index f6ef445f..4c08005d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,6 +52,22 @@ Homepage = "https://github.com/zarr-developers/numcodecs" [project.optional-dependencies] msgpack = ["msgpack"] +docs = [ + "sphinx", + "sphinx-issues", + "numpydoc", + "mock", +] +test = [ + "coverage", + "coveralls", + "flake8", + "pytest", + "pytest-cov", +] +zfpy = [ + "zfpy>=1.0.0", +] [tool.codespell] skip = "./.git,fixture" diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index eb34a7f8..00000000 --- a/requirements.txt +++ /dev/null @@ -1,7 +0,0 @@ -cython -entrypoints -numpy -msgpack -pytest -zfpy -typing-extensions diff --git a/requirements_rtfd.txt b/requirements_rtfd.txt deleted file mode 100644 index 40cfb97e..00000000 --- a/requirements_rtfd.txt +++ /dev/null @@ -1,12 +0,0 @@ -setuptools -setuptools-scm -sphinx -sphinx-issues -numpydoc -mock -numpy -cython -entrypoints -zfpy==1.0.0 -typing-extensions -py-cpuinfo==9.0.0 diff --git a/requirements_test.txt b/requirements_test.txt deleted file mode 100644 index 9345f17c..00000000 --- a/requirements_test.txt +++ /dev/null @@ -1,7 +0,0 @@ -coverage -coveralls -flake8 -pytest -pytest-cov -setuptools -setuptools-scm From 72e9727b6739b8706a710c36d073817642b74b3e Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 13:47:30 -0700 Subject: [PATCH 21/37] Move `setuptools` after `project` items --- pyproject.toml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 4c08005d..5cc394d6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -69,6 +69,17 @@ zfpy = [ "zfpy>=1.0.0", ] +[tool.setuptools] +license-files = ["LICENSE.txt"] +package-dir = {"" = "."} +packages = ["numcodecs", "numcodecs.tests"] +zip-safe = false + +[tool.setuptools_scm] +version_scheme = "guess-next-dev" +local_scheme = "dirty-tag" +write_to = "numcodecs/version.py" + [tool.codespell] skip = "./.git,fixture" ignore-words-list = "ba, compiletime, hist, nd, unparseable" @@ -85,14 +96,3 @@ doctest_optionflags = [ "ELLIPSIS", "IGNORE_EXCEPTION_DETAIL", ] - -[tool.setuptools] -license-files = ["LICENSE.txt"] -package-dir = {"" = "."} -packages = ["numcodecs", "numcodecs.tests"] -zip-safe = false - -[tool.setuptools_scm] -version_scheme = "guess-next-dev" -local_scheme = "dirty-tag" -write_to = "numcodecs/version.py" From e292f026295a415ab7cf733c9330df8c30f6f5dd Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 13:48:29 -0700 Subject: [PATCH 22/37] Simplify classifiers --- pyproject.toml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5cc394d6..6b963358 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -33,11 +33,7 @@ classifiers = [ "Topic :: Software Development :: Libraries :: Python Modules", "Operating System :: Unix", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", ] maintainers = [ { name = "Alistair Miles", email = "alimanfoo@googlemail.com" }, From a4daba2254e0758789727b22fdf8a9b38983f551 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 15:25:23 -0700 Subject: [PATCH 23/37] Drop doc build as it already happens on RTD This preceeded docs builds on RTD for PRs. Now that RTD does PR builds for docs, this is redundant. So drop it. --- .github/workflows/ci-linux.yaml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml index cdad8992..199315a8 100644 --- a/.github/workflows/ci-linux.yaml +++ b/.github/workflows/ci-linux.yaml @@ -24,7 +24,7 @@ jobs: - name: Install numcodecs run: | - python -m pip install -v -e .[docs,test,msgpack,zfpy] + python -m pip install -v -e .[test,msgpack,zfpy] - name: List installed packages run: python -m pip list @@ -35,11 +35,6 @@ jobs: - name: Flake8 run: flake8 numcodecs - - name: Build Docs - run: | - cd docs - sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html - - uses: codecov/codecov-action@v3 with: #token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos From b4bd856c094dd4bea5454aa8c96331b12654f426 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 15:49:55 -0700 Subject: [PATCH 24/37] Move `msgpack` later and unwrap --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 6b963358..2772b33f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,6 @@ Documentation = "https://numcodecs.readthedocs.io/" Homepage = "https://github.com/zarr-developers/numcodecs" [project.optional-dependencies] -msgpack = ["msgpack"] docs = [ "sphinx", "sphinx-issues", @@ -61,6 +60,9 @@ test = [ "pytest", "pytest-cov", ] +msgpack = [ + "msgpack", +] zfpy = [ "zfpy>=1.0.0", ] From 541055cc6d9aa7618351d1f3b262a01f5d4dfa86 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 15:57:12 -0700 Subject: [PATCH 25/37] Run `flake8` before tests --- .github/workflows/ci-linux.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml index 199315a8..6f92eae8 100644 --- a/.github/workflows/ci-linux.yaml +++ b/.github/workflows/ci-linux.yaml @@ -29,12 +29,12 @@ jobs: - name: List installed packages run: python -m pip list - - name: Run tests - run: pytest -v --cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx numcodecs - - name: Flake8 run: flake8 numcodecs + - name: Run tests + run: pytest -v --cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx numcodecs + - uses: codecov/codecov-action@v3 with: #token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos From d92014b94e3b038ff3b4e3d4eae36f7883bda39f Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 16:10:02 -0700 Subject: [PATCH 26/37] Bake coverage & doctest flags into pytest config --- .github/workflows/ci-linux.yaml | 2 +- .github/workflows/ci-osx.yaml | 2 +- .github/workflows/ci-windows.yaml | 2 +- docs/contributing.rst | 8 ++------ pyproject.toml | 1 + 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml index 6f92eae8..f2ce9cba 100644 --- a/.github/workflows/ci-linux.yaml +++ b/.github/workflows/ci-linux.yaml @@ -33,7 +33,7 @@ jobs: run: flake8 numcodecs - name: Run tests - run: pytest -v --cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx numcodecs + run: pytest -v --cov-report xml numcodecs - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/ci-osx.yaml b/.github/workflows/ci-osx.yaml index 86412897..11f0da48 100644 --- a/.github/workflows/ci-osx.yaml +++ b/.github/workflows/ci-osx.yaml @@ -55,7 +55,7 @@ jobs: shell: "bash -l {0}" run: | conda activate env - pytest -v --cov=numcodecs --cov-report xml numcodecs + pytest -v --cov-report xml numcodecs - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml index 9b409cbe..c04e55c3 100644 --- a/.github/workflows/ci-windows.yaml +++ b/.github/workflows/ci-windows.yaml @@ -43,7 +43,7 @@ jobs: shell: "bash -l {0}" run: | conda activate env - pytest -v --cov=numcodecs --cov-report xml numcodecs + pytest -v --cov-report xml numcodecs - uses: codecov/codecov-action@v3 with: diff --git a/docs/contributing.rst b/docs/contributing.rst index f7c45c8c..2e81a88c 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -149,10 +149,6 @@ docstrings. The simplest way to run the unit tests is to invoke:: $ pytest -v numcodecs -To also run the doctests within docstrings, run:: - - $ pytest -v --doctest-modules numcodecs - NumCodecs currently supports Python 6-3.9, so the above command must succeed before code can be accepted into the main code base. @@ -167,14 +163,14 @@ All code must conform to the PEP8 standard. Regarding line length, lines up to 1 characters are allowed, although please try to keep under 90 wherever possible. Conformance can be checked by running:: - $ flake8 --max-line-length=100 numcodecs + $ flake8 numcodecs Test coverage ~~~~~~~~~~~~~ NumCodecs maintains 100% test coverage under the latest Python stable release (currently Python 3.9). Both unit tests and docstring doctests are included when computing -coverage. Running ``pytest -v --cov=numcodecs`` will automatically run the test suite with coverage +coverage. Running ``pytest -v numcodecs`` will automatically run the test suite with coverage and produce a coverage report. This should be 100% before code can be accepted into the main code base. diff --git a/pyproject.toml b/pyproject.toml index 2772b33f..81d0dd43 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -89,6 +89,7 @@ exclude_lines = [ ] [tool.pytest.ini_options] +addopts = "--cov=numcodecs --doctest-modules --doctest-glob=*.pyx" doctest_optionflags = [ "NORMALIZE_WHITESPACE", "ELLIPSIS", From e8393c630fcd1537e2655fabf11bd25aac24eb4b Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 16:25:07 -0700 Subject: [PATCH 27/37] Drop `coveralls` from dependencies --- pyproject.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 81d0dd43..def6996c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -55,7 +55,6 @@ docs = [ ] test = [ "coverage", - "coveralls", "flake8", "pytest", "pytest-cov", From 1d4500e9956cf42770e3e79b42fe1e0e55988fff Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 16:25:23 -0700 Subject: [PATCH 28/37] Fix Codecov release note reference --- docs/release.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/release.rst b/docs/release.rst index 20fc646d..53cddfd3 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -62,7 +62,7 @@ Maintenance By :user:`John Kirkham `, :issue:`383`. * Collect coverage on all OSes & enable Codecov. - By :user:`John Kirkham `, :issue:`386`, :issue:`388`. + By :user:`John Kirkham `, :issue:`386`, :issue:`388`, :issue:`390`. .. _release_0.10.2: From 9888271237f5564743a241295b3b8340082cfcef Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 18:21:20 -0700 Subject: [PATCH 29/37] Use `int16` in doctests for consistent reprs Windows defaults to `int32` so won't display those `dtype`s. Whereas UNIX defaults to `int64` and so won't display those `dtype`s. This creates mismatches between the representations in docstrings between the two platforms. For simplicity just use `int16`, which both platforms will represent the same. This should ensure consistency with doctests. --- numcodecs/astype.py | 4 ++-- numcodecs/delta.py | 6 +++--- numcodecs/vlen.pyx | 11 +++++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/numcodecs/astype.py b/numcodecs/astype.py index 0c4280e1..2d040df7 100644 --- a/numcodecs/astype.py +++ b/numcodecs/astype.py @@ -28,10 +28,10 @@ class AsType(Codec): >>> x = np.arange(100, 120, 2, dtype=np.int8) >>> x array([100, 102, 104, 106, 108, 110, 112, 114, 116, 118], dtype=int8) - >>> f = numcodecs.AsType(encode_dtype=x.dtype, decode_dtype=np.int64) + >>> f = numcodecs.AsType(encode_dtype=x.dtype, decode_dtype=np.int16) >>> y = f.decode(x) >>> y - array([100, 102, 104, 106, 108, 110, 112, 114, 116, 118]) + array([100, 102, 104, 106, 108, 110, 112, 114, 116, 118], dtype=int16) >>> z = f.encode(y) >>> z array([100, 102, 104, 106, 108, 110, 112, 114, 116, 118], dtype=int8) diff --git a/numcodecs/delta.py b/numcodecs/delta.py index b7bead5e..f43b9b50 100644 --- a/numcodecs/delta.py +++ b/numcodecs/delta.py @@ -28,14 +28,14 @@ class Delta(Codec): -------- >>> import numcodecs >>> import numpy as np - >>> x = np.arange(100, 120, 2, dtype='i8') - >>> codec = numcodecs.Delta(dtype='i8', astype='i1') + >>> x = np.arange(100, 120, 2, dtype='i2') + >>> codec = numcodecs.Delta(dtype='i2', astype='i1') >>> y = codec.encode(x) >>> y array([100, 2, 2, 2, 2, 2, 2, 2, 2, 2], dtype=int8) >>> z = codec.decode(y) >>> z - array([100, 102, 104, 106, 108, 110, 112, 114, 116, 118]) + array([100, 102, 104, 106, 108, 110, 112, 114, 116, 118], dtype=int16) """ diff --git a/numcodecs/vlen.pyx b/numcodecs/vlen.pyx index 7ca04737..4495a3c0 100644 --- a/numcodecs/vlen.pyx +++ b/numcodecs/vlen.pyx @@ -310,11 +310,14 @@ class VLenArray(Codec): -------- >>> import numcodecs >>> import numpy as np - >>> x = np.array([[1, 3, 5], [4], [7, 9]], dtype='object') - >>> codec = numcodecs.VLenArray('>> x1 = np.array([1, 3, 5], dtype=np.int16) + >>> x2 = np.array([4], dtype=np.int16) + >>> x3 = np.array([7, 9], dtype=np.int16) + >>> x = np.array([x1, x2, x3], dtype='object') + >>> codec = numcodecs.VLenArray('>> codec.decode(codec.encode(x)) - array([array([1, 3, 5], dtype=int32), array([4], dtype=int32), - array([7, 9], dtype=int32)], dtype=object) + array([array([1, 3, 5], dtype=int16), array([4], dtype=int16), + array([7, 9], dtype=int16)], dtype=object) See Also -------- From 01072a8303e807c227c6678a18e2f29fa9f4c366 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 18:30:22 -0700 Subject: [PATCH 30/37] Add coverage report output type to config too --- .github/workflows/ci-linux.yaml | 2 +- .github/workflows/ci-osx.yaml | 2 +- .github/workflows/ci-windows.yaml | 2 +- pyproject.toml | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml index f2ce9cba..263ba985 100644 --- a/.github/workflows/ci-linux.yaml +++ b/.github/workflows/ci-linux.yaml @@ -33,7 +33,7 @@ jobs: run: flake8 numcodecs - name: Run tests - run: pytest -v --cov-report xml numcodecs + run: pytest -v numcodecs - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/ci-osx.yaml b/.github/workflows/ci-osx.yaml index 11f0da48..5e5e7081 100644 --- a/.github/workflows/ci-osx.yaml +++ b/.github/workflows/ci-osx.yaml @@ -55,7 +55,7 @@ jobs: shell: "bash -l {0}" run: | conda activate env - pytest -v --cov-report xml numcodecs + pytest -v numcodecs - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml index c04e55c3..ed8915c1 100644 --- a/.github/workflows/ci-windows.yaml +++ b/.github/workflows/ci-windows.yaml @@ -43,7 +43,7 @@ jobs: shell: "bash -l {0}" run: | conda activate env - pytest -v --cov-report xml numcodecs + pytest -v numcodecs - uses: codecov/codecov-action@v3 with: diff --git a/pyproject.toml b/pyproject.toml index def6996c..4516492b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -88,7 +88,7 @@ exclude_lines = [ ] [tool.pytest.ini_options] -addopts = "--cov=numcodecs --doctest-modules --doctest-glob=*.pyx" +addopts = "--cov=numcodecs --cov-report xml --doctest-modules --doctest-glob=*.pyx" doctest_optionflags = [ "NORMALIZE_WHITESPACE", "ELLIPSIS", From dcd3c6e3d1a2ab90aa29920bbc48ced12b165d92 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 18:56:15 -0700 Subject: [PATCH 31/37] Push `numcodecs` test path into config --- .github/workflows/ci-linux.yaml | 2 +- .github/workflows/ci-osx.yaml | 2 +- .github/workflows/ci-windows.yaml | 2 +- docs/contributing.rst | 6 +++--- pyproject.toml | 3 +++ 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml index 263ba985..17caa1b7 100644 --- a/.github/workflows/ci-linux.yaml +++ b/.github/workflows/ci-linux.yaml @@ -33,7 +33,7 @@ jobs: run: flake8 numcodecs - name: Run tests - run: pytest -v numcodecs + run: pytest -v - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/ci-osx.yaml b/.github/workflows/ci-osx.yaml index 5e5e7081..1cd2e81f 100644 --- a/.github/workflows/ci-osx.yaml +++ b/.github/workflows/ci-osx.yaml @@ -55,7 +55,7 @@ jobs: shell: "bash -l {0}" run: | conda activate env - pytest -v numcodecs + pytest -v - uses: codecov/codecov-action@v3 with: diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml index ed8915c1..115f72d8 100644 --- a/.github/workflows/ci-windows.yaml +++ b/.github/workflows/ci-windows.yaml @@ -43,7 +43,7 @@ jobs: shell: "bash -l {0}" run: | conda activate env - pytest -v numcodecs + pytest -v - uses: codecov/codecov-action@v3 with: diff --git a/docs/contributing.rst b/docs/contributing.rst index c4fbb06e..1a8985fd 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -104,7 +104,7 @@ the repository, you can do something like the following:: To verify that your development environment is working, you can run the unit tests:: - $ pytest -v numcodecs + $ pytest -v To install numcodecs globally in editable mode run:: @@ -147,7 +147,7 @@ Running the test suite NumCodecs includes a suite of unit tests, as well as doctests included in function and class docstrings. The simplest way to run the unit tests is to invoke:: - $ pytest -v numcodecs + $ pytest -v NumCodecs currently supports Python 6-3.9, so the above command must succeed before code can be accepted into the main code base. @@ -170,7 +170,7 @@ Test coverage NumCodecs maintains 100% test coverage under the latest Python stable release (currently Python 3.9). Both unit tests and docstring doctests are included when computing -coverage. Running ``pytest -v numcodecs`` will automatically run the test suite with coverage +coverage. Running ``pytest -v`` will automatically run the test suite with coverage and produce a coverage report. This should be 100% before code can be accepted into the main code base. diff --git a/pyproject.toml b/pyproject.toml index 4516492b..0427e54a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -94,3 +94,6 @@ doctest_optionflags = [ "ELLIPSIS", "IGNORE_EXCEPTION_DETAIL", ] +testpaths = [ + "numcodecs", +] From 0ced8125f7fb99d0b443927e89b1f05e3065fe24 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 19:05:20 -0700 Subject: [PATCH 32/37] Exclude directories outside of numcodecs --- .flake8 | 12 ++++++++++++ pyproject.toml | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/.flake8 b/.flake8 index 7da1f960..e6b17013 100644 --- a/.flake8 +++ b/.flake8 @@ -1,2 +1,14 @@ [flake8] max-line-length = 100 +exclude = + .git, + .github, + .pytest_cache, + adhoc, + build, + c-blosc, + dist, + docs, + fixture, + notebooks, + numcodecs.egg-info, diff --git a/pyproject.toml b/pyproject.toml index 0427e54a..29f1703f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,3 +97,15 @@ doctest_optionflags = [ testpaths = [ "numcodecs", ] +norecursedirs = [ + ".git", + ".github", + ".pytest_cache", + "adhoc", + "build", + "c-blosc", + "docs", + "fixture", + "notebooks", + "numcodecs.egg-info", +] From 9e550c7703b44ab2a8ee70a6702395aa57c66596 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 19:07:15 -0700 Subject: [PATCH 33/37] Simplify `flake8` instructions --- .github/workflows/ci-linux.yaml | 2 +- docs/contributing.rst | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml index 17caa1b7..4bde7e8f 100644 --- a/.github/workflows/ci-linux.yaml +++ b/.github/workflows/ci-linux.yaml @@ -30,7 +30,7 @@ jobs: run: python -m pip list - name: Flake8 - run: flake8 numcodecs + run: flake8 - name: Run tests run: pytest -v diff --git a/docs/contributing.rst b/docs/contributing.rst index 1a8985fd..5fb13072 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -163,7 +163,7 @@ All code must conform to the PEP8 standard. Regarding line length, lines up to 1 characters are allowed, although please try to keep under 90 wherever possible. Conformance can be checked by running:: - $ flake8 numcodecs + $ flake8 Test coverage ~~~~~~~~~~~~~ From 4175325cf31492d08e87aa510c729c46d4573b00 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 19:13:58 -0700 Subject: [PATCH 34/37] Delete unused `build.cmd` This was used to configure compilers on Windows in the past. Particularly it was used to configure Python 2.7 Windows builds. However as of Python 3.5 and UCRT on Windows, this is unnecessary. Further Python 2.7 was improved by a one off Windows Python compiler installer. In any event this can safely be dropped. It is not used in this repo and shouldn't be needed outside of it. --- build.cmd | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 build.cmd diff --git a/build.cmd b/build.cmd deleted file mode 100644 index ef92badb..00000000 --- a/build.cmd +++ /dev/null @@ -1,47 +0,0 @@ -:: To build extensions for 64 bit Python 3, we need to configure environment -:: variables to use the MSVC 2010 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 4 (SDK v7.1) -:: -:: To build extensions for 64 bit Python 2, we need to configure environment -:: variables to use the MSVC 2008 C++ compilers from GRMSDKX_EN_DVD.iso of: -:: MS Windows SDK for Windows 7 and .NET Framework 3.5 (SDK v7.0) -:: -:: 32 bit builds do not require specific environment configurations. -:: -:: Note: this script needs to be run with the /E:ON and /V:ON flags for the -:: cmd interpreter, at least for (SDK v7.0) -:: -:: More details at: -:: https://github.com/cython/cython/wiki/64BitCythonExtensionsOnWindows -:: http://stackoverflow.com/a/13751649/163740 -:: -:: Author: Olivier Grisel -:: License: CC0 1.0 Universal: http://creativecommons.org/publicdomain/zero/1.0/ -@ECHO OFF - -SET COMMAND_TO_RUN=%* -SET WIN_SDK_ROOT=C:\Program Files\Microsoft SDKs\Windows - -SET MAJOR_PYTHON_VERSION="%PYTHON_VERSION:~0,1%" -IF %MAJOR_PYTHON_VERSION% == "2" ( - SET WINDOWS_SDK_VERSION="v7.0" -) ELSE IF %MAJOR_PYTHON_VERSION% == "3" ( - SET WINDOWS_SDK_VERSION="v7.1" -) ELSE ( - ECHO Unsupported Python version: "%MAJOR_PYTHON_VERSION%" - EXIT 1 -) - -IF "%DISTUTILS_USE_SDK%"=="1" ( - ECHO Configuring Windows SDK %WINDOWS_SDK_VERSION% for Python %MAJOR_PYTHON_VERSION% on a 64 bit architecture - SET DISTUTILS_USE_SDK=1 - SET MSSdk=1 - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Setup\WindowsSdkVer.exe" -q -version:%WINDOWS_SDK_VERSION% - "%WIN_SDK_ROOT%\%WINDOWS_SDK_VERSION%\Bin\SetEnv.cmd" /x64 /release - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) ELSE ( - ECHO Using default MSVC build environment - ECHO Executing: %COMMAND_TO_RUN% - call %COMMAND_TO_RUN% || EXIT 1 -) From 7f9fa083850211131d4343c37350e8ef89bab877 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 19:28:18 -0700 Subject: [PATCH 35/37] Drop upper bound on Python --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 29f1703f..b7c5a621 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ dependencies = [ "numpy>=1.7", "typing-extensions>=3.7.4" ] -requires-python = ">=3.7, <4" +requires-python = ">=3.7" dynamic = [ "version", ] From c832d88124a4dabff557ce15d014f2448ee98de9 Mon Sep 17 00:00:00 2001 From: jakirkham Date: Fri, 4 Nov 2022 19:58:27 -0700 Subject: [PATCH 36/37] Drop `requirements_dev.txt` too --- .pyup.yml | 5 ----- docs/contributing.rst | 7 +------ requirements_dev.txt | 9 --------- 3 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 requirements_dev.txt diff --git a/.pyup.yml b/.pyup.yml index d7f1817b..30182e6b 100644 --- a/.pyup.yml +++ b/.pyup.yml @@ -2,8 +2,3 @@ # see https://pyup.io/docs/configuration/ for all available options schedule: every month - -requirements: - - requirements_dev.txt: - pin: True - update: all diff --git a/docs/contributing.rst b/docs/contributing.rst index 5fb13072..4d79b477 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -99,17 +99,12 @@ the repository, you can do something like the following:: $ mkdir -p ~/pyenv/numcodecs-dev $ virtualenv --no-site-packages --python=/usr/bin/python3.9 ~/pyenv/numcodecs-dev $ source ~/pyenv/numcodecs-dev/bin/activate - $ pip install -r requirements_dev.txt - $ python setup.py build_ext --inplace + $ pip install -e .[docs,test,msgpack,zfpy] To verify that your development environment is working, you can run the unit tests:: $ pytest -v -To install numcodecs globally in editable mode run:: - - $ python -m pip install -e . - Creating a branch ~~~~~~~~~~~~~~~~~ diff --git a/requirements_dev.txt b/requirements_dev.txt deleted file mode 100644 index 866dd6ef..00000000 --- a/requirements_dev.txt +++ /dev/null @@ -1,9 +0,0 @@ -Cython==0.29.30 -entrypoints==0.4 -msgpack==1.0.2 -numpy==1.22.0 -setuptools>=64 -setuptools-scm[toml]>=6.2 -zfpy==1.0.0 -typing-extensions>=3.7.4 -py-cpuinfo==9.0.0 From e679fb2c85e533e9e0e9581be8ef277f0fe432ad Mon Sep 17 00:00:00 2001 From: jakirkham Date: Tue, 8 Nov 2022 00:43:29 -0800 Subject: [PATCH 37/37] Always use Cython's `new_build_ext` This should always be available as `cython` is a build requirement. So simplify to just use Cython and skip `setuptools` here. --- setup.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/setup.py b/setup.py index 3a0584d4..cf950f40 100644 --- a/setup.py +++ b/setup.py @@ -3,14 +3,10 @@ from glob import glob import cpuinfo +from Cython.Distutils.build_ext import new_build_ext as build_ext from setuptools import Extension, setup from setuptools.errors import CCompilerError, ExecError, PlatformError -try: - from Cython.Distutils.build_ext import new_build_ext as build_ext -except ImportError: - from setuptools.command.build_ext import build_ext - # determine CPU support for SSE2 and AVX2 cpu_info = cpuinfo.get_cpu_info() flags = cpu_info.get('flags', [])