diff --git a/codecov.yml b/.github/codecov.yml similarity index 100% rename from codecov.yml rename to .github/codecov.yml diff --git a/.github/workflows/Pre-commit-hooks.yml b/.github/workflows/Pre-commit-hooks.yml deleted file mode 100644 index e219b75e69..0000000000 --- a/.github/workflows/Pre-commit-hooks.yml +++ /dev/null @@ -1,34 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: pre-commit - -# Controls when the workflow will run -on: - # Triggers the workflow pull request events but only for the main branch - pull_request: - push: - branches: [main] - - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # Using Ubuntu image with latest tag - pre-commit: - runs-on: ubuntu-latest - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - - uses: actions/checkout@v3 - #setting up Python v3.0.0 - - uses: actions/setup-python@v4.2.0 - with: - python-version: '3.9' - #using pre-commit latest i.e v2.0.3 - - uses: pre-commit/action@v3.0.0 - #Running pre-commit for all files - - name: Pre-Commit-Run - run: | - pip install pre-commit - pre-commit run --all-files diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index 2eeede91fe..9abb7c7866 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -83,9 +83,3 @@ jobs: #name: codecov-umbrella # optional #fail_ci_if_error: true # optional (default = false) verbose: true # optional (default = false) - - name: Linting - shell: "bash -l {0}" - run: | - conda activate zarr-env - flake8 zarr - mypy zarr diff --git a/.gitignore b/.gitignore index f2f7edc348..535cf2b169 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,9 @@ zarr/version.py # emacs *~ +# VSCode +.vscode/ + # test data #*.zarr #*.zip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 70ead97d0b..d62b10aa40 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,6 @@ +ci: + autoupdate_commit_msg: "chore: update pre-commit hooks" + autofix_commit_msg: "style: pre-commit fixes" default_stages: [commit, push] default_language_version: python: python3.9 @@ -11,7 +14,21 @@ repos: ] exclude: ^(venv/|docs/) types: ['python'] + - repo: https://github.com/codespell-project/codespell + rev: v2.1.0 + hooks: + - id: codespell + args: ["-L", "ba,ihs,kake,nd,noe,nwo,te"] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v2.3.0 hooks: - id: check-yaml + - repo: https://github.com/pre-commit/mirrors-mypy + rev: v0.981 + hooks: + - id: mypy + files: zarr + args: [] + additional_dependencies: + - types-redis + - types-setuptools diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000000..42fc08bca2 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,15 @@ +version: 2 + +build: + os: ubuntu-20.04 + tools: + python: "3.9" + +sphinx: + configuration: docs/conf.py + +python: + install: + - requirements: requirements_rtfd.txt + - method: pip + path: . diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/README.md b/README.md index ba393e6141..3576d0c30e 100644 --- a/README.md +++ b/README.md @@ -40,10 +40,19 @@ Build Status - license + build status + + Pre-commit Status + + + pre-commit status + + + + Coverage diff --git a/docs/contributing.rst b/docs/contributing.rst index cfb24b50af..64e61abacb 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -179,14 +179,33 @@ also collected automatically via the Codecov service, and total coverage over all builds must be 100% (although individual builds may be lower due to Python 2/3 or other differences). -Code standards -~~~~~~~~~~~~~~ +Code standards - using pre-commit +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ All code must conform to the PEP8 standard. Regarding line length, lines up to 100 characters are allowed, although please try to keep under 90 wherever possible. -Conformance can be checked by running:: - $ python -m flake8 --max-line-length=100 zarr +``Zarr`` uses a set of ``pre-commit`` hooks and the ``pre-commit`` bot to format, +type-check, and prettify the codebase. ``pre-commit`` can be installed locally by +running:: + + $ python -m pip install pre-commit + +The hooks can be installed locally by running:: + + $ pre-commit install + +This would run the checks every time a commit is created locally. These checks will also run +on every commit pushed to an open PR, resulting in some automatic styling fixes by the +``pre-commit`` bot. The checks will by default only run on the files modified by a commit, +but the checks can be triggered for all the files by running:: + + $ pre-commit run --all-files + +If you would like to skip the failing checks and push the code for further discussion, use +the ``--no-verify`` option with ``git commit``. + + Test coverage ~~~~~~~~~~~~~ diff --git a/docs/installation.rst b/docs/installation.rst index 047dbe2bd2..a07c1c42e1 100644 --- a/docs/installation.rst +++ b/docs/installation.rst @@ -23,7 +23,7 @@ To work with Zarr source code in development, install from GitHub:: $ git clone --recursive https://github.com/zarr-developers/zarr-python.git $ cd zarr-python - $ python setup.py install + $ python -m pip install -e . To verify that Zarr has been fully installed, run the test suite:: diff --git a/docs/release.rst b/docs/release.rst index b511c6a1b4..ea746999e1 100644 --- a/docs/release.rst +++ b/docs/release.rst @@ -6,14 +6,20 @@ Release notes # to document your changes. On releases it will be # re-indented so that it does not show up in the notes. - .. _unreleased: +.. _unreleased: - Unreleased - ---------- +Unreleased +---------- .. # .. warning:: # Pre-release! Use :command:`pip install --pre zarr` to evaluate this release. +Maintenance +~~~~~~~~~~~ + +* Migrate to ``pyproject.toml`` and remove redundant infrastructure. + By :user:`Saransh Chopra ` :issue:`1158`. + .. _release_2.13.3: 2.13.3 diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index 7c1be49cd6..0000000000 --- a/mypy.ini +++ /dev/null @@ -1,4 +0,0 @@ -[mypy] -python_version = 3.8 -ignore_missing_imports = True -follow_imports = silent diff --git a/pyproject.toml b/pyproject.toml index 2f21011953..8da5e6b994 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,80 @@ [build-system] -requires = ["setuptools>=40.8.0", "wheel"] +requires = ["setuptools>=40.8.0", "setuptools-scm", "wheel"] build-backend = "setuptools.build_meta" + + +[project] +name = "zarr" +description = "An implementation of chunked, compressed, N-dimensional arrays for Python" +readme = { file = "README.md", content-type = "text/markdown" } +maintainers = [ + { name = "Alistair Miles", email = "alimanfoo@googlemail.com" } +] +requires-python = ">=3.8" +dependencies = [ + 'asciitree', + 'numpy>=1.7', + 'fasteners', + 'numcodecs>=0.10.0', +] +dynamic = [ + "version", +] +classifiers = [ + 'Development Status :: 6 - Mature', + '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.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', +] + +[project.optional-dependencies] +jupyter = [ + 'notebook', + 'ipytree>=0.2.2', + 'ipywidgets>=8.0.0', +] + +[project.urls] +"Bug Tracker" = "https://github.com/zarr-developers/zarr-python/issues" +Changelog = "https://zarr.readthedocs.io/en/stable/release.html" +Discussions = "https://github.com/zarr-developers/zarr-python/discussions" +Documentation = "https://zarr.readthedocs.io/" +Homepage = "https://github.com/zarr-developers/zarr-python" + + +[tool.setuptools] +packages = ["zarr", "zarr._storage", "zarr.tests"] + +[tool.setuptools_scm] +version_scheme = "guess-next-dev" +local_scheme = "dirty-tag" +write_to = "zarr/version.py" + +[tool.mypy] +python_version = "3.8" +ignore_missing_imports = true +follow_imports = "silent" + +[tool.pytest.ini_options] +doctest_optionflags = [ + "NORMALIZE_WHITESPACE", + "ELLIPSIS", + "IGNORE_EXCEPTION_DETAIL", +] +addopts = [ + "--durations=10", +] +filterwarnings = [ + "error:::zarr.*", + "ignore:Not all N5 implementations support blosc compression.*:RuntimeWarning", + "ignore:PY_SSIZE_T_CLEAN will be required.*:DeprecationWarning", + "ignore:The loop argument is deprecated since Python 3.8.*:DeprecationWarning", +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index 966b5ad931..0000000000 --- a/pytest.ini +++ /dev/null @@ -1,8 +0,0 @@ -[pytest] -doctest_optionflags = NORMALIZE_WHITESPACE ELLIPSIS IGNORE_EXCEPTION_DETAIL -addopts = --durations=10 -filterwarnings = - error:::zarr.* - ignore:Not all N5 implementations support blosc compression.*:RuntimeWarning - ignore:PY_SSIZE_T_CLEAN will be required.*:DeprecationWarning - ignore:The loop argument is deprecated since Python 3.8.*:DeprecationWarning diff --git a/release.txt b/release.txt index 4d7f099019..ff114f6dba 100644 --- a/release.txt +++ b/release.txt @@ -3,5 +3,9 @@ tox echo $version git tag -a v$version -m v$version git push --tags -python setup.py register sdist +# Install `build` if not present with `python -m pip install build` or similar +# for building Zarr +python -m build +# Install `twine` if not present with `python -m pip install twine` or similar +# for publishing Zarr to PyPI twine upload dist/zarr-${version}.tar.gz diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 28e25ed827..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[codespell] -skip = ./.git -ignore-words-list = ba, ihs, kake, nd, noe, nwo, te diff --git a/setup.py b/setup.py deleted file mode 100644 index 9f005ecd39..0000000000 --- a/setup.py +++ /dev/null @@ -1,59 +0,0 @@ -from setuptools import setup - -DESCRIPTION = 'An implementation of chunked, compressed, ' \ - 'N-dimensional arrays for Python.' - -with open('README.md') as f: - LONG_DESCRIPTION = f.read() - -dependencies = [ - 'asciitree', - 'numpy>=1.7', - 'fasteners', - 'numcodecs>=0.10.0', -] - -setup( - name='zarr', - description=DESCRIPTION, - long_description=LONG_DESCRIPTION, - long_description_content_type='text/markdown', - use_scm_version={ - 'version_scheme': 'guess-next-dev', - 'local_scheme': 'dirty-tag', - 'write_to': 'zarr/version.py', - }, - setup_requires=[ - 'setuptools>=38.6.0', - 'setuptools-scm>1.5.4', - ], - extras_require={ - 'jupyter': [ - 'notebook', - 'ipytree>=0.2.2', - 'ipywidgets>=8.0.0', - ], - }, - python_requires='>=3.8, <4', - install_requires=dependencies, - package_dir={'': '.'}, - packages=['zarr', 'zarr._storage', 'zarr.tests'], - classifiers=[ - 'Development Status :: 6 - Mature', - '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.8', - 'Programming Language :: Python :: 3.9', - 'Programming Language :: Python :: 3.10', - ], - maintainer='Alistair Miles', - maintainer_email='alimanfoo@googlemail.com', - url='https://github.com/zarr-developers/zarr-python', - license='MIT', -)