45d03f9
%global srcname xarray
1106cd7
%global data_commit 86974d54ce83a130303fe8caa629e60deb3cb6e5
45d03f9
e818d8f
%bcond_with docs
e818d8f
45d03f9
Name:           python-%{srcname}
72b1741
Version:        2023.1.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
10e862c
Source2:        https://github.com/rasterio/rasterio/raw/1.2.10/tests/data/RGB.byte.tif
45d03f9
# All Fedora specific.
45d03f9
Patch0001:      0001-DOC-Don-t-download-RGB.byte.tif-during-build.patch
45d03f9
Patch0002:      0002-DOC-Skip-examples-using-unpackaged-dependencies.patch
f252ef5
Patch0003:      0003-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/~'
45d03f9
cp -p %SOURCE2 ./doc/gallery/
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"
72b1741
  # https://bugzilla.redhat.com/show_bug.cgi?id=2113663
72b1741
  -k 'not test_open_nczarr'
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