From b5a95b207b37b4e380833f1025357a1aaba930ea Mon Sep 17 00:00:00 2001 From: munfred Date: Sun, 12 Sep 2021 13:03:41 -0700 Subject: [PATCH] Make app callable from commandline by just doing `scdefg` when pip installing. Should be good for pypi now --- scdefg/app.py | 26 +++++--------------------- setup.py | 5 ++++- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/scdefg/app.py b/scdefg/app.py index 4eb8a30..3d4a17f 100644 --- a/scdefg/app.py +++ b/scdefg/app.py @@ -1,5 +1,4 @@ -import os -import time +#! python import warnings from flask import Flask, jsonify, request, render_template, Blueprint import logging @@ -9,18 +8,14 @@ import scvi import numpy as np import plotly.graph_objects as go -import plotly -import time import click -import flask # ignore annoying pandas future warning warnings.simplefilter(action='ignore', category=FutureWarning) print('๐Ÿงฎ ๐Ÿงฌ ๐Ÿ“Š ๐Ÿงซ ๐Ÿงช scdefg: scvi-tools Differential Expression Flask GUI ๐Ÿ“ฑ ๐ŸŽฒ ๐Ÿ“ˆ ๐Ÿฆ  ๐Ÿ“‰ ๐ŸŽฐ') -print('You are using scvi-tools version:', scvi.__version__) -print('You are using flask version:', flask.__version__) -print('You are using plotly version:', plotly.__version__) +print('Using scvi-tools version', scvi.__version__) + # set up logs and flask blueprints logging.basicConfig(level=logging.INFO) @@ -336,17 +331,6 @@ def receive_submission(): return app +print('๐Ÿ’œ Launching... ๐Ÿ’œ') +launch() -if __name__ == '__main__': - print('Starting launch function...') - launch() - -else: - # this code is run if the file is imported as a module - # - # os.environ reads env variables from the system - # APP_SELECTION_COLUMNS is passed as a single variable, so it needs to be split - app = run(scvi_tools_model_path=os.environ["SCVI_TOOLS_MODEL_PATH"], - selection_columns=os.environ["APP_SELECTION_COLUMNS"].split(","), - intro_text_html=os.environ["APP_INTRO_TEXT_HTML"], host=os.environ["APP_HOST"], port=os.environ["APP_PORT"], - run_app=False) diff --git a/setup.py b/setup.py index 730c41c..8328ac5 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ long_description = fh.read() setuptools.setup( name="scdefg", - version="0.2.0", + version="0.3.0", author="Eduardo da Veiga Beltrame", author_email="munfred@brandeis.edu", description="A single page Flask app with GUI for performing differential expression on with scvi-tools.", @@ -17,6 +17,7 @@ license='LICENSE.txt', packages=setuptools.find_packages(), install_requires=requirements, + include_package_data=True, classifiers=[ "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", @@ -26,6 +27,8 @@ "Operating System :: OS Independent", "Topic :: Scientific/Engineering :: Bio-Informatics", ], + entry_points={"console_scripts": ["scdefg = scdefg.app:launch"]}, python_requires='>=3.6', + )