Skip to content

Commit

Permalink
pep-621 pyproject.toml (scverse#2042)
Browse files Browse the repository at this point in the history
* Initial pep-621 commit

* Add content-type to readme

* Update metadata retrieval

* Update `__author__` field usage in docs

It was getting pretty unwieldy and out of date anyways.

* Require flit>=3.4 to allow editable installs

* Update phil’s maintainer email

* update install instructions

* Clean up for install instructions

* Remove setup.py

* Syntax highlighting

Co-authored-by: Philipp A <[email protected]>
  • Loading branch information
ivirshup and flying-sheep authored Dec 6, 2021
1 parent 16e62d1 commit 50f015b
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 198 deletions.
4 changes: 2 additions & 2 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

# General information
project = 'Scanpy'
author = scanpy.__author__
copyright = f'{datetime.now():%Y}, {author}.'
author = 'Scanpy development team'
copyright = f'{datetime.now():%Y}, the Scanpy development team.'
version = scanpy.__version__.replace('.dirty', '')
release = version

Expand Down
49 changes: 37 additions & 12 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,25 @@ Installation
Anaconda
~~~~~~~~
If you do not have a working installation of Python 3.6 (or later), consider
installing Miniconda_ (see `Installing Miniconda`_). Then run::
installing Miniconda_ (see `Installing Miniconda`_). Then run:

.. code:: shell
conda install -c conda-forge scanpy python-igraph leidenalg
Pull Scanpy from `PyPI <https://pypi.org/project/scanpy>`__ (consider using ``pip3`` to access Python 3)::
Pull Scanpy from `PyPI <https://pypi.org/project/scanpy>`__ (consider using ``pip3`` to access Python 3):

.. code:: shell
pip install scanpy
.. _from PyPI: https://pypi.org/project/scanpy

PyPI only
~~~~~~~~~
If you prefer to exclusively use PyPI run::
If you prefer to exclusively use PyPI run:

.. code:: shell
pip install 'scanpy[leiden]'
Expand All @@ -30,17 +36,33 @@ parts of scanpy but aren't requirements: python-igraph_ [Csardi06]_ and leiden_

Development Version
~~~~~~~~~~~~~~~~~~~
To work with the latest version `on GitHub`_: clone the repository and `cd` into
its root directory. To install using symbolic links (stay up to date with your
cloned version after you update with `git pull`) call::
To work with the latest version `on GitHub`_: clone the repository and `cd` into its root directory.

.. code:: shell
gh repo clone theislab/scanpy
cd scanpy
If you are using `pip>=21.3`, an editable install can be made:

.. code:: shell
pip install -e '.[dev,doc,test]'
For older versions of `pip`, flit_ can be used directly.
To install using symbolic links (stay up to date with your cloned version after you update with `git pull`) call:

.. code:: shell
flit install -s --deps=develop # from an activated venv or conda env
# or
flit install -s --deps=develop --python path/to/venv/bin/python
.. _on GitHub: https://github.com/theislab/scanpy

If you want to let conda_ handle the installations of dependencies, do::
If you want to let conda_ handle the installations of dependencies, do:

.. code:: shell
pip install beni
beni pyproject.toml > environment.yml
Expand All @@ -52,10 +74,9 @@ On Windows, you might have to use `flit install --pth-file`
if you are not able to give yourself the `create symbolic links`_ privilege.

.. _create symbolic links: https://docs.microsoft.com/en-us/windows/security/threat-protection/security-policy-settings/create-symbolic-links
.. _flit: https://flit.readthedocs.io/en/latest/

.. note::

`pip install -e` still works, but may not in future versions.
For instructions on how to work with the code, see the :ref:`contributing guide <contribution-guide>`.

Docker
~~~~~~
Expand All @@ -67,7 +88,9 @@ If you're using Docker_, you can use e.g. the image `gcfntnu/scanpy`_ from Docke

Troubleshooting
~~~~~~~~~~~~~~~
If you get a `Permission denied` error, never use `sudo pip`. Instead, use virtual environments or::
If you get a `Permission denied` error, never use `sudo pip`. Instead, use virtual environments or:

.. code:: shell
pip install --user scanpy
Expand All @@ -76,7 +99,9 @@ If you get a `Permission denied` error, never use `sudo pip`. Instead, use virtu
- `brew install igraph`
- If python-igraph still fails to install, see the question on `compiling igraph`_.
Alternatively consider installing gcc via `brew install gcc --without-multilib`
and exporting the required variables::
and exporting the required variables:

.. code:: shell
export CC="/usr/local/Cellar/gcc/X.x.x/bin/gcc-X"
export CXX="/usr/local/Cellar/gcc/X.x.x/bin/gcc-X"
Expand Down
223 changes: 120 additions & 103 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,136 +1,153 @@
[build-system]
build-backend = 'flit_core.buildapi'
build-backend = "flit_core.buildapi"
requires = [
'flit_core >=3.1,<4',
'setuptools_scm',
'pytoml',
'importlib_metadata>=0.7; python_version < "3.8"',
"flit_core >=3.4,<4",
"setuptools_scm",
"tomli",
"importlib_metadata>=0.7; python_version < '3.8'",
# setup.py stuff
'packaging',
"packaging",
]

[tool.flit.metadata]
module = 'scanpy'
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\
"""
# We don’t need all emails, the main authors are sufficient.
author-email = '[email protected], [email protected]'
description-file = 'README.rst'
home-page = 'http://github.com/theislab/scanpy'
urls = { Documentation = 'https://scanpy.readthedocs.io/' }
[project]
name = "scanpy"
description = "Single-Cell Analysis in Python."
requires-python = ">=3.7"
license = {file = "LICENSE"}
authors = [
{name = "Alex Wolf"},
{name = "Philipp Angerer"},
{name = "Fidel Ramirez"},
{name = "Isaac Virshup"},
{name = "Sergei Rybakov"},
{name = "Gokcen Eraslan"},
{name = "Tom White"},
{name = "Malte Luecken"},
{name = "Davide Cittaro"},
{name = "Tobias Callies"},
{name = "Marius Lange"},
{name = "Andrés R. Muñoz-Rojas"},
]
maintainers = [
{name = "Isaac Virshup", email = "[email protected]"},
{name = "Philipp Angerer", email = "[email protected]"},
{name = "Alex Wolf", email = "[email protected]"},
]
readme = {file = "README.rst", content-type="text/x-rst"}
classifiers = [
'License :: OSI Approved :: BSD License',
'Development Status :: 5 - Production/Stable',
'Environment :: Console',
'Framework :: Jupyter',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'Natural Language :: English',
'Operating System :: MacOS :: MacOS X',
'Operating System :: Microsoft :: Windows',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'Topic :: Scientific/Engineering :: Visualization',
"License :: OSI Approved :: BSD License",
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Framework :: Jupyter",
"Intended Audience :: Developers",
"Intended Audience :: Science/Research",
"Natural Language :: English",
"Operating System :: MacOS :: MacOS X",
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Scientific/Engineering :: Bio-Informatics",
"Topic :: Scientific/Engineering :: Visualization",
]
requires-python = '>=3.7'
requires = [
'anndata>=0.7.4',
dependencies = [
"anndata>=0.7.4",
# numpy needs a version due to #1320
'numpy>=1.17.0',
"numpy>=1.17.0",
# Matplotlib 3.1 causes an error in 3d scatter plots (https://github.com/matplotlib/matplotlib/issues/14298)
# But matplotlib 3.0 causes one in heatmaps
'matplotlib>=3.1.2',
'pandas>=0.21',
'scipy>=1.4',
'seaborn',
'h5py>=2.10.0',
'tables',
'tqdm',
'scikit-learn>=0.22',
'statsmodels>=0.10.0rc2',
'patsy',
'networkx>=2.3',
'natsort',
'joblib',
'numba>=0.41.0',
'umap-learn>=0.3.10',
'packaging',
'sinfo',
"matplotlib>=3.1.2",
"pandas>=0.21",
"scipy>=1.4",
"seaborn",
"h5py>=2.10.0",
"tables",
"tqdm",
"scikit-learn>=0.22",
"statsmodels>=0.10.0rc2",
"patsy",
"networkx>=2.3",
"natsort",
"joblib",
"numba>=0.41.0",
"umap-learn>=0.3.10",
"packaging",
"sinfo",
# for getting the stable version
'importlib_metadata>=0.7; python_version < "3.8"',
"importlib_metadata>=0.7; python_version < '3.8'",
]
dynamic = ["version"]

[tool.flit.metadata.requires-extra]
louvain = ['python-igraph', 'louvain>=0.6,!=0.6.2']
leiden = ['python-igraph', 'leidenalg']
bbknn = ['bbknn']
rapids = ['cudf>=0.9', 'cuml>=0.9', 'cugraph>=0.9']
magic = ['magic-impute>=2.0']
skmisc = ['scikit-misc>=0.1.3']
harmony = ['harmonypy']
scanorama = ['scanorama']
scrublet = ['scrublet']
dev = [
# getting the dev version
'setuptools_scm',
'pytoml',
# static checking
'black>=20.8b1',
'docutils',
[project.urls]
Documentation = "https://scanpy.readthedocs.io/"
Source = "https://github.com/theislab/scanpy"
Home-page = "https://scanpy.org"

[project.scripts]
scanpy = "scanpy.cli:console_main"

[project.optional-dependencies]
test = [
"pytest>=4.4",
"pytest-nunit",
"dask[array]!=2.17.0",
"fsspec",
"zappy",
"zarr",
"profimp",
# Test the metadata while this exists: https://github.com/takluyver/flit/issues/387
"flit_core",
]
doc = [
'sphinx>=4.1,<4.2',
'sphinx-rtd-theme>=0.3.1',
'sphinx-autodoc-typehints',
'scanpydoc>=0.7.3',
'typing_extensions; python_version < "3.8"', # for `Literal`
'python-igraph',
"sphinx>=4.1,<4.2",
"sphinx-rtd-theme>=0.3.1",
"sphinx-autodoc-typehints",
"scanpydoc>=0.7.3",
"typing_extensions; python_version < '3.8'", # for `Literal`
"python-igraph",
]
test = [
'pytest>=4.4',
'pytest-nunit',
'dask[array]!=2.17.0',
'fsspec',
'zappy',
'zarr',
'profimp',
# Test the metadata while this exists: https://github.com/takluyver/flit/issues/387
'flit_core',
dev = [
# getting the dev version
"setuptools_scm",
# static checking
"black>=20.8b1",
"docutils",
]

[tool.flit.scripts]
scanpy = 'scanpy.cli:console_main'
louvain = ["python-igraph", "louvain>=0.6,!=0.6.2"]
leiden = ["python-igraph", "leidenalg"]
bbknn = ["bbknn"]
rapids = ["cudf>=0.9", "cuml>=0.9", "cugraph>=0.9"]
magic = ["magic-impute>=2.0"]
skmisc = ["scikit-misc>=0.1.3"]
harmony = ["harmonypy"]
scanorama = ["scanorama"]
scrublet = ["scrublet"]

[tool.flit.sdist]
exclude = [
'scanpy/tests',
'setup.py',
"scanpy/tests",
"setup.py",
]

[tool.pytest.ini_options]
python_files = 'test_*.py'
testpaths = 'scanpy/tests/'
python_files = "test_*.py"
testpaths = "scanpy/tests/"
xfail_strict = true
nunit_attach_on = 'fail'
nunit_attach_on = "fail"
markers = [
'internet: tests which rely on internet resources (enable with `--internet-tests`)',
"internet: tests which rely on internet resources (enable with `--internet-tests`)",
]

[tool.coverage.run]
source = ['scanpy']
omit = ['*/tests/*']
source = ["scanpy"]
omit = ["*/tests/*"]

[tool.black]
line-length = 88
target-version = ['py37']
target-version = ["py37"]
skip-string-normalization = true
exclude = '''
exclude = """
/build/.*
'''
"""
2 changes: 1 addition & 1 deletion scanpy/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Single-Cell Analysis in Python."""

from ._metadata import __version__, __author__, __email__, within_flit
from ._metadata import __version__, within_flit

if not within_flit(): # see function docstring on why this is there
from ._utils import check_versions
Expand Down
Loading

0 comments on commit 50f015b

Please sign in to comment.