<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sascha</id>
	<title>Alpine Linux - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.alpinelinux.org/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Sascha"/>
	<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/wiki/Special:Contributions/Sascha"/>
	<updated>2026-04-28T13:16:38Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.40.0</generator>
	<entry>
		<id>https://wiki.alpinelinux.org/w/index.php?title=Python_package_policies&amp;diff=17000</id>
		<title>Python package policies</title>
		<link rel="alternate" type="text/html" href="https://wiki.alpinelinux.org/w/index.php?title=Python_package_policies&amp;diff=17000"/>
		<updated>2020-03-07T08:12:15Z</updated>

		<summary type="html">&lt;p&gt;Sascha: Add quotes around builddir value in Python3 package template&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Python packages in Alpine Linux should follow a general set of standards for their APKBUILDs.&lt;br /&gt;
&lt;br /&gt;
{{Draft|Pending consensus on this approach, some discussion is taking place on the [[Talk:Python_package_policies|talk page]]}}&lt;br /&gt;
&lt;br /&gt;
== Guidelines ==&lt;br /&gt;
&lt;br /&gt;
* Prefix Python 3 libraries with py3-. Do not prefix programs (distinct from libraries) at all.&lt;br /&gt;
&lt;br /&gt;
== General Template ==&lt;br /&gt;
&lt;br /&gt;
Be sure to make the following changes:&lt;br /&gt;
&lt;br /&gt;
* Update maintainer to yourself&lt;br /&gt;
* Set the pkgname to the Alpine package name (prefixed with &amp;quot;py-&amp;quot;)&lt;br /&gt;
* Set _pyname to the name of the package on PyPI&lt;br /&gt;
* Update the version number, pkgdesc, url, and license&lt;br /&gt;
* Build it and address any issues that come up&lt;br /&gt;
* Read the build output and be vigilant for issues listed in the following sections - the build may complete successfully even though these issues are present&lt;br /&gt;
&lt;br /&gt;
=== Package template ===&lt;br /&gt;
&lt;br /&gt;
Note that if you are removing python2 support from a package which previously had it, you should add &amp;lt;pre&amp;gt;replaces=&amp;quot;py2-example&amp;quot;&amp;lt;/pre&amp;gt; as well. If the old package was a split package, also add &amp;lt;pre&amp;gt;replaces=&amp;quot;py-example&amp;quot;&lt;br /&gt;
provides=&amp;quot;py-example=$pkgver-r$pkgrel&amp;quot;&amp;lt;/pre&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;# Maintainer: Joe Bloe &amp;lt;joe@example.org&amp;gt;&lt;br /&gt;
pkgname=py3-alpine-name&lt;br /&gt;
_pyname=pypi-name&lt;br /&gt;
pkgver=1.2.3&lt;br /&gt;
pkgrel=0&lt;br /&gt;
pkgdesc=&amp;quot;Example Python package&amp;quot;&lt;br /&gt;
url=&amp;quot;https://example.org&amp;quot;&lt;br /&gt;
arch=&amp;quot;noarch&amp;quot;&lt;br /&gt;
license=&amp;quot;MIT&amp;quot;&lt;br /&gt;
depends=&amp;quot;python3&amp;quot;&lt;br /&gt;
makedepends=&amp;quot;py3-setuptools&amp;quot;&lt;br /&gt;
_pypiprefix=&amp;quot;${_pyname%${_pyname#?}}&amp;quot;&lt;br /&gt;
source=&amp;quot;https://files.pythonhosted.org/packages/source/$_pypiprefix/$_pyname/$_pyname-$pkgver.tar.gz&amp;quot;&lt;br /&gt;
builddir=&amp;quot;$srcdir/$_pyname-$pkgver&amp;quot;&lt;br /&gt;
&lt;br /&gt;
build() {&lt;br /&gt;
	python3 setup.py build&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
check() {&lt;br /&gt;
	python3 setup.py test&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
package() {&lt;br /&gt;
	python3 setup.py install --prefix=/usr --root=&amp;quot;$pkgdir&amp;quot;&lt;br /&gt;
}&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Common issues ==&lt;br /&gt;
&lt;br /&gt;
=== No source package available (only the wheel is on PyPI) ===&lt;br /&gt;
&lt;br /&gt;
Seek out the upstream source (e.g. GitHub) and swap out the URL.&lt;br /&gt;
&lt;br /&gt;
=== No tests in PyPI package &amp;quot;(0 tests run)&amp;quot; ===&lt;br /&gt;
&lt;br /&gt;
Seek out the upstream source (e.g. GitHub) and swap out the URL.&lt;br /&gt;
&lt;br /&gt;
=== setup.py test downloads a lot of dependencies ===&lt;br /&gt;
&lt;br /&gt;
Watch out for this and be sure to add any of these packages to checkdepends so that setuptools isn&#039;t downloading and testing against packages/versions which aren&#039;t in aports.&lt;br /&gt;
&lt;br /&gt;
=== You need to use the &#039;tox&#039; utility to run tests ===&lt;br /&gt;
&lt;br /&gt;
tox (knows as py3-tox on Alpine Linux) downloads all dependencies into a virtual environment by default, which bypasses the system tooling, making&lt;br /&gt;
testing somewhat less useful.&lt;br /&gt;
&lt;br /&gt;
Remember to use *--sitepackages* on your invocation of tox in the check() phase so it uses the system packages instead of downloading ones into&lt;br /&gt;
a virtual environment.&lt;br /&gt;
&lt;br /&gt;
== Alpine+Python projects ==&lt;br /&gt;
&lt;br /&gt;
=== aports normalization project ===&lt;br /&gt;
&lt;br /&gt;
Many Python packages in aports (if not most) do not follow these guidelines.&lt;br /&gt;
&lt;br /&gt;
TODO: obtain consensus and organize this work.&lt;br /&gt;
&lt;br /&gt;
=== Python 2 deprecation ===&lt;br /&gt;
&lt;br /&gt;
{{Draft|Pending consensus on this approach}}&lt;br /&gt;
&lt;br /&gt;
The general approach to Python 2 deprecation and removal requires three broad steps:&lt;br /&gt;
&lt;br /&gt;
# Do not add new python 2 packages to aports, effective immediately.&lt;br /&gt;
# In the course of the aports normalization project, drop Python 2 support if it&#039;s easy or triage it and make a note for later if not.&lt;br /&gt;
# Making judgement calls for difficult packages on a case-by-case basis, based on the upstream&#039;s progress/amicability towards a Python 3 port. Upstreams which are unwilling to port to Python 3 should be removed from aports.&lt;br /&gt;
&lt;br /&gt;
TODO: Prepare some discussion place, git repos, scripts, etc, to organize this work.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[category: python]]&lt;/div&gt;</summary>
		<author><name>Sascha</name></author>
	</entry>
</feed>