# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

DISTUTILS_USE_PEP517=setuptools
PYTHON_COMPAT=( python3_{12..14} )

inherit distutils-r1 pypi

DESCRIPTION="Tools for extracting data and metadata from scientific data files"
HOMEPAGE="
	https://github.com/pycroscopy/SciFiReaders
	https://pycroscopy.github.io/SciFiReaders/
	https://pypi.org/project/SciFiReaders/
"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm64"
IUSE="hyperspy mcp nsid tiff"

RDEPEND="
	>=dev-python/numpy-1.24[${PYTHON_USEDEP}]
	dev-python/toolz[${PYTHON_USEDEP}]
	dev-python/cytoolz[${PYTHON_USEDEP}]
	>=dev-python/dask-2.20.0[${PYTHON_USEDEP}]
	>=dev-python/sidpy-0.11.2[${PYTHON_USEDEP}]
	dev-python/numba[${PYTHON_USEDEP}]
	>=dev-python/ipython-7.1.0[${PYTHON_USEDEP}]
	dev-python/pyUSID[${PYTHON_USEDEP}]
	dev-python/gdown[${PYTHON_USEDEP}]
	dev-python/mrcfile[${PYTHON_USEDEP}]
	dev-python/pycroscopy-gwyfile[${PYTHON_USEDEP}]
	>=dev-python/scipy-1.11[${PYTHON_USEDEP}]
	dev-python/pillow[${PYTHON_USEDEP}]
	dev-python/setuptools[${PYTHON_USEDEP}]
	hyperspy? ( dev-python/hyperspy[${PYTHON_USEDEP}] )
	mcp? ( <dev-python/mcp-2.0[${PYTHON_USEDEP}] )
	nsid? ( dev-python/pyNSID[${PYTHON_USEDEP}] )
	tiff? ( dev-python/tifffile[${PYTHON_USEDEP}] )
"

# pillow is effectively mandatory: every SciFiReaders import reaches an
# unconditional PIL import. Omit unavailable igor2 because its reader guards
# the import. Tests need remote fixtures plus igor2 and aicspylibczi.
RESTRICT="test"

python_prepare_all() {
	# Exclude examples/ from setuptools namespace discovery.
	sed -i \
		-e 's/"tests"\]/"tests", "examples", "examples.*", "docs", "docs.*"]/' \
		pyproject.toml || die
	distutils-r1_python_prepare_all
}