Contributing to Open Source: Creating Packages for FreeBSD and Arch Linux

A journey through packaging Python libraries for spaced repetition and Anki deck generation across multiple platforms.

As someone passionate about both medical education tools and open-source software, I recently embarked on a project to make several useful Python libraries available as native packages for FreeBSD and Arch Linux. This post documents the process and shares what I learned along the way.

The Motivation

Spaced repetition software like Anki has become indispensable for medical students and lifelong learners. However, the ecosystem of tools around Anki—libraries for generating decks programmatically, analyzing study data, and implementing scheduling algorithms—often requires manual installation via pip. This creates friction for users and doesn’t integrate well with system package managers.

My goal was to package three key Python libraries:

  • genanki – A library for programmatically generating Anki decks
  • fsrs – The Free Spaced Repetition Scheduler algorithm (used in Anki and other SRS apps)
  • ankipandas – A library for analyzing Anki collections using pandas DataFrames

Arch Linux User Repository (AUR)

The AUR is a community-driven repository for Arch Linux users. Creating packages here involves writing a PKGBUILD file that describes how to fetch, build, and install the software.

python-fsrs 6.3.0

The FSRS (Free Spaced Repetition Scheduler) algorithm represents the cutting edge of spaced repetition research. Version 6.x brought significant API changes, including renaming the main FSRS class to Scheduler.

# PKGBUILD for python-fsrs
pkgname=python-fsrs
pkgver=6.3.0
pkgrel=1
pkgdesc="Free Spaced Repetition Scheduler algorithm"
arch=('any')
url="https://github.com/open-spaced-repetition/py-fsrs"
license=('MIT')
depends=('python' 'python-typing_extensions')
makedepends=('python-build' 'python-installer' 'python-wheel' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/f/fsrs/fsrs-${pkgver}.tar.gz")
sha256sums=('3abbafd66469ebf58d35a5d5bb693a492e1db44232e09aa8e4d731bf047cd0ae')

build() {
    cd "fsrs-$pkgver"
    python -m build --wheel --no-isolation
}

package() {
    cd "fsrs-$pkgver"
    python -m installer --destdir="$pkgdir" dist/*.whl
    install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
}

The package is now available at: aur.archlinux.org/packages/python-fsrs

python-genanki 0.13.1

genanki allows developers to create Anki decks programmatically—perfect for generating flashcards from databases, APIs, or other structured data sources.

Package available at: aur.archlinux.org/packages/python-genanki

python-ankipandas 0.3.15

ankipandas provides a pandas-based interface for reading and analyzing Anki collection databases, enabling data science workflows on your study data.

Package available at: aur.archlinux.org/packages/python-ankipandas

FreeBSD Ports Collection

FreeBSD’s ports system is more formal than the AUR, with stricter guidelines and a review process. Ports are submitted via Bugzilla and reviewed by committers before inclusion in the official ports tree.

py-genanki Port

Creating a FreeBSD port required several steps:

  1. Setting up the port skeleton – Creating the Makefile, pkg-descr, and distinfo files
  2. Handling dependencies – Mapping Python dependencies to existing FreeBSD ports
  3. Patching setup.py – Removing the pytest-runner build dependency which doesn’t exist in FreeBSD ports
  4. Testing the build – Running make and make install in a FreeBSD environment

The final Makefile:

PORTNAME=       genanki
PORTVERSION=    0.13.1
CATEGORIES=     devel python
MASTER_SITES=   PYPI
PKGNAMEPREFIX=  ${PYTHON_PKGNAMEPREFIX}

MAINTAINER=     chris.longros@gmail.com
COMMENT=        Library for generating Anki decks
WWW=            https://github.com/kerrickstaley/genanki

LICENSE=        MIT
LICENSE_FILE=   ${WRKSRC}/LICENSE.txt

RUN_DEPENDS=    ${PYTHON_PKGNAMEPREFIX}cached-property>0:devel/py-cached-property@${PY_FLAVOR} \
                ${PYTHON_PKGNAMEPREFIX}chevron>0:textproc/py-chevron@${PY_FLAVOR} \
                ${PYTHON_PKGNAMEPREFIX}frozendict>0:devel/py-frozendict@${PY_FLAVOR} \
                ${PYTHON_PKGNAMEPREFIX}pystache>0:textproc/py-pystache@${PY_FLAVOR} \
                ${PYTHON_PKGNAMEPREFIX}pyyaml>0:devel/py-pyyaml@${PY_FLAVOR}

USES=           python
USE_PYTHON=     autoplist distutils

.include <bsd.port.mk>

One challenge was that genanki’s setup.py required pytest-runner as a build dependency, which doesn’t exist in FreeBSD ports. The solution was to create a patch file that removes this requirement:

--- setup.py.orig       2026-01-11 15:32:48.887894000 +0100
+++ setup.py    2026-01-11 15:32:51.336128000 +0100
@@ -27,9 +27,6 @@
         'chevron',
         'pyyaml',
       ],
-      setup_requires=[
-          'pytest-runner',
-      ],
       tests_require=[
           'pytest>=6.0.2',
       ],

py-fsrs Port

The FSRS port followed a similar pattern, with its own set of dependencies to map to FreeBSD ports.

Both ports are available in my GitHub repository and have been submitted to FreeBSD Bugzilla for review:

Lessons Learned

Dependency Resolution

One of the biggest challenges in packaging is mapping upstream dependencies to existing packages in the target ecosystem. For FreeBSD, this meant:

  • Searching /usr/ports for existing Python packages
  • Understanding the @${PY_FLAVOR} suffix for Python version flexibility
  • Discovering hidden dependencies (like chevron) that weren’t immediately obvious from the package metadata

Build System Quirks

Python packaging has evolved significantly, with projects using various combinations of:

  • setup.py with setuptools
  • pyproject.toml with various backends (setuptools, flit, hatch, poetry)
  • Legacy setup_requires patterns that don’t translate well to system packaging

Creating patches to work around these issues is a normal part of the porting process.

Testing Across Platforms

Running a FreeBSD VM (via VirtualBox) proved essential for testing ports before submission. The build process can reveal missing dependencies, incorrect paths, and other issues that only appear in the actual target environment.

Summary

PackageVersionAURFreeBSD
python-fsrs / py-fsrs6.3.0✅ Published📝 Submitted
python-genanki / py-genanki0.13.1✅ Published📝 Submitted
python-ankipandas0.3.15✅ Published🔜 Planned

Get Involved

If you use these tools on Arch Linux or FreeBSD, I’d love to hear your feedback. And if you’re interested in contributing to open-source packaging:

  • AUR: Browse orphaned packages and consider adopting one you use
  • FreeBSD: Run pkg query -e %m=ports@FreeBSD.org %o to find unmaintained ports you have installed

Every package maintained is one less barrier to entry for users who want to use great software without fighting with dependency management.


Published: January 2026

Repository: github.com/chrislongros/freebsd-ports


Leave a comment

Discover more from /root

Subscribe now to keep reading and get access to the full archive.

Continue reading