Skip to content

Commit

Permalink
Merge pull request #34 from SciLifeLab/master
Browse files Browse the repository at this point in the history
Version sync
  • Loading branch information
chuan-wang authored Mar 15, 2024
2 parents 9bc03f8 + 6d7d339 commit 2eb4fd0
Show file tree
Hide file tree
Showing 108 changed files with 151,231 additions and 1,081 deletions.
9 changes: 5 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
"context": "..",
// Update the 'dockerFile' property if you aren't using the standard 'Dockerfile' filename.
"dockerfile": "../Dockerfile",
"target": "base"
},
"features": {},
"customizations": {
"vscode": {
"extensions": ["ms-python.python"],
},
"extensions": ["ms-python.python", "eamodio.gitlens"]
}
},
// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},
Expand All @@ -24,6 +25,6 @@
// Uncomment to connect as an existing user other than the container default. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "devcontainer"
"mounts": [
"source=${localEnv:HOME}/repos/flowcell_parser,target=/workspaces/flowcell_parser,type=bind,consistency=cached",
],
"source=${localEnv:HOME}/repos/flowcell_parser,target=/workspaces/flowcell_parser,type=bind,consistency=cached"
]
}
2 changes: 1 addition & 1 deletion .github/workflows/lint-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ jobs:
run: pip install -r requirements.txt

- name: Run pipreqs
run: pipreqs --savepath pipreqs.txt
run: pipreqs --savepath pipreqs.txt taca

- name: Compare requirements
run: |
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/test-code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Test code
on: [push, pull_request]

jobs:
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Install TACA
run: pip install -e .
- name: pytest
# Options are configured in pyproject.toml
run: pytest
- name: CodeCov
run: |
# Replace `linux` below with the appropriate OS
# Options are `alpine`, `linux`, `macos`, `windows`
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
./codecov -t ${{ secrets.CODECOV_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ __pycache__
.vscode
.ruff_cache
.mypy_cache
node_modules
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ repos:
rev: "v1.7.1"
hooks:
- id: mypy
additional_dependencies: [types-PyYAML]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v4.0.0-alpha.8"
hooks:
Expand Down
15 changes: 10 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM python:3.10
FROM python:3.10 AS base

# Update pip to latest version
RUN python -m pip install --upgrade pip


# Install Nextflow dependencies
# Install dependencies
RUN apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y git \
&& apt-get install -y curl
&& apt-get install -y curl \
&& apt-get install -y rsync

# Needed to install requirements,
# in devcontainer a local mounted version of flowcell_parser is used
Expand All @@ -25,3 +24,9 @@ RUN python -m pip install -r requirements-dev.txt

RUN mkdir /root/.taca/
COPY tests/data/taca_test_cfg.yaml /root/.taca/taca.yaml

FROM base AS testing
COPY . /taca
RUN python -m pip install -e /taca
WORKDIR /taca/tests
CMD ["python", "-m", "unittest"]
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@

This package contains several tools for projects and data management in the [National Genomics Infrastructure](https://ngisweden.scilifelab.se/) in Stockholm, Sweden.

### Run tests in docker

```shell
git clone https://github.com/SciLifeLab/TACA.git
cd TACA
docker build -t taca_testing --target testing .
docker run -it taca_testing
```

## Installation

Inside the repo, run `pip install .`
Expand Down
20 changes: 20 additions & 0 deletions VERSIONLOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
# TACA Version Log

## 20240304.1

- Make sure TACA can handle runs that generate NO sequencing data at all
- Refactor logic of control function to reduce complexity
- Introduce custom Exception for quiet skipping (waiting on) runs
- Improve documentation
- Minor polishing of test to pass

## 20240229.1

Increase test coverage to 20%.

## 20240209.1

Implement CodeCoverage in CI.

## 20240208.2

Implement CI testing and increase testing coverage.

## 20240208.1

Fix bug with isinstance clause
Expand Down
34 changes: 26 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,27 +1,45 @@
title = "taca"

# === LINTING ================================================================

[tool.ruff]
exclude = ["tests_old/**"]

[tool.ruff.lint]
select =[
select = [
# Ruff default rules
# ------------------------------
"E4", # pycodestyle Imports
"E7", # pycodestyle Statements
"E9", # pycodestyle Runtime
"F", # Pyflakes
"E4", # pycodestyle Imports
"E7", # pycodestyle Statements
"E9", # pycodestyle Runtime
"F", # Pyflakes

# Additional Comment
# ------------------------------------------------------
"I", # isort Best-practice sorting of imports
"UP", # pyupgrade Make sure syntax is up-to-date
"I", # isort Best-practice sorting of imports
"UP", # pyupgrade Make sure syntax is up-to-date
]
ignore = [
"E402", # Module level import not at top of file
"E722", # Do not use bare 'except'
"E741", # Ambiguous variable name
]


[tool.mypy]
ignore_missing_imports = true
follow_imports = 'skip'

# === Testing ================================================================

[tool.pytest.ini_options]
# Omit deprecation warnings from 3rd party packages
filterwarnings = [
'ignore::DeprecationWarning:couchdb.*',
'ignore::DeprecationWarning:pkg_resources.*',
]
addopts = "--cov=./taca --cov-report term-missing -vv --cache-clear tests/"

[tool.coverage.run]
# The comment "# pragma: no cover" can be used to exclude a line from coverage
source = ["taca"]
omit = ["**/__init__.py"]
1 change: 1 addition & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ mock
sphinx
sphinx-rtd-theme
pytest
pytest-cov
ipython
ipdb
ruff
Expand Down
2 changes: 0 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ PyYAML
click
flowcell_parser @ git+https://github.com/SciLifeLab/flowcell_parser
pandas
pytest
python_crontab
python_dateutil
setuptools
sphinx_rtd_theme
3 changes: 1 addition & 2 deletions taca/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
""" Main TACA module
"""
"""Main TACA module"""

__version__ = "1.0.0"
14 changes: 6 additions & 8 deletions taca/analysis/analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Analysis methods for TACA."""

import glob
import logging
import os
Expand All @@ -19,14 +20,11 @@
logger = logging.getLogger(__name__)


def get_runObj(run, software):
def get_runObj(
run: os.PathLike, software: str
) -> MiSeq_Run | NextSeq_Run | NovaSeq_Run | NovaSeqXPlus_Run | None:
"""Tries to read runParameters.xml to parse the type of sequencer
and then return the respective Run object (MiSeq, HiSeq..)
:param run: run name identifier
:type run: string
:returns: returns the sequencer type object,
None if the sequencer type is unknown of there was an error
and then return the respective Run object (MiSeq, HiSeq..)
"""

if os.path.exists(os.path.join(run, "runParameters.xml")):
Expand All @@ -37,7 +35,7 @@ def get_runObj(run, software):
logger.error(
f"Cannot find RunParameters.xml or runParameters.xml in the run folder for run {run}"
)
return
return None

run_parameters_path = os.path.join(run, run_parameters_file)
try:
Expand Down
Loading

0 comments on commit 2eb4fd0

Please sign in to comment.