pifpaf 3.4.0


pip install pifpaf

  Latest version

Released: Sep 29, 2025

Project Links

Meta
Author: Julien Danjou

Classifiers

Intended Audience
  • Information Technology

License
  • OSI Approved :: Apache Software License

Operating System
  • POSIX

Programming Language
  • Python
  • Python :: 3
  • Python :: 3.10
  • Python :: 3.11
  • Python :: 3.12

Topic
  • Software Development :: Testing
https://badge.fury.io/py/pifpaf.svg

Pifpaf is a suite of fixtures and a command-line tool that allows to start and stop daemons for a quick throw-away usage. This is typically useful when needing these daemons to run integration testing. It originaly evolved from its precussor overtest.

Supported daemons

Pifpaf currently supports:

Usage

To use Pifpaf, simply call the pifpaf run $daemon <command> program that you need. It will setup the temporary environment and export a few environment variable for you to access it:

$ pifpaf run postgresql psql template1
Expanded display is used automatically.
Line style is unicode.
SET
psql (9.4.5)
Type "help" for help.

template1=# \l
                              List of databases
   Name    │ Owner │ Encoding │   Collate   │    Ctype    │ Access privileges
───────────┼───────┼──────────┼─────────────┼─────────────┼───────────────────
 postgres  │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │
 template0 │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │ =c/jd            ↵
           │       │          │             │             │ jd=CTc/jd
 template1 │ jd    │ UTF8     │ en_US.UTF-8 │ en_US.UTF-8 │ =c/jd            ↵
           │       │          │             │             │ jd=CTc/jd
(3 rows)

template1=# \q
$

You can also run it with no command line provided:

$ eval `pifpaf run memcached`
$ env | grep PIFPAF
PIFPAF_PID=13387
PIFPAF_DAEMON=memcached
PIFPAF_URL=memcached://localhost:11212
PIFPAF_MEMCACHED_URL=memcached://localhost:11212
$ pifpaf_stop

Killing the daemon whose PID is contained in $PIFPAF_PID will stop the launched daemon and clean the test environment. You can kill it yourself or use the defined function pifpaf_stop.

Environment variables

Pifpaf exports a few environment variable:

  • PIFPAF_DAEMON which contains the name of the daemon launched

  • PIFPAF_URL which contains the URL to the daemon

  • PIFPAF_PID the PID of the pifpaf daemon

  • PIFPAF_$daemon_* variables, which contains daemon specific variables, such as port, database name, URL, etc.

Running several programs at once

Pifpaf provides the ability to change the prefix of its environment variable, allowing you to nest several Pifpaf instances and therefore running several daemons at once:

$ pifpaf --env-prefix STORAGE run memcached -- pifpaf --env-prefix INDEX run postgresql $SHELL
$ env | grep STORAGE
STORAGE_DATA=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpVreJ0J
STORAGE_MEMCACHED_PORT=11212
STORAGE_URL=memcached://localhost:11212
STORAGE_PID=71019
STORAGE_DAEMON=memcached
STORAGE_MEMCACHED_URL=memcached://localhost:11212
$ env | grep INDEX
INDEX_DATA=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmphAG7tf
INDEX_URL=postgresql://localhost/postgres?host=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmphAG7tf&port=9824
INDEX_PID=71021
INDEX_DAEMON=postgresql
INDEX_POSTGRESQL_URL=postgresql://localhost/postgres?host=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmphAG7tf&port=9824
$ echo $PIFPAF_URLS
memcached://localhost:11212;postgresql://localhost/postgres?host=/var/folders/7k/pwdhb_mj2cv4zyr0kyrlzjx40000gq/T/tmpQ2BWFH&port=9824

The PIFPAF_URLS environment variable will contain the list of all URLs detected and set-up by Pifpaf. You can override this variable name with the –global-urls-variable option.

How it works under the hood

Pifpaf will start the asked daemon using the current Posix user. The data file of the daemon will be placed in a temporary directory. The system-wide configured daemon that might exists is not touched at all.

Pifpaf expected to find daemon binaries on your system (like mysql, mysqld, pg_config, pg_ctl, rabbitmq-server, etc).

When the Python fixture is cleaned or when Pifpaf is terminated, the daemon is stopped and the temporary directory removed.

