Blob Blame History Raw
# Unset -s on python shebang - ensure that extensions installed with pip
# to user locations are seen and properly loaded
%global py3_shebang_flags %(echo %py3_shebang_flags | sed s/s//)

Name:           python-notebook
Version:        7.2.0
Release:        %autorelease
Summary:        A web-based notebook environment for interactive computing
License:        BSD-3-Clause
Source:         %{pypi_source notebook}

BuildArch:      noarch

BuildRequires:  python3-devel
# For validating desktop entry
BuildRequires:  desktop-file-utils

%global _description \
The Jupyter Notebook is a web application that allows you to create and \
share documents that contain live code, equations, visualizations, and \
explanatory text. The Notebook has support for multiple programming \
languages, sharing, and interactive widgets.

%description %_description

%package -n     python3-notebook
Summary:        %{summary}
Requires:       python-jupyter-filesystem
%py_provides    python3-jupyter-notebook
%py_provides    python3-ipython-notebook
%py_provides    notebook
%py_provides    jupyter-notebook
# We stopped shipping doc a long time ago, but there are possible conflicts.
# For details, see
# (Keep this around at least until Fedora 41.)
Obsoletes:      python-notebook-doc < 7

%description -n python3-notebook %_description

%autosetup -p1 -n notebook-%{version}

# The nbval package is used for validation of notebooks.
# It's sedded out because it isn't yet packaged in Fedora.
# Selenium tests are skipped because the version in Fedora is too old.
# We don't test coverage.
# pytest-tornasync is unmaintained upstream and will be
# replaced by pytest-jupyter.
for pkg in nbval "selenium==.*" coverage pytest-cov pytest-tornasync; do
  sed -Ei "/\"$pkg\",?/d" pyproject.toml

# Remove all backup files
find ./ -name "*.json.orig" -delete

%pyproject_buildrequires -x test


%pyproject_save_files notebook

install -m 0755 -p -d %{buildroot}%{_sysconfdir}/jupyter/jupyter_server_config.d
mv -v %{buildroot}{%{_prefix},}%{_sysconfdir}/jupyter/jupyter_server_config.d/notebook.json

%pytest -W ignore::DeprecationWarning --ignore notebook/tests/selenium

desktop-file-validate %{buildroot}%{_datadir}/applications/jupyter-notebook.desktop

%files -n python3-notebook -f %{pyproject_files}
%license LICENSE
%config(noreplace) %{_sysconfdir}/jupyter/jupyter_server_config.d/notebook.json