summaryrefslogtreecommitdiffstats
path: root/main.tex
blob: 9324447cde8aa52034525b1098f28039203d1681 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
\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}