diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 93a3ffdc..9e04e8b8 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,11 @@ [Description of PR] TODO: -* [ ] Unit tests and/or doctests in docstrings -* [ ] ``tox -e py38`` passes locally -* [ ] Docstrings and API docs for any new/modified user-facing classes and functions -* [ ] Changes documented in docs/release.rst -* [ ] ``tox -e docs`` passes locally -* [ ] AppVeyor and Travis CI passes -* [ ] Test coverage to 100% (Coveralls passes) + +- [ ] Unit tests and/or doctests in docstrings +- [ ] `tox -e py39` passes locally +- [ ] Docstrings and API docs for any new/modified user-facing classes and functions +- [ ] Changes documented in docs/release.rst +- [ ] `tox -e docs` passes locally +- [ ] GitHub Actions CI passes +- [ ] Test coverage to 100% (Coveralls passes) diff --git a/.github/workflows/ci-linux.yaml b/.github/workflows/ci-linux.yaml new file mode 100644 index 00000000..85792d16 --- /dev/null +++ b/.github/workflows/ci-linux.yaml @@ -0,0 +1,43 @@ +name: Linux CI + +on: [push, pull_request] + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9"] + os: [ubuntu-18.04, ubuntu-20.04] + + steps: + - name: Checkout source + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Set up Python + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install numcodecs + run: | + python -m pip install -U pip -r requirements_test.txt -r requirements.txt + python -m pip install -v -e . + + - name: List installed packages + run: python -m pip list + + - name: Run tests + run: pytest -v --cov=numcodecs --doctest-modules --doctest-glob=*.pyx numcodecs + + - name: Flake8 + run: flake8 numcodecs + + - 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 38e1fcec..2e832641 100644 --- a/.github/workflows/ci-osx.yaml +++ b/.github/workflows/ci-osx.yaml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.6", "3.7", "3.8"] + python-version: ["3.6", "3.7", "3.8", "3.9"] steps: - name: Checkout source @@ -23,13 +23,16 @@ jobs: python-version: ${{ matrix.python-version }} env: ACTIONS_ALLOW_UNSECURE_COMMANDS: true - - name: Install numcodecs + + - name: Set up env shell: "bash -l {0}" run: | - conda create -n env python==${{matrix.python-version}} wheel cython numpy msgpack-python pytest wheel pip compilers + 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 shell: "bash -l {0}" run: | diff --git a/.github/workflows/ci-windows.yaml b/.github/workflows/ci-windows.yaml new file mode 100644 index 00000000..31ed08cd --- /dev/null +++ b/.github/workflows/ci-windows.yaml @@ -0,0 +1,47 @@ +name: Windows CI + +on: [push, pull_request] + +jobs: + build: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + python-version: ["3.6", "3.7", "3.8", "3.9"] + + steps: + - name: Checkout source + uses: actions/checkout@v2 + with: + submodules: recursive + + - name: Set up Python + uses: conda-incubator/setup-miniconda@master + with: + channels: conda-forge + python-version: ${{ matrix.python-version }} + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + + - name: Set up env + shell: "bash -l {0}" + run: | + 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 + shell: "bash -l {0}" + run: | + conda activate env + export CC=clang + python setup.py build + + - name: Run tests + shell: "bash -l {0}" + run: | + conda activate env + pytest -v --pyargs numcodecs diff --git a/.github/workflows/wheel.yaml b/.github/workflows/wheel.yaml index 78b65aa9..4ef4672f 100644 --- a/.github/workflows/wheel.yaml +++ b/.github/workflows/wheel.yaml @@ -9,7 +9,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04, windows-latest, macos-latest] + os: [ubuntu-latest, windows-latest, macos-latest] env: CIBW_TEST_COMMAND: pytest --pyargs numcodecs CIBW_TEST_REQUIRES: pytest @@ -25,11 +25,11 @@ jobs: - uses: actions/setup-python@v1 name: Install Python with: - python-version: '3.7' + python-version: '3.9' - name: Install cibuildwheel run: | - python -m pip install cibuildwheel==1.3.0 wheel + python -m pip install cibuildwheel==1.8.0 wheel - name: Build wheel run: | @@ -50,7 +50,7 @@ jobs: - uses: actions/setup-python@v2 name: Install Python with: - python-version: '3.7' + python-version: '3.9' - name: Build sdist run: python setup.py sdist diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 80d9359a..00000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ - -branches: - only: - - master - -sudo: false - -addons: - apt: - packages: - - liblzma-dev - -matrix: - include: - - os: linux - language: python - python: 3.5 - - os: linux - language: python - python: 3.6 - - os: linux - language: python - python: 3.7 - dist: xenial - - os: linux - language: python - python: 3.8 - dist: xenial - sudo: true - -install: - - pip install -U tox-travis coveralls pip setuptools wheel pytest - - pip install -v -e . - -script: - - tox - -after_success: - - coveralls --service=travis-pro - diff --git a/README.rst b/README.rst index 01a72e2e..5172dcfe 100644 --- a/README.rst +++ b/README.rst @@ -7,11 +7,14 @@ codecs for use in data storage and communication applications. .. image:: https://readthedocs.org/projects/numcodecs/badge/?version=latest :target: http://numcodecs.readthedocs.io/en/latest/?badge=latest -.. image:: https://travis-ci.org/zarr-developers/numcodecs.svg?branch=master - :target: https://travis-ci.org/zarr-developers/numcodecs +.. image:: https://github.com/zarr-developers/numcodecs/workflows/Linux%20CI/badge.svg?branch=master + :target: https://github.com/zarr-developers/numcodecs/actions?query=workflow%3A%22Linux+CI%22 -.. image:: https://ci.appveyor.com/api/projects/status/jhaaaxotvel24n9g?svg=true - :target: https://ci.appveyor.com/project/zarr-developers/numcodecs +.. image:: https://github.com/zarr-developers/numcodecs/workflows/OSX%20CI/badge.svg?branch=master + :target: https://github.com/zarr-developers/numcodecs/actions?query=workflow%3A%22OSX+CI%22 + +.. image:: https://github.com/zarr-developers/numcodecs/workflows/Wheels/badge.svg?branch=master + :target: https://github.com/zarr-developers/numcodecs/actions?query=workflow%3AWheels .. image:: https://coveralls.io/repos/github/zarr-developers/numcodecs/badge.svg?branch=master :target: https://coveralls.io/github/zarr-developers/numcodecs?branch=master diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 2c53e068..00000000 --- a/appveyor.yml +++ /dev/null @@ -1,42 +0,0 @@ -branches: - only: - - master - -environment: - - global: - # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the - # /E:ON and /V:ON options are not enabled in the batch script intepreter - # See: http://stackoverflow.com/a/13751649/163740 - CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\build.cmd" - - matrix: - - - PYTHON: "C:\\Python35-x64" - PYTHON_VERSION: "3.5" - - - PYTHON: "C:\\Python36-x64" - PYTHON_VERSION: "3.6" - - - PYTHON: "C:\\Python37-x64" - PYTHON_VERSION: "3.7" - -install: - - "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%" - - git submodule update --init --recursive - - "%CMD_IN_ENV% python -m pip install -U pip setuptools wheel" - - "%CMD_IN_ENV% python -m pip install -rrequirements_dev.txt" - - "%CMD_IN_ENV% python -m pip install -rrequirements_test.txt" - - "%CMD_IN_ENV% python setup.py build_ext --inplace" - - "%CMD_IN_ENV% python -m pip freeze" - -build: off - -test_script: - - "%CMD_IN_ENV% python -m pytest -v numcodecs" - -after_test: - - "%CMD_IN_ENV% python setup.py bdist_wheel" - -artifacts: - - path: dist\* diff --git a/docs/contributing.rst b/docs/contributing.rst index e6fad0fd..16e1dd4c 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -90,7 +90,7 @@ you have cloned the NumCodecs source code and your current working directory is the repository, you can do something like the following:: $ mkdir -p ~/pyenv/numcodecs-dev - $ virtualenv --no-site-packages --python=/usr/bin/python3.8 ~/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 @@ -145,11 +145,11 @@ To also run the doctests within docstrings, run:: Tests can be run under different Python versions using tox. E.g. (assuming you have the corresponding Python interpreters installed on your system):: - $ tox -e py35,py36,py37,py38 + $ tox -e py36,py37,py38,py39 -NumCodecs currently supports Python 3.5-3.8, so the above command must -succeed before code can be accepted into the main code base. Note that only the py38 -tox environment runs the doctests, i.e., doctests only need to succeed under Python 3.8. +NumCodecs currently supports Python 6-3.9, so the above command must +succeed before code can be accepted into the main code base. Note that only the py39 +tox environment runs the doctests, i.e., doctests only need to succeed under Python 3.9. All tests are automatically run via Travis (Linux) and AppVeyor (Windows) continuous integration services for every pull request. Tests must pass under both services before @@ -164,14 +164,14 @@ Conformance can be checked by running:: $ flake8 --max-line-length=100 numcodecs -This is automatically run when invoking ``tox -e py38``. +This is automatically run when invoking ``tox -e py39``. Test coverage ~~~~~~~~~~~~~ NumCodecs maintains 100% test coverage under the latest Python stable release (currently -Python 3.8). Both unit tests and docstring doctests are included when computing -coverage. Running ``tox -e py38`` will automatically run the test suite with coverage +Python 3.9). Both unit tests and docstring doctests are included when computing +coverage. Running ``tox -e py39`` 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. @@ -185,7 +185,7 @@ Documentation Docstrings for user-facing classes and functions should follow the `numpydoc `_ standard, including sections for Parameters and Examples. All examples will be run as doctests -under Python 3.8. +under Python 3.9. NumCodecs uses Sphinx for documentation, hosted on readthedocs.org. Documentation is written in the RestructuredText markup language (.rst files) in the ``docs`` folder. diff --git a/numcodecs/tests/test_pickles.py b/numcodecs/tests/test_pickles.py index 44502283..9f639e9d 100644 --- a/numcodecs/tests/test_pickles.py +++ b/numcodecs/tests/test_pickles.py @@ -43,7 +43,16 @@ def test_repr(): check_repr("Pickle(protocol=-1)") -@pytest.mark.skipif(sys.byteorder != 'little', - reason='Pickle does not restore byte orders') +# Details on xfail +# https://stackoverflow.com/questions/58194852/modulenotfounderror-no-module-named-numpy-core-multiarray-r +@pytest.mark.skipif( + sys.byteorder != "little", reason="Pickle does not restore byte orders" +) +@pytest.mark.xfail( + sys.platform == "win32", reason=( + "Pickle fails to read w/ Windows carriage return " + "( https://github.com/zarr-developers/numcodecs/issues/271 )" + ) +) def test_backwards_compatibility(): check_backwards_compatibility(Pickle.codec_id, arrays, codecs) diff --git a/requirements_dev.txt b/requirements_dev.txt index 256f0949..5a239ff4 100644 --- a/requirements_dev.txt +++ b/requirements_dev.txt @@ -1,3 +1,3 @@ -Cython==0.29.6 -msgpack==0.6.1 -numpy==1.16.2 +Cython==0.29.21 +msgpack==1.0.2 +numpy==1.19.0 diff --git a/setup.py b/setup.py index 1e5d7f12..61748497 100644 --- a/setup.py +++ b/setup.py @@ -322,18 +322,19 @@ def run_setup(with_extensions): python_requires=">=3.6, <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.6', - 'Programming Language :: Python :: 3.7', - 'Programming Language :: Python :: 3.8', + "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.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", ], author='Alistair Miles', author_email='alimanfoo@googlemail.com', diff --git a/tox.ini b/tox.ini index 8d5e6531..768cd5be 100644 --- a/tox.ini +++ b/tox.ini @@ -4,26 +4,26 @@ # and then run "tox" from this directory. [tox] -envlist = py35, py36, py37, py38, docs +envlist = py36, py37, py38, py39, docs [testenv] setenv = PYTHONHASHSEED = 42 # hooks for coverage exclusions based on Python major version - py35,py36,py37,py38: PY_MAJOR_VERSION = py3 + py36,py37,py38,py39: PY_MAJOR_VERSION = py3 commands = python setup.py build_ext --inplace - py35,py36,py37: pytest -v --cov=numcodecs numcodecs - py38: pytest -v --cov=numcodecs --doctest-modules --doctest-glob=*.pyx numcodecs + py36,py37,py38: pytest -v --cov=numcodecs numcodecs + py39: pytest -v --cov=numcodecs --doctest-modules --doctest-glob=*.pyx numcodecs coverage report -m - py38: flake8 numcodecs + py39: flake8 numcodecs pip freeze deps = -rrequirements_dev.txt -rrequirements_test.txt [testenv:docs] -basepython = python3.7 +basepython = python3.9 changedir = docs deps = -rrequirements_rtfd.txt