Skip to content

Commit

Permalink
Merge pull request #7 from richardkoehler/dev
Browse files Browse the repository at this point in the history
Add pre-commit, fix typing and linting, update version
  • Loading branch information
richardkoehler committed Feb 14, 2024
2 parents 590663a + 588af34 commit eebec61
Show file tree
Hide file tree
Showing 21 changed files with 534 additions and 1,029 deletions.
48 changes: 24 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,10 @@ name: Tests
on:
push:
branches:
- main
- '*.x'
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
- '*.txt'
- "*"
pull_request:
branches:
- main
- '*.x'
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
- '*.txt'
- "*"
jobs:
tests:
name: ${{ matrix.name }}
Expand All @@ -26,15 +14,25 @@ jobs:
fail-fast: false
matrix:
include:
- {name: 3.10 Linux, python: '3.10', os: ubuntu-latest, tox: py310}
- {name: 3.10 Windows, python: '3.10', os: windows-latest, tox: py310}
- {name: 3.10 Mac, python: '3.10', os: macos-latest, tox: py310}
- {name: Lint, python: '3.10', os: ubuntu-latest, tox: lint}
- {name: Typing, python: '3.10', os: ubuntu-latest, tox: typing}
- {name: Style, python: '3.10', os: ubuntu-latest, tox: style}
# - { name: 3.12 Linux, python: "3.12", os: ubuntu-latest, tox: py312 }
# - { name: 3.11 Linux, python: "3.11", os: ubuntu-latest, tox: py311 }
# - { name: 3.10 Linux, python: "3.10", os: ubuntu-latest, tox: py310 }
# - {
# name: 3.12 Windows,
# python: "3.12",
# os: windows-latest,
# tox: py312,
# }
# - { name: 3.12 Mac, python: "3.12", os: macos-latest, tox: py312 }
- {
name: Lint with pre-commit,
python: "3.12",
os: ubuntu-latest,
tox: lint,
}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
- name: update pip
Expand All @@ -44,9 +42,11 @@ jobs:
id: pip-cache
run: echo "::set-output name=dir::$(pip cache dir)"
- name: cache pip
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: pip|${{ runner.os }}|${{ matrix.python }}|${{ hashFiles('setup.py') }}|${{ hashFiles('requirements/*.txt') }}
key:
pip|${{ runner.os }}|${{ matrix.python }}|${{
hashFiles('setup.py')}}
- run: pip install tox
- run: tox -e ${{ matrix.tox }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,6 @@ dmypy.json

# Pyre type checker
.pyre/

# Ruff litner
.ruff_cache/
91 changes: 91 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
ci:
autoupdate_commit_msg: "chore: update pre-commit hooks"
autofix_commit_msg: "style: pre-commit fixes"

repos:
- repo: https://github.com/psf/black-pre-commit-mirror
rev: "23.10.1"
hooks:
- id: black-jupyter

- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: "v4.5.0"
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-merge-conflict
- id: check-symlinks
- id: check-yaml
- id: debug-statements
- id: end-of-file-fixer
- id: mixed-line-ending
- id: name-tests-test
args: ["--pytest-test-first"]
- id: requirements-txt-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
rev: "v1.10.0"
hooks:
- id: rst-backticks
- id: rst-directive-colons
- id: rst-inline-touching-normal

- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.0.3"
hooks:
- id: prettier
types_or: [yaml, markdown, html, css, scss, javascript, json]
args: [--prose-wrap=always]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.3"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.6.1"
hooks:
- id: mypy
files: src|tests
args: []
additional_dependencies:
- pytest
- pandas-stubs

- repo: https://github.com/codespell-project/codespell
rev: "v2.2.6"
hooks:
- id: codespell

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: "v0.9.0.6"
hooks:
- id: shellcheck

- repo: local
hooks:
- id: disallow-caps
name: Disallow improper capitalization
language: pygrep
entry: PyBind|Numpy|Cmake|CCache|Github|PyTest
exclude: .pre-commit-config.yaml

- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.15
hooks:
- id: validate-pyproject

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.27.0
hooks:
- id: check-dependabot
- id: check-github-workflows
- id: check-readthedocs
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
62 changes: 37 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
[![Python Versions][python-shield]][python-url]
[![PyPi][pypi-shield]][pypi-url]
[![Tests][tests-shield]][tests-url]
[![License][license-shield]][license-url]
[![Python Versions][python-shield]][python-url] [![PyPi][pypi-shield]][pypi-url]
[![Tests][tests-shield]][tests-url] [![License][license-shield]][license-url]
[![Contributors][contributors-shield]][contributors-url]
[![Code Style][codestyle-shield]][codestyle-url]
[![Homepage][homepage-shield]][homepage-url]


# PTE Stats - Python tools for electrophysiology

PTE Stats is an open-source software package for statistics with time series.

It builds upon [PTE](https://github.com/richardkoehler/pte) and provides statistical tools for time-series.
PTE Stats is particularly useful with intracranial EEG (iEEG) data such as local field potentials (LFP) and electrocorticography (ECoG).
It builds upon [PTE](https://github.com/richardkoehler/pte) and provides
statistical tools for time-series. PTE Stats is particularly useful with
intracranial EEG data such as local field potentials and electrocorticography.

## Installing pte-stats

Expand All @@ -26,7 +24,7 @@ $ pip install pte-stats

### Development version

To install the latest delevopment version, first clone this repository:
To install the latest development version, first clone this repository:

```bash
$ git clone https://github.com/richardkoehler/pte-stats
Expand All @@ -45,25 +43,27 @@ If you want to install pte-stats into an existing environment, type:
$ pip install -e .
```


## Usage

```python
import pte_stats

# Examples coming soon
```

## Contributing

Please feel free to contribute yourselves or to open an **issue** when you encounter a bug or to request a new feature.
Please feel free to contribute yourselves or to open an **issue** when you
encounter a bug or to request a new feature.

For any minor additions or bugfixes, you may simply create a **pull request**.
For any minor additions or bugfixes, you may simply create a **pull request**.

For any major changes, make sure to open an **issue** first. When you then create a pull request, be sure to **link the pull request** to the open issue in order to close the issue automatically after merging.
For any major changes, make sure to open an **issue** first. When you then
create a pull request, be sure to **link the pull request** to the open issue in
order to close the issue automatically after merging.

### How to contribute
To contribute yourselves, you should fork this repository, and then create a development branch from your fork.

To contribute yourselves, you should fork this repository, and then create a
development branch from your fork.

Then, inside your development branch run the commands:

Expand All @@ -78,24 +78,36 @@ $ conda activate pte-stats-dev
$ pip install -e .[dev]
```

This will additionally install packages for development, such as black, pylint, mypy and isort.
This will additionally install packages for development, such as black, pylint,
mypy and isort.

## License

PTE Stats is licensed under the [MIT license](license-url).

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
[python-shield]: https://img.shields.io/static/v1?label=Python&message=3.10&logoColor=black&labelColor=grey&color=blue

[python-shield]:
https://img.shields.io/static/v1?label=Python&message=3.10&logoColor=black&labelColor=grey&color=blue
[python-url]: https://pypi.org/project/pte-stats/
[pypi-shield]: https://img.shields.io/static/v1?label=PyPi&message=v0.2.0&logoColor=black&labelColor=grey&color=blue
[pypi-shield]:
https://img.shields.io/static/v1?label=PyPi&message=v0.2.0&logoColor=black&labelColor=grey&color=blue
[pypi-url]: https://pypi.org/project/pte-stats/
[tests-shield]: https://github.com/richardkoehler/pte-stats/actions/workflows/tests.yml/badge.svg
[tests-url]: https://github.com/richardkoehler/pte-stats/actions/workflows/tests.yml
[homepage-shield]: https://img.shields.io/static/v1?label=Homepage&message=ICN&logoColor=black&labelColor=grey&color=9cf
[tests-shield]:
https://github.com/richardkoehler/pte-stats/actions/workflows/tests.yml/badge.svg
[tests-url]:
https://github.com/richardkoehler/pte-stats/actions/workflows/tests.yml
[homepage-shield]:
https://img.shields.io/static/v1?label=Homepage&message=ICN&logoColor=black&labelColor=grey&color=9cf
[homepage-url]: https://www.icneuromodulation.org/
[contributors-shield]: https://img.shields.io/github/contributors/richardkoehler/pte-stats.svg
[contributors-url]: https://github.com/richardkoehler/pte-stats/graphs/contributors
[license-shield]: https://img.shields.io/static/v1?label=License&message=MIT&logoColor=black&labelColor=grey&color=yellow
[contributors-shield]:
https://img.shields.io/github/contributors/richardkoehler/pte-stats.svg
[contributors-url]:
https://github.com/richardkoehler/pte-stats/graphs/contributors
[license-shield]:
https://img.shields.io/static/v1?label=License&message=MIT&logoColor=black&labelColor=grey&color=yellow
[license-url]: https://github.com/richardkoehler/pte-stats/blob/main/LICENSE/
[codestyle-shield]: https://img.shields.io/static/v1?label=CodeStyle&message=black&logoColor=black&labelColor=grey&color=black
[codestyle-shield]:
https://img.shields.io/static/v1?label=CodeStyle&message=black&logoColor=black&labelColor=grey&color=black
[codestyle-url]: https://github.com/psf/black
14 changes: 11 additions & 3 deletions doc/CHANGELOG.md → docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,27 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

### Fixed

### Changed

### Deprecated
### Removed

### Removed

## [0.1.0] - 2022-02-01

### Added

- Initial release

[Unreleased]: https://github.com/richardkoehler/pte-stats
[Unreleased]: https://github.com/richardkoehler/pte-stats
4 changes: 2 additions & 2 deletions env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ channels:
- defaults
dependencies:
- pip
- python=3.10
- python>=3.10
- pip:
- pte-stats
- pte-stats
5 changes: 2 additions & 3 deletions env_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ channels:
- defaults
dependencies:
- pip
- python=3.10
- python>=3.10
- pip:
- pte-stats[dev]

- -e .[dev]
Loading

0 comments on commit eebec61

Please sign in to comment.