Skip to content

Commit 3b80b48

Browse files
committed
Switch to flit
This reverts commit d645790
1 parent d205474 commit 3b80b48

File tree

10 files changed

+150
-141
lines changed

10 files changed

+150
-141
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ __pycache__/
3333
/scanpy.egg-info/
3434
/*-env/
3535
/env-*/
36+
/setup.py
3637

3738
# OS stuff
3839
.DS_Store

.travis.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ matrix:
1212
script:
1313
- black . --check --diff
1414
- python -m scanpy.tests.blackdiff 10
15-
- python setup.py check --restructuredtext --strict
1615
- rst2html.py --halt=2 README.rst >/dev/null
1716
after_success: skip
1817
- name: "anndata dev"

MANIFEST.in

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import os
22
import sys
3-
import warnings
43
from pathlib import Path
54
from datetime import datetime
65

docs/installation.rst

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ If you do not have a working installation of Python 3.6 (or later), consider
77
installing Miniconda_ (see `Installing Miniconda`_). Then run::
88

99
conda install seaborn scikit-learn statsmodels numba pytables
10-
conda install -c conda-forge python-igraph leidenalg
10+
conda install -c conda-forge python-igraph leidenalg
1111

1212
Pull Scanpy from `PyPI <https://pypi.org/project/scanpy>`__ (consider using ``pip3`` to access Python 3)::
1313

@@ -33,10 +33,27 @@ To work with the latest version `on GitHub`_: clone the repository and `cd` into
3333
its root directory. To install using symbolic links (stay up to date with your
3434
cloned version after you update with `git pull`) call::
3535

36-
pip install -e .
36+
flit install -s # from an activated venv or conda env
37+
# or
38+
flit install -s --python path/to/venv/bin/python
3739

3840
.. _on GitHub: https://github.com/theislab/scanpy
3941

42+
If you want to let conda_ handle the installations of dependencies, do::
43+
44+
pip install beni
45+
beni pyproject.toml > environment.yml
46+
conda env create -f environment.yml
47+
conda activate scanpy
48+
flit install -s
49+
50+
On Windows, you might have to use `flit install --pth-file`
51+
if you are not able to give yourself the `create symbolic links`_ privilege.
52+
Be aware that a `conda bug`_ might prevent `conda list` from working then.
53+
54+
.. _create symbolic links: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links
55+
.. _conda bug: https://github.com/conda/conda/issues/9074
56+
4057
Docker
4158
~~~~~~
4259
If you're using Docker_, you can use the minimal `fastgenomics/scanpy`_ image from the Docker Hub.
@@ -71,6 +88,8 @@ Download those and install them using `pip install ./path/to/file.whl`
7188
.. _compiling igraph: https://stackoverflow.com/q/29589696/247482
7289
.. _unofficial binaries: https://www.lfd.uci.edu/~gohlke/pythonlibs/
7390

91+
.. _conda:
92+
7493
Installing Miniconda
7594
~~~~~~~~~~~~~~~~~~~~
7695
After downloading Miniconda_, in a unix shell (Linux, Mac), run

pyproject.toml

Lines changed: 97 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,104 @@
11
[build-system]
2-
requires = ['setuptools', 'setuptools_scm', 'wheel', 'pytoml']
3-
build-backend = 'setuptools.build_meta'
2+
build-backend = 'flit_core.buildapi'
3+
requires = [
4+
'flit_core >=2,<4',
5+
'setuptools_scm',
6+
'pytoml',
7+
'importlib_metadata>=0.7; python_version < "3.8"',
8+
]
49

