Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GUI code refactor #82

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ test:

## style: check code style
style:
black --line-length=99 --check *.py lusSTR/scripts/*.py lusSTR/wrappers/*.py lusSTR/tests/test_*.py
black --line-length=99 --check *.py lusSTR/*/*.py

## format: auto-reformat code with Black
format:
black --line-length=99 *.py lusSTR/cli/gui.py lusSTR/scripts/*.py lusSTR/wrappers/*.py lusSTR/tests/test_*.py
black --line-length=99 *.py lusSTR/*/*.py

## devenv: configure a development environment
devenv:
Expand Down
3 changes: 2 additions & 1 deletion lusSTR/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
# -------------------------------------------------------------------------------------------------

import importlib.resources
from lusSTR import cli
from . import cli
from . import gui
from lusSTR._version import get_versions

__version__ = get_versions()["version"]
Expand Down
29 changes: 19 additions & 10 deletions lusSTR/cli/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
import argparse
import importlib.resources
# -------------------------------------------------------------------------------------------------
# Copyright (c) 2024, DHS.
#
# This file is part of lusSTR (http://github.com/bioforensics/lusSTR) and is licensed under
# the BSD license: see LICENSE.txt.
#
# This software was prepared for the Department of Homeland Security (DHS) by the Battelle National
# Biodefense Institute, LLC (BNBI) as part of contract HSHQDC-15-C-00064 to manage and operate the
# National Biodefense Analysis and Countermeasures Center (NBACC), a Federally Funded Research and
# Development Center.
# -------------------------------------------------------------------------------------------------

from argparse import ArgumentParser
from importlib.resources import files
import lusSTR
from lusSTR.cli import config, gui, strs, snps
import streamlit.web.cli as stcli
import sys
import lusSTR
from lusSTR.cli import config
from lusSTR.cli import strs
from lusSTR.cli import snps
from lusSTR.cli import gui

mains = {"config": config.main, "strs": strs.main, "snps": snps.main, "gui": gui.main}
mains = {"config": config.main, "strs": strs.main, "snps": snps.main}

subparser_funcs = {
"config": config.subparser,
Expand All @@ -24,7 +33,7 @@ def main(args=None):
if args.subcmd is None:
get_parser().parse_args(["-h"])
elif args.subcmd == "gui":
gui_path = importlib.resources.files("lusSTR") / "cli" / "gui.py"
gui_path = files("lusSTR") / "cli" / "gui.py"
sys.argv = ["streamlit", "run", str(gui_path)]
sys.exit(stcli.main())
else:
Expand All @@ -34,7 +43,7 @@ def main(args=None):


def get_parser():
parser = argparse.ArgumentParser()
parser = ArgumentParser()
parser.add_argument(
"-v", "--version", action="version", version="lusSTR v" + lusSTR.__version__
)
Expand Down
2 changes: 0 additions & 2 deletions lusSTR/cli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@
# Development Center.
# -------------------------------------------------------------------------------------------------

import argparse
import importlib.resources
import lusSTR
import os
from pathlib import Path
import yaml
Expand Down
Loading