Skip to content

Commit

Permalink
Further tooling: black, flake8, and precommit-hooks (#32)
Browse files Browse the repository at this point in the history
* feat: add black, flake8 and precommit-hooks

* chore: run precommit-hooks on all files and fix all existing errors

* feat: improve documentation regarding contributions and intended uses of GutenTAG

* fix: pre-commit-dependency version specification

* fix: downgrade flake8 to 5.0.4 to support Python 3.7

* chore: remove obsolete gitlab CI configuration

* fix: downgrade pre-commit to 2.21 to support Python 3.7

* chore: remove additional generation configurations

(they were accidentially added in a previous commit)
  • Loading branch information
CodeLionX authored Jul 16, 2023
1 parent 6834ec8 commit 9ebc74e
Show file tree
Hide file tree
Showing 68 changed files with 1,968 additions and 1,151 deletions.
9 changes: 7 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ defaults:
shell: bash -l {0}

jobs:
typecheck:
name: Typecheck GutenTAG on ubuntu with python 3.7
check:
name: Run checks for GutenTAG on ubuntu with python 3.7
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Miniconda
Expand All @@ -29,6 +30,10 @@ jobs:
- name: Typcheck with mypy
run: |
python setup.py typecheck
- name: Lint with flake8
run: |
flake8 . --count --show-source --statistics
test:
name: Test GutenTAG on ${{ matrix.os }} with python ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/test-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ defaults:
shell: bash -l {0}

jobs:
typecheck:
name: Typecheck GutenTAG on ubuntu with python 3.7
check:
name: Run checks for GutenTAG on ubuntu with python 3.7
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Setup Miniconda
Expand All @@ -28,6 +29,10 @@ jobs:
- name: Typcheck with mypy
run: |
python setup.py typecheck
- name: Lint with flake8
run: |
flake8 . --count --show-source --statistics
test:
name: Test GutenTAG on ${{ matrix.os }} with python ${{ matrix.python_version }}
runs-on: ${{ matrix.os }}
Expand Down
72 changes: 0 additions & 72 deletions .gitlab-ci.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]
- id: check-case-conflict
- id: mixed-line-ending
args: [--fix=lf]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v0.920
hooks:
- id: mypy
files: gutenTAG
additional_dependencies:
- types-PyYAML
- types-jsonschema
- repo: https://github.com/psf/black
rev: '23.1.0'
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: '5.0.4'
hooks:
- id: flake8
36 changes: 36 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Contributing

## Code style and format

We use [black](https://black.readthedocs.io/) to automatically format our python files.
Please stick to the black code style.

Please consider using the pre-commit hooks.
They automatically run i.a. black for you.
See next section.

### Black quick-installation guide

```bash
pip install black
black
```

## Running pre-commit hooks

We use [pre-commit](https://pre-commit.com/) to run some checks on your files before they are commited.
Find the configured hooks in [`.pre-commit-config.yaml`](./pre-commit-config.yaml).
If there are errors, you have to re-add the files to the index and commit the fixed files.

### Pre-commit quick-installation guide

```bash
pip install pre-commit
pre-commit install
```

Optionally, cou can then run the hooks against all files with:

```bash
pre-commit run --all-files
```
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

[![CI](https://github.com/HPI-Information-Systems/gutentag/actions/workflows/build.yml/badge.svg)](https://github.com/HPI-Information-Systems/gutentag/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/HPI-Information-Systems/gutentag/branch/main/graph/badge.svg?token=6QXOCY4TS2)](https://codecov.io/gh/HPI-Information-Systems/gutentag)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PyPI package](https://badge.fury.io/py/timeeval-gutenTAG.svg)](https://badge.fury.io/py/timeeval-gutenTAG)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
![python version 3.7|3.8|3.9|3.10|3.11](https://img.shields.io/badge/python-3.7%20%7C%203.8%20%7C%203.9%20%7C%203.10%20%7C%203.11-blue)
Expand Down Expand Up @@ -93,6 +94,8 @@ If you use GutenTAG in your project or research, please cite our demonstration p
}
```
## To-Do
## Contributing
- [ ] negation anomaly (does a pattern not appear)
We welcome contributions to GutenTAG.
If you have spotted an issue with GutenTAG or if you want to enhance it, please open an issue first.
See [Contributing](CONTRIBUTING.md) for details.
2 changes: 1 addition & 1 deletion doc/advanced-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Add-Ons

GutenTAG has a simple add-on feature which can be activated by using the [CLI](usage#from-cli).
GutenTAG has a simple add-on feature which can be activated by using the [CLI](usage#from-cli).

### Definition

Expand Down
2 changes: 1 addition & 1 deletion doc/introduction/base-oscillations.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ operand: Union[float, FormulaObj]
**Aggregation**

The alternative to the `Operation` is the `Aggregation` field. This field defines an aggregation operation on the `base`. Its result is either a scalar or an array. It consists of two fields: `kind`, and `axis`.
The `kind` field defines the kind of aggregation performed on a numpy array. The optional `axis` field defines the axis of the array the aggregation is performed on. If no `axis` is defined, the aggregation will return a scalar.
The `kind` field defines the kind of aggregation performed on a numpy array. The optional `axis` field defines the axis of the array the aggregation is performed on. If no `axis` is defined, the aggregation will return a scalar.

```yaml
# Aggregation
Expand Down
Loading

0 comments on commit 9ebc74e

Please sign in to comment.