Skip to content

Commit

Permalink
Merge pull request #1376 from alejoe91/black-formatting-action
Browse files Browse the repository at this point in the history
Add black-formatting action
  • Loading branch information
apdavison authored Jan 26, 2024
2 parents e8f0b12 + d4b83a6 commit e7ae042
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 4 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/black-formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Black formatting

on:
workflow_dispatch:
schedule:
- cron: "0 12 * * 0" # Weekly at noon UTC on Sundays

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Check and apply black formatting
id: black-check
uses: psf/black@stable
with:
options: "--check --verbose"
continue-on-error: true

- name: Create PR
uses: peter-evans/create-pull-request@v5
if : ${{ steps.black-check.outcome == 'failure' }}
with:
commit-message: black formatting
title: Black formatting
body: Reformatting code with black style
branch: black-formatting
9 changes: 7 additions & 2 deletions .github/workflows/io-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ jobs:
key: ${{ runner.os }}-datasets-${{ steps.ephy_testing_data.outputs.dataset_hash }}
restore-keys: ${{ runner.os }}-datasets-

- uses: conda-incubator/setup-miniconda@v2.2.0
- uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: neo-test-env
python-version: ${{ matrix.python-version }}
python-version: "${{ matrix.python-version }}"

- name: Get current dependencies hash
id: dependencies
Expand Down Expand Up @@ -81,6 +81,11 @@ jobs:
git config --global user.email "neo_ci@fake_mail.com"
git config --global user.name "neo CI"
- name: Python version
run: |
which python
python --version
- name: Install neo including dependencies
# installation with dependencies is only required if no cache was found
# restore-key hits should result in `cache-hit` == 'false'
Expand Down
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ test = [
"coverage",
"coveralls",
"pillow",
"sonpy",
"sonpy;python_version<'3.10'",
"pynwb",
"probeinterface",
"zugbruecke>=0.2",
Expand All @@ -84,7 +84,8 @@ docs = [

dev = [
"build",
"twine"
"twine",
"black"
]

igorproio = ["igor2"]
Expand Down Expand Up @@ -125,3 +126,7 @@ all = [
"zugbruecke>=0.2; sys_platform!='win32'",
]
# we do not include 'stfio' in 'all' as it is not pip installable


[tool.black]
line-length = 120

0 comments on commit e7ae042

Please sign in to comment.