diff --git a/README.md b/README.md index 5109e629..49d97740 100644 --- a/README.md +++ b/README.md @@ -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** diff --git a/server/app/app.py b/server/app/app.py index e51f39d0..7a0f8915 100644 --- a/server/app/app.py +++ b/server/app/app.py @@ -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)", diff --git a/server/test/test_api.py b/server/test/test_api.py index 9a22c64d..eae5ee6e 100644 --- a/server/test/test_api.py +++ b/server/test/test_api.py @@ -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: