Skip to content

Commit

Permalink
Pre-commit hook for style checks and other normalizations
Browse files Browse the repository at this point in the history
Activated checks
- trailing-whitespace
- end-of-file-fixer
- check-yaml
- check-added-large-files
- flake8
- black

Flake8 is configured to ignore issues E501, F403, and F401 for now. They will be
fixed later.

Also added some lines about HACKING to README.md, describing the setup of the
environment including these developer tools.
  • Loading branch information
bhagemeier committed Oct 2, 2019
1 parent 7eb550b commit 7956a91
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: flake8
- repo: https://github.com/psf/black
rev: 19.3b0
hooks:
- id: black
20 changes: 18 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ Requirements

HeAT is based on [PyTorch](https://pytorch.org/). Specifially, we are exploiting
PyTorch's support for GPUs *and* MPI parallelism. For MPI support we utilize
[mpi4py](https://mpi4py.readthedocs.io). Both packages can be installed via pip or automatically using the setup.py.
[mpi4py](https://mpi4py.readthedocs.io). Both packages can be installed via pip
or automatically using the setup.py.


Installation
Expand All @@ -66,13 +67,28 @@ install the latest version with
where the part in brackets is a list of optional dependencies. You can omit
it, if you do not need HDF5 or NetCDF support.

Hacking
-------

If you want to work with the development version, you can checkout the sources using

> $ git clone https://github.com/helmholtz-analytics/heat.git
The installation can then be done from the checked out sources with

> $ pip install .[hdf5, netcdf]
> $ pip install .[hdf5, netcdf, dev]
The extra `dev` dependency pulls in additional tools to support the enforcement
of coding conventions ([Black](https://github.com/psf/black)) and to support a
pre-commit hook to do the same. In order to fully use this framework, please
also install the pre-commit hook with

> $ pre-commit install
In order to check compliance of your changes before even trying to commit anything,
you can runs

> $ pre-commit run --all-files
License
-------
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ ignore = E203,E402,W503

[flake8]
max-line-length = 88
ignore = E203,E402,W503
ignore = E203,E402,W503,E501,F403,F401

0 comments on commit 7956a91

Please sign in to comment.