Launch browser to cellxgene (#325)

* Launch browser to cellxgene

Also added  --no-launch command line parameter

* Don't launch browser for tests

* rename no-launch to no-open

* Rejigger -no-open to positive destination

so later logic looks cleaner
This commit is contained in:
Charlotte Weaver
2018-10-17 16:46:56 -07:00
committed by GitHub
parent f9f43c42c0
commit 7c8b89eba3
3 changed files with 5 additions and 4 deletions

View File

@@ -42,14 +42,11 @@ Started in the context of the Human Cell Atlas Consortium, cellxgene hopes to bo
**Install server**
pip install -e .
**Run (with demo data)**
cellxgene --title PBMC3K scanpy example-dataset/
*In google chrome, navigate to the viewer via the web address printed in your console.
E.g.,* `Running on http://0.0.0.0:5005/`
**Help**

View File

@@ -1,6 +1,7 @@
import argparse
import os
import warnings
import webbrowser
from flask import Flask
from flask_caching import Cache
@@ -61,6 +62,8 @@ def run_scanpy(args):
host = "0.0.0.0"
else:
host = "127.0.0.1"
if args.open_browser:
webbrowser.open(f"http://{host}:{args.port}")
app.run(host=host, debug=True, port=args.port)
@@ -69,6 +72,7 @@ def main():
parser.add_argument("--title", "-t", help="Title to display -- if this is omitted the title will be the name "
"of the directory from the data_directory arg")
parser.add_argument("--port", help="Port to run server on.", type=int, default=5005)
parser.add_argument("--no-open", help="Do not launch the webbrowser.", action="store_false", dest="open_browser")
parser.add_argument(
"--bind-all",
help="Bind to all interfaces (this makes the server accessible beyond this computer)",

View File

@@ -25,7 +25,7 @@ class EndPoints(unittest.TestCase):
@classmethod
def setUpClass(cls):
cls.ps = Popen(["cellxgene", "scanpy", "example-dataset/"])
cls.ps = Popen(["cellxgene", "--no-open", "scanpy", "example-dataset/"])
session = requests.Session()
for i in range(90):
try: