45d03f9
%global srcname xarray
ea961bf
%global data_commit 7d8290e0be9d2a8f4b4381641f20a97db6eaea3d
45d03f9
e818d8f
%bcond_with docs
e818d8f
45d03f9
Name:           python-%{srcname}
e75d5c9
Version:        2023.9.0
7b07a86
Release:        %autorelease
45d03f9
Summary:        N-D labeled arrays and datasets in Python
45d03f9
72b1741
License:        Apache-2.0
45d03f9
URL:            https://github.com/pydata/xarray
1106cd7
Source0:        %pypi_source %{srcname}
45d03f9
# Data for examples only.
45d03f9
Source1:        https://github.com/pydata/xarray-data/archive/%{data_commit}/xarray-data-%{data_commit}.tar.gz
45d03f9
# All Fedora specific.
ea961bf
Patch0001:      0001-DOC-Skip-examples-using-unpackaged-dependencies.patch
ea961bf
Patch0002:      0002-DOC-Don-t-print-out-conda-pip-environment.patch
45d03f9
45d03f9
BuildArch:      noarch
45d03f9
45d03f9
BuildRequires:  python3-devel
1106cd7
BuildRequires:  python3dist(bottleneck)
9ed2fe8
BuildRequires:  python3dist(cftime) >= 1.2
9ed2fe8
BuildRequires:  python3dist(dask[array]) >= 2.30
9ed2fe8
BuildRequires:  python3dist(dask[dataframe]) >= 2.30
92642a4
BuildRequires:  python3dist(netcdf4) >= 1.5
9ed2fe8
BuildRequires:  python3dist(pint) >= 0.16
45d03f9
BuildRequires:  python3dist(pytest) >= 2.7.1
45d03f9
BuildRequires:  python3dist(pytest-xdist)
92642a4
BuildRequires:  python3dist(rasterio) >= 1.1
9ed2fe8
BuildRequires:  python3dist(seaborn) >= 0.11
9ed2fe8
BuildRequires:  python3dist(zarr) >= 2.5
45d03f9
45d03f9
%global _description %{expand: \
45d03f9
Xarray (formerly xray) is an open source project and Python package that
45d03f9
makes working with labelled multi-dimensional arrays simple, efficient,
45d03f9
and fun!
45d03f9
45d03f9
Xarray introduces labels in the form of dimensions, coordinates and
45d03f9
attributes on top of raw NumPy-like arrays, which allows for a more
45d03f9
intuitive, more concise, and less error-prone developer experience. The
45d03f9
package includes a large and growing library of domain-agnostic functions
45d03f9
for advanced analytics and visualization with these data structures.
45d03f9
45d03f9
Xarray was inspired by and borrows heavily from pandas, the popular data
45d03f9
analysis package focused on labelled tabular data. It is particularly
72b1741
tailored to working with netCDF files, which were the source of xarray’s
45d03f9
data model, and integrates tightly with dask for parallel computing.}
45d03f9
45d03f9
%description %{_description}
45d03f9
45d03f9
45d03f9
%package -n     python3-%{srcname}
45d03f9
Summary:        %{summary}
45d03f9
45d03f9
%description -n python3-%{srcname} %{_description}
45d03f9
45d03f9
e818d8f
%if %{with docs}
45d03f9
%package -n python-%{srcname}-doc
45d03f9
Summary:        xarray documentation
45d03f9
45d03f9
BuildRequires:  python3dist(cartopy)
45d03f9
BuildRequires:  natural-earth-map-data-110m
45d03f9
BuildRequires:  natural-earth-map-data-10m
45d03f9
BuildRequires:  python3-ipython-sphinx
618c5a4
BuildRequires:  python3dist(jupyter-client)
9ed2fe8
BuildRequires:  python3dist(matplotlib) >= 3.3
45d03f9
BuildRequires:  python3dist(sphinx)
45d03f9
BuildRequires:  python3dist(sphinx-gallery)
45d03f9
BuildRequires:  python3dist(sphinx-rtd-theme)
45d03f9
45d03f9
%description -n python-%{srcname}-doc
45d03f9
Documentation for xarray
e818d8f
%endif
45d03f9
45d03f9
45d03f9
%prep
45d03f9
%autosetup -n %{srcname}-%{version} -p1
45d03f9
e818d8f
%if %{with docs}
45d03f9
# Provide example datasets for building docs.
45d03f9
tar xf %SOURCE1 --transform='s~^\(%{srcname}-data-%{data_commit}/\)~\1.xarray_tutorial_data/~'
e818d8f
%endif
45d03f9
45d03f9
9fb0fe6
%generate_buildrequires
9fb0fe6
%pyproject_buildrequires -r
9fb0fe6
9fb0fe6
45d03f9
%build
9fb0fe6
%pyproject_wheel
45d03f9
e818d8f
%if %{with docs}
45d03f9
# generate html docs
45d03f9
pushd doc
45d03f9
PYTHONPATH=${PWD}/.. HOME=${PWD}/../%{srcname}-data-%{data_commit} make html
45d03f9
# remove the sphinx-build leftovers
45d03f9
rm -rf _build/html/.{doctrees,buildinfo}
45d03f9
popd
e818d8f
%endif
45d03f9
45d03f9
45d03f9
%install
9fb0fe6
%pyproject_install
9fb0fe6
%pyproject_save_files %{srcname}
45d03f9
45d03f9
45d03f9
%check
b7026ce
rm -rf xarray
5548983
5548983
pytest_args=(
5548983
  -n auto
5548983
  -m "not network"
8294269
  # https://github.com/pydata/xarray/issues/7513
8294269
  -k 'not test_open_mfdataset_manyfiles'
5548983
)
5548983
5548983
%{pytest} -ra "${pytest_args[@]}" --pyargs xarray
45d03f9
45d03f9
9fb0fe6
%files -n python3-%{srcname} -f %{pyproject_files}
d06712b
%license LICENSE licenses/DASK_LICENSE licenses/NUMPY_LICENSE licenses/PANDAS_LICENSE licenses/PYTHON_LICENSE licenses/SEABORN_LICENSE
1106cd7
%doc README.md
45d03f9
e818d8f
%if %{with docs}
45d03f9
%files -n python-%{srcname}-doc
45d03f9
%doc doc/_build/html
d06712b
%license LICENSE licenses/DASK_LICENSE licenses/NUMPY_LICENSE licenses/PANDAS_LICENSE licenses/PYTHON_LICENSE licenses/SEABORN_LICENSE
e818d8f
%endif
45d03f9
45d03f9
45d03f9
%changelog
7b07a86
%autochangelog