Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
repos:
- repo: https://github.com/Casyfill/codestyle
rev: '982233638ee63e70ff40999a1314ae7c9067aa13' # pick a git hash / tag to point to
hooks:
- id: catalyst-make-codestyle
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Added

-
- added `pre-commit` hook to run codestyle checker on commit ([#1257](https://github.com/catalyst-team/catalyst/pull/1257))

### Changed

Expand Down
24 changes: 19 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ It's much harder to merge in a large change with a lot of disjoint features.
3. Submit the update as a GitHub pull request against the `master` branch.
4. Make sure that you provide docstrings for all your new methods and classes.
5. Add new unit tests for your code ([PR examples](#pr-examples)).
6. Check the [codestyle](#codestyle)
6. (Optional) Check the [codestyle](#codestyle). We use a pre-commit hook that runs the formatting on commit, so you don't have to.
7. Make sure that your code [passes the Github CI](#github-ci)


Expand All @@ -115,19 +115,33 @@ Please use it as a collaborative platform, if you have any issues during the PR.
### Codestyle

We also have our own [catalyst-codestyle](https://github.com/catalyst-team/codestyle)
package to help with code formatting issues.
package to help with code formatting issues, and a corresponding pre-commit hook installed.

You could check the codestyle for your PR with:
To set the hook, please run (this requires `pre-commit` package, pinned in the `requirements-dev.txt`):
```bash
pre-commit install
```
Once the installation is done, all the files that are changed will be formatted automatically (and commit halted if something goes wrong, e.g there is a syntactic error). You can also run the formatting manually:
```bash
pre-commit run
```

If for some reason you'll want to turn the hook off temporarily, you can do that with:
```bash
catalyst-make-codestyle && catalyst-check-codestyle
SKIP=catalyst-make-codestyle git commit -m "foo"
```
Or you can uninstall it completely with:
```bash
pre-commit uninstall
```

Once again, make sure that your python packages complied with `requirements/requirements.txt` and `requirements/requirements-dev.txt` to get codestyle run clean:
Once again, make sure that your python packages complied with `requirements/requirements.txt` and `requirements/requirements-dev.txt` to get codestyle and pre-commit run clean:
```bash
pip install -r requirements/requirements.txt -r requirements/requirements-dev.txt
```

For more information on pre-commit, please refer to [pre-commit documentation](https://pre-commit.com/).

### Documentation

Catalyst uses [Google style](http://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html) for formatting [docstrings](https://github.com/google/styleguide/blob/gh-pages/pyguide.md#38-comments-and-docstrings).
Expand Down
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,24 +141,32 @@ utils.onnx_export(model=runner.model, batch=features_batch, file="./logs/mnist.o


## Table of Contents
- [Getting started](#getting-started)
- [Step-by-step Guide](#step-by-step-guide)
- [Table of Contents](#table-of-contents)
- [Overview](#overview)
* [Installation](#installation)
* [Minimal examples](#minimal-examples)
* [Features](#features)
* [Tests](#tests)
- [Installation](#installation)
- [Minimal Examples](#minimal-examples)
- [Features](#features)
- [Tests](#tests)
- [Catalyst](#catalyst)
* [Documentation](#documentation)
* [Notebooks](#notebooks)
* [Blog Posts](#notable-blog-posts)
* [Talks](#talks)
* [Projects](#projects)
- [Documentation](#documentation)
- [Notebooks](#notebooks)
- [Notable Blog Posts](#notable-blog-posts)
- [Talks](#talks)
- [Projects](#projects)
- [Examples, Notebooks, and Starter Kits](#examples-notebooks-and-starter-kits)
- [Competitions](#competitions)
- [Research Papers](#research-papers)
- [Toolkits](#toolkits)
- [Community](#community)
* [Contribution Guide](#contribution-guide)
* [User Feedback](#user-feedback)
* [Acknowledgments](#acknowledgments)
* [Trusted by](#trusted-by)
* [Supported by](#supported-by)
* [Citation](#citation)
- [Contribution Guide](#contribution-guide)
- [User Feedback](#user-feedback)
- [Acknowledgments](#acknowledgments)
- [Catalyst.Team](#catalystteam)
- [Catalyst.Contributors](#catalystcontributors)
- [Trusted by](#trusted-by)
- [Citation](#citation)


## Overview
Expand Down Expand Up @@ -1559,7 +1567,7 @@ runner.run()

### Tests
All Catalyst code, features, and pipelines [are fully tested](./catalyst/tests).
We also have our own [catalyst-codestyle](https://github.com/catalyst-team/codestyle).
We also have our own [catalyst-codestyle](https://github.com/catalyst-team/codestyle) and a corresponding pre-commit hook.

During testing, we train a variety of different models: image classification,
image segmentation, text classification, GANs, and much more.
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ mock==3.0.5
catalyst-codestyle==21.03rc2
catalyst-sphinx-theme==1.1.2
toml==0.10.0
pre-commit==2.13.0