Skip to content

Commit

Permalink
Feat/use black lint (#716)
Browse files Browse the repository at this point in the history
* blacklinter

* format with black

* add black to dev list

* black

* more formatting

* python version to 3.7.9

* fix python version

* remove python matrix

* remove container workflows temporarily

* remove fixed version for pip

* changelog

* fix black version

* lock black linter version in action

* black lint it

* install dev requirments after installing balsamic

* pytest dev install as its own step

* unique name for pytest step

* bring back container workflows

* review comments

* update docs
  • Loading branch information
hassanfa authored Aug 25, 2021
1 parent 5b0a4b4 commit a629fc3
Show file tree
Hide file tree
Showing 53 changed files with 2,476 additions and 2,246 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/black_linter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Black linter and code formatter
on: [pull_request]
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.7'
- uses: psf/black@stable
with:
options: "--check --verbose"
version: "21.7b0"
11 changes: 7 additions & 4 deletions .github/workflows/pytest_and_coveralls.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ jobs:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
python-version: [3.6]
steps:
# Checkout BALSAMIC
- name: Git checkout
Expand All @@ -33,15 +31,20 @@ jobs:
with:
activate-environment: balsamic
environment-file: BALSAMIC/conda/balsamic.yaml
python-version: ${{ matrix.python-version }}
# Install BALSAMIC
- name: Install BALSAMIC
id: install_balsamic
shell: bash -l {0}
run: |
conda activate balsamic
pip install --no-cache-dir .
# Install pytest coveralls dependencies
- name: Install PyTest and Coveralls
id: install_pytest
shell: bash -l {0}
run: |
conda activate balsamic
pip install --no-cache-dir -r requirements-dev.txt
pip install .
# Run PyTest
- name: Run PyTest
id: pytest
Expand Down
240 changes: 0 additions & 240 deletions .style.yapf

This file was deleted.

2 changes: 1 addition & 1 deletion BALSAMIC/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '7.2.6'
__version__ = "7.2.6"
2 changes: 1 addition & 1 deletion BALSAMIC/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '7.2.6'
__version__ = "7.2.6"
4 changes: 2 additions & 2 deletions BALSAMIC/assets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

##### FILES #####

cg_logo = 'assets/cg.png'
cg_logo = "assets/cg.png"

##### Paths #####

cg_logo_path = pkg_resources.resource_filename('BALSAMIC', cg_logo)
cg_logo_path = pkg_resources.resource_filename("BALSAMIC", cg_logo)
48 changes: 21 additions & 27 deletions BALSAMIC/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,48 +19,42 @@
from BALSAMIC import __version__

LOG = logging.getLogger(__name__)
LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
LOG_LEVELS = ["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]


@click.group()
@click.option('--loglevel',
default='DEBUG',
type=click.Choice(LOG_LEVELS),
help="Set the level of log output.",
show_default=True)
@click.option(
"--loglevel",
default="DEBUG",
type=click.Choice(LOG_LEVELS),
help="Set the level of log output.",
show_default=True,
)
@click.version_option(version=__version__)
@click.pass_context
@doc("""BALSAMIC {version}: Bioinformatic Analysis pipeLine for
SomAtic MutatIons in Cancer""".format(version=__version__))
@doc(
"""BALSAMIC {version}: Bioinformatic Analysis pipeLine for
SomAtic MutatIons in Cancer""".format(
version=__version__
)
)
def cli(context, loglevel):
"BALSAMIC"
coloredlogs.DEFAULT_FIELD_STYLES = {
'asctime': {
'color': 'green'
},
'hostname': {
'color': 'magenta'
},
'levelname': {
'color': 'yellow',
'bold': True
},
'programname': {
'color': 'cyan'
},
'name': {
'color': 'blue'
}
"asctime": {"color": "green"},
"hostname": {"color": "magenta"},
"levelname": {"color": "yellow", "bold": True},
"programname": {"color": "cyan"},
"name": {"color": "blue"},
}
coloredlogs.install(
level=loglevel,
fmt=
'%(programname)s %(hostname)s %(asctime)s %(name)s pid:%(process)d [%(levelname)s] %(message)s'
fmt="%(programname)s %(hostname)s %(asctime)s %(name)s pid:%(process)d [%(levelname)s] %(message)s",
)
LOG.info("Running BALSAMIC version %s", __version__)

context.obj = {}
context.obj['loglevel'] = loglevel
context.obj["loglevel"] = loglevel
# LOG.info(f"BALSAMIC started with log level {loglevel}.")


Expand Down
1 change: 1 addition & 0 deletions BALSAMIC/commands/config/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from BALSAMIC.commands.config.case import case_config as case_command
from BALSAMIC.commands.config.pon import pon_config as pon_command


@click.group()
@click.pass_context
def config(context):
Expand Down
Loading

0 comments on commit a629fc3

Please sign in to comment.