Skip to content

Commit

Permalink
setuptools-scm and one-liner setup.py (#3714)
Browse files Browse the repository at this point in the history
* Replace versioneer with setuptools-scm. Replace setup.py with setup.cfg. Remove pytest-runner.

* Python 3.8 eggs

* Drop minimum pandas version

* twine check
  • Loading branch information
crusaderky authored and dcherian committed Jan 22, 2020
1 parent aa0f963 commit 27a3929
Show file tree
Hide file tree
Showing 11 changed files with 108 additions and 2,573 deletions.
1 change: 0 additions & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ omit =
xarray/core/npcompat.py
xarray/core/pdcompat.py
xarray/core/pycompat.py
xarray/_version.py
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# reduce the number of merge conflicts
doc/whats-new.rst merge=union
xarray/_version.py export-subst
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ doc/savefig
# Packages
*.egg
*.egg-info
.eggs
dist
build
eggs
Expand Down Expand Up @@ -65,7 +66,6 @@ dask-worker-space/
# xarray specific
doc/_build
doc/generated
xarray/version.py
xarray/tests/data/*.grib.*.idx

# Sync tools
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ recursive-include doc *
prune doc/_build
prune doc/generated
global-exclude .DS_Store
include versioneer.py
include xarray/_version.py
recursive-include xarray/static *
2 changes: 1 addition & 1 deletion ci/requirements/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ dependencies:
- numba
- numpy
- numpydoc
- pandas<0.25 # Hack around https://github.com/pydata/xarray/issues/3369
- pandas
- rasterio
- seaborn
- sphinx
Expand Down
3 changes: 3 additions & 0 deletions doc/whats-new.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ Internal Changes
- Removed internal method ``Dataset._from_vars_and_coord_names``,
which was dominated by ``Dataset._construct_direct``. (:pull:`3565`)
By `Maximilian Roos <https://github.com/max-sixty>`_
- Replaced versioneer with setuptools-scm. Moved contents of setup.py to setup.cfg.
Removed pytest-runner from setup.py, as per deprecation notice on the pytest-runner
project. (:pull:`3714`) by `Guido Imperiale <https://github.com/crusaderky>`_


v0.14.1 (19 Nov 2019)
Expand Down
113 changes: 95 additions & 18 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,3 +1,95 @@
[metadata]
name = xarray
author = xarray Developers
author_email = xarray@googlegroups.com
license = Apache
description = N-D labeled arrays and datasets in Python
long_description_content_type=x-rst
long_description =
**xarray** (formerly **xray**) is an open source project and Python package
that makes working with labelled multi-dimensional arrays simple,
efficient, and fun!

xarray introduces labels in the form of dimensions, coordinates and
attributes on top of raw NumPy_-like arrays, which allows for a more
intuitive, more concise, and less error-prone developer experience.
The package includes a large and growing library of domain-agnostic functions
for advanced analytics and visualization with these data structures.

xarray was inspired by and borrows heavily from pandas_, the popular data
analysis package focused on labelled tabular data.
It is particularly tailored to working with netCDF_ files, which were the
source of xarray's data model, and integrates tightly with dask_ for parallel
computing.
.. _NumPy: https://www.numpy.org
.. _pandas: https://pandas.pydata.org
.. _dask: https://dask.org
.. _netCDF: https://www.unidata.ucar.edu/software/netcdf
Why xarray?
-----------
Multi-dimensional (a.k.a. N-dimensional, ND) arrays (sometimes called
"tensors") are an essential part of computational science.
They are encountered in a wide range of fields, including physics, astronomy,
geoscience, bioinformatics, engineering, finance, and deep learning.
In Python, NumPy_ provides the fundamental data structure and API for
working with raw ND arrays.
However, real-world datasets are usually more than just raw numbers;
they have labels which encode information about how the array values map
to locations in space, time, etc.
xarray doesn't just keep track of labels on arrays -- it uses them to provide a
powerful and concise interface. For example:

- Apply operations over dimensions by name: ``x.sum('time')``.
- Select values by label instead of integer location:
``x.loc['2014-01-01']`` or ``x.sel(time='2014-01-01')``.
- Mathematical operations (e.g., ``x - y``) vectorize across multiple
dimensions (array broadcasting) based on dimension names, not shape.
- Flexible split-apply-combine operations with groupby:
``x.groupby('time.dayofyear').mean()``.
- Database like alignment based on coordinate labels that smoothly
handles missing values: ``x, y = xr.align(x, y, join='outer')``.
- Keep track of arbitrary metadata in the form of a Python dictionary:
``x.attrs``.

Learn more
----------
- Documentation: `<http://xarray.pydata.org>`_
- Issue tracker: `<http://github.com/pydata/xarray/issues>`_
- Source code: `<http://github.com/pydata/xarray>`_
- SciPy2015 talk: `<https://www.youtube.com/watch?v=X0pAhJgySxk>`_

url = https://github.com/pydata/xarray
classifiers =
Development Status :: 5 - Production/Stable
License :: OSI Approved :: Apache Software License
Operating System :: OS Independent
Intended Audience :: Science/Research
Programming Language :: Python
Programming Language :: Python :: 3
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.7
Topic :: Scientific/Engineering

[options]
packages = xarray
zip_safe = True
include_package_data = True
python_requires = >=3.6
install_requires =
numpy >= 1.14
pandas >= 0.24
setup_requires = setuptools_scm

[options.package_data]
xarray =
py.typed
tests/data/*
static/css/*
static/html/*

[tool:pytest]
python_files=test_*.py
testpaths=xarray/tests properties
Expand All @@ -23,6 +115,7 @@ ignore=
# line break before binary operator
W503
exclude=
.eggs
doc

[isort]
Expand Down Expand Up @@ -87,35 +180,19 @@ ignore_missing_imports = True
ignore_missing_imports = True
[mypy-seaborn.*]
ignore_missing_imports = True
[mypy-setuptools]
ignore_missing_imports = True
[mypy-sparse.*]
ignore_missing_imports = True
[mypy-toolz.*]
ignore_missing_imports = True
[mypy-zarr.*]
ignore_missing_imports = True

# setuptools is not typed
[mypy-setup]
ignore_errors = True
# versioneer code
[mypy-versioneer.*]
ignore_errors = True
# written by versioneer
[mypy-xarray._version]
ignore_errors = True
# version spanning code is hard to type annotate (and most of this module will
# be going away soon anyways)
[mypy-xarray.core.pycompat]
ignore_errors = True

[versioneer]
VCS = git
style = pep440
versionfile_source = xarray/_version.py
versionfile_build = xarray/_version.py
tag_prefix = v
parentdir_prefix = xarray-

[aliases]
test = pytest

Expand Down
110 changes: 2 additions & 108 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,110 +1,4 @@
#!/usr/bin/env python
import sys
from setuptools import setup

import versioneer
from setuptools import find_packages, setup

DISTNAME = "xarray"
LICENSE = "Apache"
AUTHOR = "xarray Developers"
AUTHOR_EMAIL = "xarray@googlegroups.com"
URL = "https://github.com/pydata/xarray"
CLASSIFIERS = [
"Development Status :: 5 - Production/Stable",
"License :: OSI Approved :: Apache Software License",
"Operating System :: OS Independent",
"Intended Audience :: Science/Research",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Topic :: Scientific/Engineering",
]

PYTHON_REQUIRES = ">=3.6"
INSTALL_REQUIRES = ["numpy >= 1.14", "pandas >= 0.24"]
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
SETUP_REQUIRES = ["pytest-runner >= 4.2"] if needs_pytest else []
TESTS_REQUIRE = ["pytest >= 2.7.1"]

DESCRIPTION = "N-D labeled arrays and datasets in Python"
LONG_DESCRIPTION = """
**xarray** (formerly **xray**) is an open source project and Python package
that makes working with labelled multi-dimensional arrays simple,
efficient, and fun!
Xarray introduces labels in the form of dimensions, coordinates and
attributes on top of raw NumPy_-like arrays, which allows for a more
intuitive, more concise, and less error-prone developer experience.
The package includes a large and growing library of domain-agnostic functions
for advanced analytics and visualization with these data structures.
Xarray was inspired by and borrows heavily from pandas_, the popular data
analysis package focused on labelled tabular data.
It is particularly tailored to working with netCDF_ files, which were the
source of xarray's data model, and integrates tightly with dask_ for parallel
computing.
.. _NumPy: https://www.numpy.org
.. _pandas: https://pandas.pydata.org
.. _dask: https://dask.org
.. _netCDF: https://www.unidata.ucar.edu/software/netcdf
Why xarray?
-----------
Multi-dimensional (a.k.a. N-dimensional, ND) arrays (sometimes called
"tensors") are an essential part of computational science.
They are encountered in a wide range of fields, including physics, astronomy,
geoscience, bioinformatics, engineering, finance, and deep learning.
In Python, NumPy_ provides the fundamental data structure and API for
working with raw ND arrays.
However, real-world datasets are usually more than just raw numbers;
they have labels which encode information about how the array values map
to locations in space, time, etc.
Xarray doesn't just keep track of labels on arrays -- it uses them to provide a
powerful and concise interface. For example:
- Apply operations over dimensions by name: ``x.sum('time')``.
- Select values by label instead of integer location:
``x.loc['2014-01-01']`` or ``x.sel(time='2014-01-01')``.
- Mathematical operations (e.g., ``x - y``) vectorize across multiple
dimensions (array broadcasting) based on dimension names, not shape.
- Flexible split-apply-combine operations with groupby:
``x.groupby('time.dayofyear').mean()``.
- Database like alignment based on coordinate labels that smoothly
handles missing values: ``x, y = xr.align(x, y, join='outer')``.
- Keep track of arbitrary metadata in the form of a Python dictionary:
``x.attrs``.
Learn more
----------
- Documentation: http://xarray.pydata.org
- Issue tracker: http://github.com/pydata/xarray/issues
- Source code: http://github.com/pydata/xarray
- SciPy2015 talk: https://www.youtube.com/watch?v=X0pAhJgySxk
"""


setup(
name=DISTNAME,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
license=LICENSE,
author=AUTHOR,
author_email=AUTHOR_EMAIL,
classifiers=CLASSIFIERS,
description=DESCRIPTION,
long_description=LONG_DESCRIPTION,
python_requires=PYTHON_REQUIRES,
install_requires=INSTALL_REQUIRES,
setup_requires=SETUP_REQUIRES,
tests_require=TESTS_REQUIRE,
url=URL,
packages=find_packages(),
package_data={
"xarray": ["py.typed", "tests/data/*", "static/css/*", "static/html/*"]
},
)
setup(use_scm_version=True)
Loading

0 comments on commit 27a3929

Please sign in to comment.