Skip to content

Commit

Permalink
Merge pull request #1 from nishaq503/dev
Browse files Browse the repository at this point in the history
Added github workflows and pre-commit hooks
  • Loading branch information
Nicholas-Schaub authored Feb 1, 2024
2 parents 4abfa6a + 46b8698 commit 804629d
Show file tree
Hide file tree
Showing 5 changed files with 154 additions and 2 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/tool-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Tool Release

on:
push:
branches:
- master
- main
- dev

permissions:
contents: write

jobs:
tools-release:
name: Call workflow from image-tools
if: github.repository == 'polusai/tabular-tools'
uses: polusai/image-tools/.github/workflows/package-release.yml
with:
repo_name: "tabular-tools"
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }}
27 changes: 27 additions & 0 deletions .github/workflows/tool-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Package tests

on:
pull_request:
branches:
- main
- master
- dev
push:
branches-ignore:
- main
- master
- dev

permissions:
contents: read

jobs:
tools-tests:
name: Call workflow from image-tools
if: github.repository == 'polusai/tabular-tools'
uses: polusai/image-tools/.github/workflows/tests.yml
with:
repo_name: "tabular-tools"
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }}
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ ipython_config.py
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock
poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
Expand Down Expand Up @@ -157,4 +157,4 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
.idea/
52 changes: 52 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
fail_fast: true

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-added-large-files
- id: check-case-conflict
- id: check-json
- id: pretty-format-json
args:
- "--autofix"
- "--indent=2"
- "--no-sort-keys"
- id: check-toml
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: detect-aws-credentials
args:
- "--allow-missing-credentials"
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
description: Forces to replace line ending by the UNIX 'lf' character.
- id: trailing-whitespace
exclude: '.bumpversion.cfg'
- id: check-merge-conflict

- repo: https://github.com/psf/black
rev: '23.3.0'
hooks:
- id: black
language_version: python3.9
exclude: ^src\/polus\/plugins\/_plugins\/models\/\w*Schema.py$

- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.274'
hooks:
- id: ruff
exclude: ^src\/polus\/plugins\/_plugins\/models\/\w*Schema.py$
args: [--fix]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: 'v1.4.0'
hooks:
- id: mypy
exclude: ^src\/polus\/plugins\/_plugins\/models\/\w*Schema.py$
additional_dependencies: [types-requests==2.31.0.1]
51 changes: 51 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
select = [
"F", # pyflakes
"E", # pycodestyle errors
"W", # pycodestyle warnings
"C90", # mccabe
"I", # isort
"N", # pep8-naming
"D", # pydocstyle
"UP", # pyupgrade
"ANN", # flake8-annotations
"S", # flake8-bandit
"BLE", # flake8-blind-except
"B", # flake8-bugbear
"A", # flake8-builtins
"COM", # flake8-commas
"C4", # flake8-comprehensions
"EM", # flake8-errmsg
"INP", # flake8-no-pep420
"T20", # flake8-print
"PYI", # flake8-pyi, type-hinting stub files
"PT", # flake8-pytest-style
"RSE", # flake8-raise
"RET", # flake8-return
"SIM", # flake8-simplify
"ARG", # flake8-unused-arguments
"ERA", # flake8-eradicate
"PTH", # flake8-use-pathlib
"PL", # pylint
"FLY", # flynt
"NPY", # NumPy-specific rules
"RUF", # Ruff-specific rules
]
ignore = ["ANN101", "ANN102"]
unfixable = ["B"] # Avoid trying to fix flake8-bugbear violations.
target-version = "py39" # Assume Python 3.9.

[mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 12

[pydocstyle]
convention = "google"

# Ignore `F401` (unused import violations) in all `__init__.py` files.
[per-file-ignores]
"__init__.py" = ["F401"]
"__main__.py" = ["B008", "S101"]
"./**/tests/*.py" = ["S101"] # Use of assert detected.

[isort]
force-single-line = true

0 comments on commit 804629d

Please sign in to comment.