%global srcname pdf_reports %global pypiname pdf-reports Name: python-%{pypiname} Version: 0.3.9 Release: 1%{?dist} Summary: Render HTML or Pug templates to PDF reports License: MIT URL: https://github.com/Edinburgh-Genome-Foundry/%{srcname} # GitHub tag archive rather than the PyPI sdist: the sdist ships tests/ without # tests/data/, so every case fails on a missing .pug template. Source0: %{url}/archive/refs/tags/v%{version}/%{srcname}-%{version}.tar.gz BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros # %%check BuildRequires: python3-pytest # The tests reparse each generated PDF to check it came out. BuildRequires: python3-pypdf # One case renders a figure and a DataFrame into the report. BuildRequires: python3-matplotlib # Needed for the .scss case. See Recommends below. BuildRequires: python3-libsass %global _description %{expand: pdf_reports turns a template into a PDF. It renders Pug or HTML through Jinja2, applies CSS or SCSS, and writes the result with WeasyPrint, with helpers for the things reports usually need: a figure as inline SVG, a DataFrame as a styled table, a sidebar, a footer with page numbers. It is the report layer under several tools in this repository, DnaChisel's reports extra and genedom among them.} %description %_description %package -n python3-%{pypiname} Summary: %{summary} %py_provides python3-%{srcname} # SCSS support, and undeclared upstream. preload_stylesheet defaults to # is_scss="auto" and decides by file extension, so anyone handing it a .scss -- # which this project's own templates do -- hits a guarded ImportError without # libsass. Recommends rather than Requires because plain CSS works without it. Recommends: python3-libsass %description -n python3-%{pypiname} %_description %prep %autosetup -p1 -n %{srcname}-%{version} # backports.functools-lru-cache is a Python 2 backport, retired from Fedora -- # its dist-git carries a dead.package. Nothing is lost: pdf_reports.py tries # functools.lru_cache first and only falls back to the backport on ImportError, # which cannot happen on any Python this builds for. Declared but never reached. grep -q '"backports.functools-lru-cache",' pyproject.toml || { echo "backports dependency not found" >&2; exit 1; } sed -i '/"backports.functools-lru-cache",/d' pyproject.toml ! grep -q backports pyproject.toml %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{srcname} %check # Upstream's suite, all of it. It writes real PDFs and reads them back with # pypdf, compiles the .scss case through libsass, and renders one report with a # matplotlib figure and a pandas table, so this covers the whole path rather # than just the imports. %pytest -q tests %files -n python3-%{pypiname} -f %{pyproject_files} %doc README.rst %changelog * Sun Sep 27 2026 Morgan Hough - 0.3.9-1 - Initial package: pdf_reports 0.3.9. Net-new to Fedora. - Needed by sequenticon and genedom, and it is DnaChisel's reports extra, so this unblocks more than the genedom chain. - %%prep drops the backports.functools-lru-cache dependency: a Python 2 backport, retired from Fedora, and upstream's own code prefers functools.lru_cache and can never reach the fallback here. - Recommends python3-libsass, which upstream declares nowhere. Without it preload_stylesheet raises on any .scss input, and it decides by extension by default. - Sourced from the GitHub tag; the sdist omits tests/data/.