\documentclass[aspectratio=169]{beamer} %\setbeameroption{show notes on second screen} \usepackage[utf8]{inputenc} \usepackage{graphicx} \usepackage{tikz} \usetikzlibrary{shapes.geometric} \definecolor{SUSEgreen}{RGB}{115, 186, 37} \usecolortheme[named=SUSEgreen]{structure} \usepackage{fontspec} \setmainfont{Urania Czech} \setsansfont{Urania Czech} \usepackage{minted} \title{Python packaging in openSUSE} \subtitle{Advantages against other distributions} \author[mcepl]{Matěj Cepl \\ \texttt{mcepl@cepl.eu}} \date[openSUSECon 2022]{openSUSE Conference, June 2022} \newcommand{\authortitle}{} \newcommand{\organization}{SUSE} \newcommand{\event}{OpenSUSE Conference 2022} \begin{document} \frame{\titlepage} % \begin{frame} % % \begin{tikzpicture}[remember picture,overlay] % \node at (5cm,-0.5cm) {\includegraphics[width=9.33cm,height=8cm,keepaspectratio]{package.png}}; % \end{tikzpicture} % % \end{frame} \begin{frame} \frametitle{Problems in the Python non-specific packaging} \begin{itemize} \item Multiple interpreters \item Complicated commands \item Sheer number of packages \item Not enough checking \end{itemize} \end{frame} \begin{frame}[fragile] \frametitle{Multiple interpreters} \begin{minipage}[t]{.35\textwidth} \begin{minted}{spec} %build %if %{with python3} %py3_build %else %py2_build %endif \end{minted} \end{minipage} % \hfill % \pause % \begin{minipage}[t]{.35\textwidth} \begin{minted}{spec} %build %python_build \end{minted} \end{minipage} \note[item]{The other solution is hard-coded, so whenever anything changes, everything has to be changed again. Other solution is the same as what we used to use for Python 2 (and we still use for Python2 in some enterprise channels), and it is the same now when we use it for simultaneous support of Python 3.8, 3.9, 3.10 and possibly soon 3.11 on Tumbleweed, and it would be the same if somebody finally fixed pypy3 or if a miracle happened and somebody got jythohn to the functional state.} \end{frame} \begin{frame}[fragile] \frametitle{Complicated commands} \begin{minted}{spec} %check export PYTHONPATH=%{buildroot}%{python_sitelib} PYTHONDONTWRITEBYTECODE=1 pytest --ignore=build.* -v \end{minted} \note{And this is still not correct, because it must be done for all Python versions separately (and those \texttt{--ignore=build*} must be arranged accordingly). And we need to be able to take into consideration existing \texttt{PYTHONPATH}.} \pause \vspace{1ex} \begin{minted}{spec} %check %pytest \end{minted} \end{frame} \begin{frame}[fragile] \frametitle{Example} \scriptsize \begin{minted}{spec} %{?!python_module:%define python_module() python3-%{**}} Name: python-foobar Version: 1.0.2 Release: 0 Summary: Example foobar package License: MIT URL: https://github.com/bumba/foobar Source: https://files.pythonhosted.org/packages/source/f/foobar/foobar-%{version}.tar.gz # PATCH-FIX-UPSTREAM remove_mock.patch bsc#123456 mcepl@suse.com # we don't need stinking mock Patch0: remove_mock.patch BuildRequires: %{python_module appdirs} BuildRequires: %{python_module pytest} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-appdirs BuildArch: noarch %python_subpackages %description foobar is a collection of enhancements to the Python packages that allow you to build and distribute Python packages, \end{minted} \note[item]{Eliminate as much boiler-plate as possible. We have only two lines now, which are same every time: that python\_module definition and Release. And in both cases we are just forced to have them there by the mechanics of RPM.} \note[item]{Note that macro python\_subpackages, that’s the root of all machinations. In effect this SPEC file is just a foundation, I don’t want to use the term “template”, because that would be misleading, for multiple generated ones.} \end{frame} \begin{frame}[fragile] \frametitle{Example (cont.)} \scriptsize \begin{minted}{spec} %prep %autosetup -p1 -n foobar-%{version} %build export NOBUMPA=1 %python_build %install %python_install %python_expand %fdupes %{buildroot}%{$python_sitelib} %check # %pyunittest discover -v %pytest %files %{python_files} %license LICENSE %doc CHANGES.rst README.rst %{python_sitelib}/foobar %{python_sitelib}/foobar-%{version}*-info %changelog \end{minted} \note[item]{Using \texttt{autosetup} to avoid dealing with each patch again.} \end{frame} \begin{frame} \frametitle{Toil to machines!} \begin{itemize} \item Given the number of packages we maintain (over 2,500 in Factory) we need to put as much work as possible on machines. \item Packages are auto-generated by `py2pack`. \item Automatic rebuilds \item All submissions are reviewed \item Every build in openSUSE ecosystem is checked by rpmlint and unless specifically permitted, failed rpmlint check means failed build. \end{itemize} \note[item]{They are auto-generated, but they are more like a ready-to-cook food, they need to be finished.} \note[item]{And yes, it is similar to the Fedora’s \texttt{pyp2rpm}, but we have never managed to unify two code-bases. If anybody is willing to do the work, it would be lovely.} \note[item]{I may add an anecdote about } \end{frame} \begin{frame} \frametitle{Thank you!} My email is mcepl@cepl.eu.\vspace{1em} \tiny \LaTeX\hspace{0.01em} source of this presentation is available on https://gitlab.com/mcepl/opensuseconf.git. \end{frame} \end{document}