Skip to content

Commit

Permalink
Merge pull request astropy#10464 from mhvk/split-test-and-all-into-types
Browse files Browse the repository at this point in the history
Split setup.cfg test and all into types; use in tox.ini
  • Loading branch information
pllim authored Jun 29, 2021
2 parents 00b7498 + f2ede45 commit 4e0d2e9
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 23 deletions.
4 changes: 3 additions & 1 deletion docs/development/codeguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ Interface and Dependencies
methods, the optional dependency should use a normal ``import``
statement, which will raise an ``ImportError`` if the dependency is
not available. In the astropy core package, such optional dependencies should
be recorded in the ``setup.cfg`` file in the ``extras_require`` entry.
be recorded in the ``setup.cfg`` file in the ``extras_require``
entry, under ``all`` (or ``test_all`` if the dependency is only
needed for testing).

At the module level, one can subclass a class from an optional dependency
like so::
Expand Down
3 changes: 2 additions & 1 deletion docs/development/docguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ the standard Astropy docstring format.

* Any external package dependencies must be explicitly mentioned in the
documentation. They should also be recorded in the ``setup.cfg`` file in the
root of the astropy repository using an ``extras_require`` entry.
root of the astropy repository using an entry in ``extras_require``,
under ``all``.

* Configuration options using the :mod:`astropy.config` mechanisms must be
explicitly mentioned in the documentation.
Expand Down
8 changes: 8 additions & 0 deletions docs/development/testguide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,14 @@ These variables should exist for all of Astropy's optional dependencies; a
complete list of supported flags can be found in
``astropy.utils.compat.optional_deps``.

Any new optional dependencies should be added to that file, as well as to
relevant entries in ``setup.cfg`` under ``options.extras_require``:
typically, under ``all`` for dependencies used in user-facing code
(e.g., ``h5py``, which is used to write tables to HDF5 format),
and in ``test_all`` for dependencies only used in tests (e.g.,
``skyfield``, which is used to cross-check the accuracy of coordinate
transforms).

Using pytest helper functions
=============================

Expand Down
42 changes: 28 additions & 14 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ can also do::

pip install astropy --no-deps

On the other hand, if you want to install ``astropy`` along with all of the
available optional dependencies, you can do::
On the other hand, if you want to install ``astropy`` along with recommended
or even all of the available optional :ref:`dependencies <astropy-main-req>`,
you can do::

pip install astropy[recommended]

or::

pip install astropy[all]

Expand Down Expand Up @@ -72,11 +77,16 @@ There may be a delay of a day or two between when a new version of ``astropy``
is released and when a package is available for conda. You can check
for the list of available versions with ``conda search astropy``.

It is highly recommended that you install all of the optional dependencies with::
If you want to install ``astropy`` along with recommended or all of the
available optional :ref:`dependencies <astropy-main-req>`, you can do::

conda install -c astropy -c defaults scipy pyyaml matplotlib

conda install -c astropy -c defaults \
scipy h5py beautifulsoup4 html5lib bleach pyyaml pandas sortedcontainers \
pytz matplotlib setuptools mpmath bottleneck jplephem asdf
or::

conda install -c astropy -c defaults scipy pyyaml matplotlib \
h5py beautifulsoup4 html5lib bleach pandas sortedcontainers \
pytz setuptools mpmath bottleneck jplephem asdf

To also be able to run tests (see below) and support :ref:`builddocs` use the
following. We use ``pip`` for these packages to ensure getting the latest
Expand Down Expand Up @@ -129,11 +139,22 @@ Requirements

- `PyERFA`_ |minimum_pyerfa_version| or later

``astropy`` also depends on other packages for optional features:
``astropy`` also depends on a number of other packages for optional features.
The following three are particularly recommended:

- `scipy`_ |minimum_scipy_version| or later: To power a variety of features
in several modules.

- `matplotlib <https://matplotlib.org/>`_ |minimum_matplotlib_version| or later: To provide plotting
functionality that `astropy.visualization` enhances.

- `PyYAML <https://pyyaml.org>`_ |minimum_pyyaml_version| or later: To read/write
:class:`~astropy.table.Table` objects from/to the Enhanced CSV ASCII table
format and to serialize mixins such as |Time| and |SkyCoord| for FITS, HDF5,
and other formats.

The further dependencies provide more specific features:

- `h5py <http://www.h5py.org/>`_: To read/write
:class:`~astropy.table.Table` objects from/to HDF5 files.

Expand All @@ -147,10 +168,6 @@ Requirements
- `bleach <https://bleach.readthedocs.io/>`_: Used to sanitize text when
disabling HTML escaping in the :class:`~astropy.table.Table` HTML writer.

- `PyYAML <https://pyyaml.org>`_ |minimum_pyyaml_version| or later: To read/write
:class:`~astropy.table.Table` objects from/to the Enhanced CSV ASCII table
format and to serialize mixins for various formats.

- `xmllint <http://www.xmlsoft.org/>`_: To validate VOTABLE XML files.
This is a command line tool installed outside of Python.

Expand All @@ -169,9 +186,6 @@ Requirements
- `jplephem <https://pypi.org/project/jplephem/>`_: To retrieve JPL
ephemeris of Solar System objects.

- `matplotlib <https://matplotlib.org/>`_ |minimum_matplotlib_version| or later: To provide plotting
functionality that `astropy.visualization` enhances.

- `setuptools <https://setuptools.readthedocs.io>`_: Used for discovery of
entry points which are used to insert fitters into `astropy.modeling.fitting`.

Expand Down
16 changes: 12 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -50,29 +50,37 @@ asdf_extensions =
astropy-asdf = astropy.io.misc.asdf.extension:AstropyAsdfExtension

[options.extras_require]
test =
test = # Required to run the astropy test suite.
pytest-astropy>=0.8
pytest-xdist
packaging
test_all = # Required for testing, plus packages used by particular tests.
pytest-astropy>=0.8
pytest-xdist
packaging
objgraph
ipython>=4.2
coverage
skyfield>=1.20
sgp4>=2.3
packaging
recommended =
scipy>=1.1
matplotlib>=3.0,!=3.4.0
PyYAML>=3.13
all =
scipy>=1.1
matplotlib>=3.0,!=3.4.0
PyYAML>=3.13
certifi
dask[array]
h5py
beautifulsoup4
html5lib
bleach
PyYAML>=3.13
pandas
sortedcontainers
pytz
jplephem
matplotlib>=3.0,!=3.4.0
mpmath
asdf>=2.6
bottleneck
Expand Down
9 changes: 6 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tox]
envlist =
py{37,38,39,dev}-test{,-alldeps,-oldestdeps,-devdeps,-numpy117,-numpy118,-numpy119}{,-cov}{,-clocale}
py{37,38,39,dev}-test{,-recdeps,-alldeps,-oldestdeps,-devdeps,-numpy117,-numpy118,-numpy119}{,-cov}{,-clocale}
build_docs
linkcheck
codestyle
Expand Down Expand Up @@ -45,7 +45,8 @@ changedir = .tmp/{envname}
#
description =
run tests
alldeps: with all optional dependencies
recdeps: with recommended optional dependencies
alldeps: with all optional and test dependencies
devdeps: with the latest developer version of key dependencies
oldestdeps: with the oldest supported version of key dependencies
cov: and test coverage
Expand Down Expand Up @@ -95,8 +96,10 @@ deps =

# The following indicates which extras_require from setup.cfg will be installed
extras =
test
test: test
recdeps: recommended
alldeps: all
alldeps: test_all

commands =
pip freeze
Expand Down

0 comments on commit 4e0d2e9

Please sign in to comment.