mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-09-23 04:28:12 +08:00
CLI improvements (#221)
* CLI improvements * Circumvent apparent bug with subparsers.required
This commit is contained in:
committed by
Charlotte Weaver
parent
187bbfdcf7
commit
8674ad1f7f
@@ -0,0 +1,12 @@
|
||||
# Work around bug https://github.com/pallets/werkzeug/issues/461
|
||||
if __package__ is None:
|
||||
import sys
|
||||
from pathlib import Path
|
||||
PKG_PATH = Path(__file__).parent
|
||||
sys.path.insert(0, str(PKG_PATH.parent))
|
||||
import server
|
||||
__package__ = PKG_PATH.name
|
||||
|
||||
# Main thing
|
||||
from .app.app import main
|
||||
main()
|
||||
+5
-1
@@ -73,12 +73,16 @@ def main():
|
||||
"--bind-all",
|
||||
help="Bind to all interfaces (this makes the server accessible beyond this computer)",
|
||||
action="store_true")
|
||||
subparsers = parser.add_subparsers(dest="cellxgene_command")
|
||||
subparsers = parser.add_subparsers(dest="engine")
|
||||
subparsers.required = True
|
||||
try:
|
||||
from .scanpy_engine.scanpy_engine import ScanpyEngine
|
||||
except ImportError:
|
||||
warnings.simplefilter('default', ImportWarning) # Enable ImportWarning
|
||||
warnings.warn("Scanpy engine not available", ImportWarning)
|
||||
else:
|
||||
ScanpyEngine.add_to_parser(subparsers, run_scanpy)
|
||||
if len(subparsers.choices) == 0:
|
||||
raise ImportError('Could not import any engines, see warnings above')
|
||||
args = parser.parse_args()
|
||||
args.func(args)
|
||||
|
||||
Reference in New Issue
Block a user