Skip to content

Commit

Permalink
set up config for precommit, black, flake8, codespell, isort and run
Browse files Browse the repository at this point in the history
  • Loading branch information
Remi-Gau committed Jan 11, 2024
1 parent e6b74ce commit 4c862f0
Show file tree
Hide file tree
Showing 71 changed files with 7,459 additions and 11,459 deletions.
42 changes: 42 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[flake8]
exclude =
.git,
__pycache__,
build,
dist,
--select = D,E,F,W
docstring-convention = numpy
max-line-length = 250
# For PEP8 error codes see
# http://pep8.readthedocs.org/en/latest/intro.html#error-codes
# D100-D104: missing docstring
# D105: missing docstring in magic method
# D107: missing docstring in __init__
# W504: line break after binary operator
per-file-ignores =
**/__init__.py: D104
ignore =
BLK100,
D105
D107,
E402,
E266,
E721,
E731,
E713,
E714,
E741,
F403,
F405,
E401,
F401,
F811,
F841,
F821,
FS001
W503,
W504,
W605,
# for compatibility with black
# https://black.readthedocs.io/en/stable/guides/using_black_with_other_tools.html#flake8
extend-ignore = E203
9 changes: 9 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
# Documentation
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
15 changes: 15 additions & 0 deletions .github/workflows/run_precommit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
53 changes: 53 additions & 0 deletions .github/workflows/update_precommit_hooks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
name: Update precommit hooks


on:

# Uses the cron schedule for github actions
#
# https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#scheduled-events
#
# ┌───────────── minute (0 - 59)
# │ ┌───────────── hour (0 - 23)
# │ │ ┌───────────── day of the month (1 - 31)
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
# │ │ │ │ │
# │ │ │ │ │
# │ │ │ │ │
# * * * * *
schedule:
- cron: 0 0 * * 1 # every monday

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
update_precommit_hooks:

# only run on upstream repo
if: github.repository_owner == 'SIMEXP'

runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
allow-prereleases: false
- name: Install pre-commit
run: pip install pre-commit
- name: Update pre-commit hooks
run: pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: pre-commit hooks auto-update
base: main
token: ${{ secrets.GITHUB_TOKEN }}
delete-branch: true
title: '[BOT] update pre-commit hooks'
body: done via this [GitHub Action](https://github.com/${{ github.repository_owner }}/giga_connectome/blob/main/.github/workflows/update_precommit_hooks.yml)
12 changes: 1 addition & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,4 @@
__pycache__
*.pyc
*.cpython
sample_data/sub-0001_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
sample_data/sub-0001_task-restingstate_acq-mb3_desc-confounds_regressors.tsv
sample_data/sub-0002_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
sample_data/sub-0002_task-restingstate_acq-mb3_desc-confounds_regressors.tsv
sample_data/sub-0003_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
sample_data/sub-0003_task-restingstate_acq-mb3_desc-confounds_regressors.tsv
sample_data/sub-0004_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
sample_data/sub-0004_task-restingstate_acq-mb3_desc-confounds_regressors.tsv
sample_data/sub-0005_task-restingstate_acq-mb3_space-MNI152NLin2009cAsym_desc-preproc_bold.nii.gz
sample_data/sub-0005_task-restingstate_acq-mb3_desc-confounds_regressors.tsv

sample_data/
60 changes: 60 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
# 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: v4.5.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: mixed-line-ending
- id: trailing-whitespace

- repo: https://github.com/ikamensh/flynt/
rev: 1.0.1
hooks:
- id: flynt

- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
args: [--profile, black]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.12.1
hooks:
- id: black-jupyter
args: [--config, pyproject.toml]

- repo: https://github.com/codespell-project/codespell
rev: v2.2.6
hooks:
- id: codespell
args: [--toml, pyproject.toml]
additional_dependencies: [tomli]

- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.3
hooks:
- id: yamlfmt
args: [--mapping, '4', --sequence, '4', --offset, '0']

- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
rev: v2.12.0
hooks:
- id: pretty-format-toml
args: [--autofix, --indent, '4']

- repo: https://github.com/pyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
args: [--config, .flake8, --verbose, pydfc, rest_dFC, task_dFC]
additional_dependencies: [flake8-use-fstring]
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.. image:: https://zenodo.org/badge/DOI/10.5281/zenodo.10211966.svg
:target: https://doi.org/10.5281/zenodo.10211966

pydfc
=======
An implementation of several well-known dynamic Functional Connectivity (dFC) assessment methods.
Expand All @@ -16,4 +16,4 @@ The ``multi_analysis_demo.ipynb`` illustrates how to use the ``pydfc`` toolbox t

For more details about the implemented methods and the comparison analysis see `our paper <https://www.biorxiv.org/content/10.1101/2023.07.13.548883v2>`_.

* Torabi M, Mitsis GD, Poline JB. On the variability of dynamic functional connectivity assessment methods. bioRxiv. 2023:2023-07.
* Torabi M, Mitsis GD, Poline JB. On the variability of dynamic functional connectivity assessment methods. bioRxiv. 2023:2023-07.
29 changes: 0 additions & 29 deletions build/lib/pydfc/__init__.py

This file was deleted.

10 changes: 0 additions & 10 deletions build/lib/pydfc/comparison/__init__.py

This file was deleted.

Loading

0 comments on commit 4c862f0

Please sign in to comment.