Introducing py-pkg: Python wrappers for libpkg

For the past few weeks I’ve been working on a Python project and since
then I really enjoy using Python everyday.

Now is the time to actually present the project, so let me introduce
to you py-pkg – Python wrappers for FreeBSD’s libpkg library.

Here I’ll just try to add a few lines about py-pkg and what is
interesting about it. Then I’ll show you a few examples on how to use
py-pkg in order to manage your FreeBSD package database!

General Information

Q: So, what is py-pkg?

The goal of py-pkg is to provide Python wrappers for FreeBSD’s
libpkg library. The wrappers themself are written in
Cython, which gives you the flexibility and power
to use Python with C data structures, very neat! :)

The Python wrappers themself are being compiled as a shared library
and can be imported into Python as any other Python module.

Q: So, what can I use py-pkg for?

You can do a lot with it, here are just a few examples:

Querying information about your packages

Searching remote repositories for packages

Install packages

Delete packages

Upgrade packages

etc, etc, etc.

Q: Yeah, I can do that with pkg(8) already, what’s the point of
py-pkg?

The idea of py-pkg is to expose libpkg functionallity to Python in
a way that pkg(8) already uses it.

Think about this for a second: what does it take to write a Gtk/Qt
interface for libpkg in C and what does it take to do the same thing
in Python? I’m sure you know the answer already.

So, by providing Python wrappers for libpkg, new doors open for
you. Just think about it – new frontends, new plugins, etc. and all
that you can do in Python! :)