-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #51 from hubmapconsortium/phillips/formatting
Adding black, isort, flake8
- Loading branch information
Showing
21 changed files
with
483 additions
and
320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[flake8] | ||
extend-ignore = E203,E501,W503 | ||
max-line-length = 99 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Linters | ||
|
||
on: | ||
push: | ||
pull_request: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10"] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install flake8 black isort | ||
- name: Flake8 Lint | ||
run: | | ||
flake8 --ignore=E501,W503,E203 . | ||
- name: Black Lint | ||
run: | | ||
black --line-length 99 --check --verbose . | ||
- name: isort Lint | ||
run: | | ||
isort --profile black --check-only --diff . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -105,6 +105,7 @@ celerybeat.pid | |
|
||
# Environments | ||
.env | ||
.envrc | ||
.venv | ||
env/ | ||
venv/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,58 @@ | ||
# ingest-validation-tests | ||
|
||
This repository contains plug-in tests for use during validation of submissions. It is referenced by ingest-validation-tools. | ||
This repository contains plug-in tests for use during validation of submissions. It is referenced by ingest-validation-tools. | ||
|
||
## Development process | ||
|
||
### Branches | ||
|
||
- Make new feature branches from `devel`. | ||
- Before submitting a PR, make sure your code is black, isort, and flake8 compliant. Run the following from the base `ingest-validation-tests` directory: | ||
|
||
``` | ||
black --line-length 99 . | ||
isort --profile black --multi-line 3 . | ||
flake8 | ||
``` | ||
|
||
(Integrating black and potentially isort/flake8 with your editor may allow you to skip this step, see Setup section below.) | ||
|
||
- Make PRs to `devel`. (This is the default branch.) | ||
- The last reviewer to approve a PR should merge it. At the moment that is likely to be @jswelling . | ||
- The last reviewer to approve a PR should merge it. | ||
|
||
### Setup | ||
|
||
- Creating and activating a virtual environment is recommended. These instructions assume you are using a virtual environment. Example using venv: | ||
|
||
``` | ||
python3.9 -m venv hm-ingest-validation-tests | ||
source hm-ingest-validation-tests/bin/activate | ||
``` | ||
|
||
- Run `pip install -r requirements-dev.txt` | ||
- (optional) Integrate black with your editor. | ||
- [Instructions for black.](https://black.readthedocs.io/en/stable/integrations/editors.html) | ||
- (optional) Integrate [isort](https://pycqa.github.io/isort/) with your editor. | ||
- (optional) Integrate [flake8](https://flake8.pycqa.org/en/latest/index.html) with your editor. | ||
|
||
### Testing | ||
|
||
- If ingest-validation-tools is not already set up: | ||
|
||
``` | ||
# Starting from ingest-validation-tests... | ||
cd .. | ||
git clone https://github.com/hubmapconsortium/ingest-validation-tools.git | ||
cd ingest-validation-tests | ||
pip install -r ../ingest-validation-tools/requirements.txt | ||
pip install -r ../ingest-validation-tools/requirements-dev.txt | ||
``` | ||
|
||
- If ingest-validation-tools is already set up, add the appropriate ingest-validation-tools path and run: | ||
|
||
``` | ||
pip install -r <path-to-ingest-validation-tools>/requirements.txt | ||
pip install -r <path-to-ingest-validation-tools>/requirements-dev.txt | ||
``` | ||
|
||
- Run `test.sh` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[tool.black] | ||
line-length = 99 | ||
|
||
[tool.isort] | ||
profile = "black" | ||
multi_line_output = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
black==23.12.1 | ||
flake8==7.0.0 | ||
git+https://github.com/hubmapconsortium/fastq-utils.git@v0.2.5#egg=hubmap-fastq-utils | ||
imagecodecs>=2023.3.16 | ||
isort==5.13.2 | ||
jsonschema==4.4.0 | ||
pandas>=1.2.0 | ||
pytest==8.0.0 | ||
python-frontmatter>=1.0.0 | ||
tifffile==2020.10.1 | ||
xmlschema>=1.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
from os import cpu_count | ||
from typing import List | ||
|
||
from ingest_validation_tools.plugin_validator import Validator | ||
from fastq_validator_logic import FASTQValidatorLogic, _log | ||
from ingest_validation_tools.plugin_validator import Validator | ||
|
||
|
||
class FASTQValidator(Validator): | ||
description = "Check FASTQ files for basic syntax and consistency." | ||
cost = 15.0 | ||
|
||
def collect_errors(self, **kwargs) -> List[str]: | ||
threads = kwargs.get('coreuse', None) or cpu_count() // 4 or 1 | ||
_log(f'Threading at {threads}') | ||
threads = kwargs.get("coreuse", None) or cpu_count() // 4 or 1 | ||
_log(f"Threading at {threads}") | ||
validator = FASTQValidatorLogic(verbose=True) | ||
validator.validate_fastq_files_in_path(self.paths, threads) | ||
return validator.errors |
Oops, something went wrong.