pifpaf.jpg
3.4.0 Sep 29, 2025
3.3.0 Feb 17, 2025
3.2.3 Oct 11, 2024
3.2.2 Oct 10, 2024
3.2.1 Aug 16, 2024
3.2.0 Aug 13, 2024
3.1.5 Feb 01, 2021
3.1.4 Jan 20, 2021
3.1.3 Jan 20, 2021
3.1.2 Jan 20, 2021
3.1.1 Dec 09, 2020
3.1.0 Dec 07, 2020
3.0.0 Aug 20, 2020
2.6.0 Aug 07, 2020
2.5.0 May 22, 2020
2.4.0 Jan 09, 2020
2.3.0 Dec 16, 2019
2.2.2 Jan 07, 2019
2.2.2.dev1 Jan 02, 2019
2.2.1 Dec 17, 2018
2.2.0 Dec 11, 2018
2.1.3.dev10 Nov 30, 2018
2.1.2 Oct 03, 2018
2.1.2.dev7 Jul 24, 2018
2.1.1 Mar 16, 2018
2.1.0 Mar 15, 2018
2.0.7 Mar 03, 2018
2.0.6 Feb 27, 2018
2.0.5 Feb 09, 2018
2.0.4 Feb 06, 2018
2.0.3 Feb 06, 2018
2.0.2 Jan 19, 2018
2.0.1 Jan 17, 2018
2.0.0 Jan 10, 2018
1.12.2.dev1 Jan 09, 2018
1.12.1 Jan 09, 2018
1.12.0 Dec 21, 2017
1.11.4 Dec 13, 2017
1.11.3 Dec 12, 2017
1.11.2 Dec 12, 2017
1.11.1 Nov 06, 2017
1.11.0 Nov 04, 2017
1.10.5 Oct 03, 2017
1.10.4 Sep 23, 2017
1.10.3 Sep 22, 2017
1.10.2 Aug 14, 2017
1.10.1 Aug 14, 2017
1.10.0 Aug 14, 2017
1.9.2 Jul 21, 2017
1.9.1 Jul 21, 2017
1.9.0 Jul 12, 2017
1.8.1 Jul 06, 2017
1.8.0 Jul 05, 2017
1.7.0 Jul 04, 2017
1.6.0 Jul 03, 2017
1.5.2 Jul 02, 2017
1.5.1 Jul 02, 2017
1.5.0 Jul 01, 2017
1.4.11 Jun 30, 2017
1.4.10 Jun 30, 2017
1.4.9 Jun 28, 2017
1.4.8 Jun 28, 2017
1.4.7 Jun 28, 2017
1.4.6 Jun 28, 2017
1.4.5 Jun 27, 2017
1.4.4 Jun 27, 2017
1.4.3 Jun 27, 2017
1.4.2 Jun 27, 2017
1.4.1 Jun 27, 2017
1.4.0 Jun 26, 2017
1.3.1 Jun 08, 2017
1.3.0 Jun 08, 2017
1.2.0 Jun 08, 2017
1.1.0 Apr 28, 2017
1.0.1 Apr 27, 2017
1.0.0 Apr 27, 2017
0.27.1 Apr 25, 2017
0.27.0 Apr 22, 2017
0.26.0 Mar 21, 2017
0.25.1 Mar 01, 2017
0.25.0 Feb 24, 2017
0.24.1 Feb 03, 2017
0.24.0 Feb 03, 2017
0.23.0 Jan 21, 2017
0.22.0 Jan 20, 2017
0.21.0 Jan 20, 2017
0.20.0 Jan 13, 2017
0.19.0 Jan 13, 2017
0.18.1 Jan 03, 2017
0.18.0 Dec 17, 2016
0.17.0 Dec 06, 2016
0.16.0 Nov 30, 2016
0.15.1 Nov 10, 2016
0.15.0 Nov 09, 2016
0.14.0 Nov 07, 2016
0.13.0 Sep 13, 2016
0.12.0 Aug 09, 2016
0.11.1 Aug 07, 2016
0.11.0 Aug 06, 2016
0.10.5 Aug 03, 2016
0.10.3 Jul 24, 2016
0.10.2 Jul 22, 2016
0.10.1 Jul 22, 2016
0.10.0 Jul 21, 2016
0.9.0 Jul 19, 2016
0.8.2 Jul 18, 2016
0.8.1 Jul 18, 2016
0.8.0 Jul 04, 2016
0.7.0 Jul 04, 2016
0.6.0 Jun 15, 2016
0.5.0 Jun 09, 2016
0.4.0 May 23, 2016
0.3.0 May 20, 2016
0.2.1 May 16, 2016
0.2.0 May 13, 2016
0.1.0 May 09, 2016
0.0.11 May 02, 2016
0.0.10 May 02, 2016
0.0.9 Apr 26, 2016
0.0.8 Apr 13, 2016
0.0.7 Apr 08, 2016
0.0.6 Apr 01, 2016
0.0.5 Mar 31, 2016
0.0.4 Mar 30, 2016
0.0.3 Mar 29, 2016
0.0.2 Mar 29, 2016
0.0.1 Mar 25, 2016

Wheel compatibility matrix

Platform Python 3
any

Files in release

Extras:
Dependencies:
daiquiri
click
jinja2
fixtures
packaging
psutil
xattr