extract prepare from main install (#887)

* extract prepare from main install

* add requirements-prepare to manifest
This commit is contained in:
Charlotte Weaver
2019-08-21 14:26:01 -07:00
committed by GitHub
parent b8c05763fe
commit 28c4d28308
6 changed files with 28 additions and 26 deletions

View File

@@ -1,4 +1,5 @@
recursive-include server/app/web/templates *
recursive-include server/app/web/static *
include server/requirements.txt
include server/requirements.txt
include server/requirements-prepare.txt

View File

@@ -185,11 +185,6 @@ def launch(
else:
click.echo(f"[cellxgene] Loading data from {basename(data)}.")
# Fix for anaconda python. matplotlib typically expects python to be installed as a framework TKAgg is usually
# available and fixes this issue. See https://matplotlib.org/faq/virtualenv_faq.html
import matplotlib as mpl
mpl.use("TkAgg")
from server.app.scanpy_engine.scanpy_engine import ScanpyEngine
try:

View File

@@ -41,18 +41,18 @@ from scipy.sparse.csc import csc_matrix
"--make-var-names-unique", default=True, is_flag=True, help="Ensure var index is unique.", show_default=True
)
def prepare(
data,
layout,
recipe,
output,
plotting,
sparse,
overwrite,
set_obs_names,
set_var_names,
run_qc,
make_obs_names_unique,
make_var_names_unique,
data,
layout,
recipe,
output,
plotting,
sparse,
overwrite,
set_obs_names,
set_var_names,
run_qc,
make_obs_names_unique,
make_var_names_unique,
):
"""Preprocesses data for use with cellxgene.
@@ -65,10 +65,16 @@ def prepare(
# collect slow imports here to make CLI startup more responsive
click.echo("[cellxgene] Starting CLI...")
import matplotlib
try:
import matplotlib
matplotlib.use("Agg")
import scanpy as sc
matplotlib.use("Agg")
import scanpy as sc
except ImportError:
raise click.ClickException(
"[cellxgene] cellxgene prepare has not been installed. Please run `pip install cellxgene[prepare]` "
"to install the necessary requirements."
)
# scanpy settings
sc.settings.verbosity = 0

View File

@@ -0,0 +1 @@
scanpy>=1.3.7

View File

@@ -6,11 +6,7 @@ Flask-Compress>=1.4.0
Flask-Cors>=3.0.6
Flask-RESTful>=0.3.6
flatbuffers>=1.10.0
# TODO revert after scanpy updates their dependency on this
matplotlib<3.1
numpy>=1.15.2
pandas>=0.23.1
scanpy>=1.3.7
scipy>=1.1.0
scikit-learn>=0.19.1,!=0.20.0
tables==3.5.1

View File

@@ -6,6 +6,9 @@ with open("README.md", "rb") as fh:
with open("server/requirements.txt") as fh:
requirements = fh.read().splitlines()
with open("server/requirements-prepare.txt") as fh:
requirements_prepare = fh.read().splitlines()
setup(
name="cellxgene",
version="0.11.0",
@@ -36,5 +39,5 @@ setup(
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
entry_points={"console_scripts": ["cellxgene = server.cli.cli:cli"]},
extras_require=dict(louvain=["python-igraph", "louvain>=0.6"], gui=["PySide2>=5.12.3", "cefpython3>=66", "requests"]),
extras_require=dict(prepare=requirements_prepare, louvain=["python-igraph", "louvain>=0.6"], gui=["PySide2>=5.12.3", "cefpython3>=66", "requests"]),
)