Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate to pyproject.toml + cleanup #1158

Merged
merged 11 commits into from
Oct 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
Comment on lines +1 to +3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will these perform the style fixes for us after pushing a PR? If so, that's great 😄

Though we probably want to document this behavior somewhere so users know about this. Maybe in the contributor guide?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes! But the maintainers should install the precommit.ci app (https://github.com/marketplace/pre-commit-ci) for Zarr's GH repository.

I'll document it in the contributor guide.

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,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

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 = "[email protected]" }
]
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
Saransh-cpp marked this conversation as resolved.
Show resolved Hide resolved
3 changes: 0 additions & 3 deletions setup.cfg

This file was deleted.

59 changes: 0 additions & 59 deletions setup.py

This file was deleted.