Skip to content

Commit

Permalink
Migrate to pyproject.toml + cleanup (#1158)
Browse files Browse the repository at this point in the history
* Migrate to pyproject.toml + cleanup

* Remove more instances of python setup.py ...

* release.rst entry

* Move changes to unreleased section

* Remove pre-commit checks from workflows

* Update `jupyter` dependencies

Co-authored-by: jakirkham <jakirkham@gmail.com>

* Lower pin setuptools

* Document installing `build`

Co-authored-by: jakirkham <jakirkham@gmail.com>

* Add docs for twine and pre-commit

* Add pre-commit badge to readme.

* add .readthedocs.yaml

Co-authored-by: jakirkham <jakirkham@gmail.com>
Co-authored-by: Josh Moore <josh@openmicroscopy.org>
  • Loading branch information
3 people authored Oct 15, 2022
1 parent 2c52b17 commit 4362bb4
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 125 deletions.
File renamed without changes.
34 changes: 0 additions & 34 deletions .github/workflows/Pre-commit-hooks.yml

This file was deleted.

6 changes: 0 additions & 6 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ zarr/version.py
# emacs
*~

# VSCode
.vscode/

# test data
#*.zarr
#*.zip
Expand Down
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
15 changes: 15 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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: .
Empty file removed MANIFEST.in
Empty file.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,19 @@
<td>Build Status</td>
<td>
<a href="https://github.com/zarr-developers/zarr-python/blob/main/.github/workflows/python-package.yml">
<img src="https://github.com/zarr-developers/zarr-python/actions/workflows/python-package.yml/badge.svg" alt="license" />
<img src="https://github.com/zarr-developers/zarr-python/actions/workflows/python-package.yml/badge.svg" alt="build status" />
</a>
</td>
</tr>
<tr>
<td>Pre-commit Status</td>
<td>
<a href=""https://github.com/zarr-developers/zarr-python/blob/main/.pre-commit-config.yaml">
<img src="https://results.pre-commit.ci/badge/github/zarr-developers/zarr-python/main.svg" alt="pre-commit status" />
</a>
</td>
</tr>

<tr>
<td>Coverage</td>
<td>
Expand Down
27 changes: 23 additions & 4 deletions docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down
12 changes: 9 additions & 3 deletions docs/release.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <Saransh-cpp>` :issue:`1158`.

.. _release_2.13.3:

2.13.3
Expand Down
4 changes: 0 additions & 4 deletions mypy.ini

This file was deleted.

79 changes: 78 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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",
]
8 changes: 0 additions & 8 deletions pytest.ini

This file was deleted.

6 changes: 5 additions & 1 deletion release.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

59 changes: 0 additions & 59 deletions setup.py

This file was deleted.

0 comments on commit 4362bb4

Please sign in to comment.