5-
# uses the format of tool.flit.metadata because we’ll move to it anyway
6-
[tool.scanpy]
7-
author = '''
8-
Alex Wolf, Philipp Angerer, Fidel Ramirez, Isaac Virshup,
9-
Sergei Rybakov, Gokcen Eraslan, Tom White, Malte Luecken,
10-
Davide Cittaro, Tobias Callies, Marius Lange, Andrés R. Muñoz-Rojas
11-
'''
10+
[tool.flit.metadata]
11+
module = 'scanpy'
12+
author = 'Alex Wolf, Philipp Angerer, Fidel Ramirez, Isaac Virshup, Sergei Rybakov, Gokcen Eraslan, Tom White, Malte Luecken, Davide Cittaro, Tobias Callies, Marius Lange, Andrés R. Muñoz-Rojas'
1213
# We don’t need all emails, the main authors are sufficient.
1314
author-email = 'f.alex.wolf@gmx.de, philipp.angerer@helmholtz-muenchen.de'
15+
description-file = 'README.rst'
16+
home-page = 'http://github.com/theislab/scanpy'
17+
urls = { Documentation = 'https://scanpy.readthedocs.io/' }
18+
classifiers = [
19+
'License :: OSI Approved :: BSD License',
20+
'Development Status :: 5 - Production/Stable',
21+
'Environment :: Console',
22+
'Framework :: Jupyter',
23+
'Intended Audience :: Developers',
24+
'Intended Audience :: Science/Research',
25+
'Natural Language :: English',
26+
'Operating System :: MacOS :: MacOS X',
27+
'Operating System :: Microsoft :: Windows',
28+
'Operating System :: POSIX :: Linux',
29+
'Programming Language :: Python :: 3',
30+
'Programming Language :: Python :: 3.6',
31+
'Programming Language :: Python :: 3.7',
32+
'Topic :: Scientific/Engineering :: Bio-Informatics',
33+
'Topic :: Scientific/Engineering :: Visualization',
34+
]
35+
requires-python = '>=3.6'
36+
requires = [
37+
'anndata>=0.7.4',
38+
# numpy needs a version due to #1320
39+
'numpy>=1.17.0',
40+
# Matplotlib 3.1 causes an error in 3d scatter plots (https://github.com/matplotlib/matplotlib/issues/14298)
41+
# But matplotlib 3.0 causes one in heatmaps
42+
'matplotlib>=3.1.2',
43+
'pandas>=0.21',
44+
'scipy>=1.4',
45+
'seaborn',
46+
'h5py>=2.10.0',
47+
'tables',
48+
'tqdm',
49+
'scikit-learn>=0.21.2',
50+
'statsmodels>=0.10.0rc2',
51+
'patsy',
52+
'networkx>=2.3',
53+
'natsort',
54+
'joblib',
55+
'numba>=0.41.0',
56+
'umap-learn>=0.3.10',
57+
'legacy-api-wrap',
58+
'packaging',
59+
'sinfo',
60+
# for getting the stable version
61+
'importlib_metadata>=0.7; python_version < "3.8"',
62+
]
63+
64+
[tool.flit.metadata.requires-extra]
65+
louvain = ['python-igraph', 'louvain>=0.6,!=0.6.2']
66+
leiden = ['python-igraph', 'leidenalg']
67+
bbknn = ['bbknn']
68+
scvi = ['scvi>=0.6.5']
69+
rapids = ['cudf>=0.9', 'cuml>=0.9', 'cugraph>=0.9']
70+
magic = ['magic-impute>=2.0']
71+
skmisc = ['scikit-misc>=0.1.3']
72+
harmony = ['harmonypy']
73+
dev = [
74+
# getting the dev version
75+
'setuptools_scm',
76+
'pytoml',
77+
# static checking
78+
'black>=20.8b1',
79+
'docutils',
80+
]
81+
doc = [
82+
'sphinx<3.1, >3',
83+
'sphinx-rtd-theme>=0.3.1',
84+
'sphinx-autodoc-typehints',
85+
'scanpydoc>=0.5',
86+
'typing_extensions; python_version < "3.8"', # for `Literal`
87+
]
88+
test = [
89+
'pytest>=4.4',
90+
'dask[array]!=2.17.0',
91+
'fsspec',
92+
'zappy',
93+
'zarr',
94+
'profimp',
95+
]
96+
97+
[tool.flit.scripts]
98+
scanpy = 'scanpy.cli:console_main'
99+
100+
[tool.flit.sdist]
101+
exclude = ['scanpy/tests']
14102

15103
[tool.pytest.ini_options]
16104
python_files = 'test_*.py'

requirements.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

scanpy/__init__.py

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
"""Single-Cell Analysis in Python."""
22

3-
from ._metadata import __version__, __author__, __email__
3+
from ._metadata import __version__, __author__, __email__, within_flit
44

5-
from ._utils import check_versions
6-
check_versions()
7-
del check_versions
5+
if not within_flit():
6+
from ._utils import check_versions
7+
check_versions()
8+
del check_versions, within_flit
89

9-
# the actual API
10-
from ._settings import settings, Verbosity # start with settings as several tools are using it
11-
from . import tools as tl
12-
from . import preprocessing as pp
13-
from . import plotting as pl
14-
from . import datasets, logging, queries, external, get
10+
# the actual API
11+
from ._settings import settings, Verbosity # start with settings as several tools are using it
12+
from . import tools as tl
13+
from . import preprocessing as pp
14+
from . import plotting as pl
15+
from . import datasets, logging, queries, external, get
1516

16-
from anndata import AnnData, concat
17-
from anndata import read_h5ad, read_csv, read_excel, read_hdf, read_loom, read_mtx, read_text, read_umi_tools
18-
from .readwrite import read, read_10x_h5, read_10x_mtx, write, read_visium
19-
from .neighbors import Neighbors
17+
from anndata import AnnData, concat
18+
from anndata import read_h5ad, read_csv, read_excel, read_hdf, read_loom, read_mtx, read_text, read_umi_tools
19+
from .readwrite import read, read_10x_h5, read_10x_mtx, write, read_visium
20+
from .neighbors import Neighbors
2021

21-
set_figure_params = settings.set_figure_params
22+
set_figure_params = settings.set_figure_params
2223

23-
# has to be done at the end, after everything has been imported
24-
import sys
25-
sys.modules.update({f'{__name__}.{m}': globals()[m] for m in ['tl', 'pp', 'pl']})
26-
from ._utils import annotate_doc_types
27-
annotate_doc_types(sys.modules[__name__], 'scanpy')
28-
del sys, annotate_doc_types
24+
# has to be done at the end, after everything has been imported
25+
import sys
26+
sys.modules.update({f'{__name__}.{m}': globals()[m] for m in ['tl', 'pp', 'pl']})
27+
from ._utils import annotate_doc_types
28+
annotate_doc_types(sys.modules[__name__], 'scanpy')
29+
del sys, annotate_doc_types

scanpy/_metadata.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import traceback
12
from pathlib import Path
23

34
here = Path(__file__).parent
@@ -7,7 +8,7 @@
78
import pytoml
89

910
proj = pytoml.loads((here.parent / 'pyproject.toml').read_text())
10-
metadata = proj['tool']['scanpy']
11+
metadata = proj['tool']['flit']['metadata']
1112

1213
__version__ = get_version(root='..', relative_to=__file__)
1314
__author__ = metadata['author']
@@ -19,3 +20,10 @@
1920
__version__ = metadata['Version']
2021
__author__ = metadata['Author']
2122
__email__ = metadata['Author-email']
23+
24+
25+
def within_flit():
26+
for frame in traceback.extract_stack():
27+
if frame.name == 'get_docstring_and_version_via_import':
28+
return True
29+
return False

setup.py

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)