Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract prepare from main install #887

Merged
merged 2 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
5 changes: 0 additions & 5 deletions server/cli/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
38 changes: 22 additions & 16 deletions server/cli/prepare.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@
"--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.

Expand All @@ -65,10 +65,16 @@ def prepare(

# collect slow imports here to make CLI startup more responsive
click.echo("[cellxgene] Starting CLI...")
import matplotlib

matplotlib.use("Agg")
import scanpy as sc
try:
import matplotlib

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
Expand Down
1 change: 1 addition & 0 deletions server/requirements-prepare.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
scanpy>=1.3.7
4 changes: 0 additions & 4 deletions server/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 4 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
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",
Expand Down Expand Up @@ -36,5 +39,5 @@
"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"]),
)