Skip to main content

req2flatpak

req2flatpak is a script to convert python package requirements to a flatpak-builder build module. The module will install the required python packages as part of a flatpak build.

Intended Use

req2flatpak is for programmers who want to package a python application using flatpak.

The req2flatpak script takes python package requirements as input, e.g., as requirements.txt file. It allows to specify the target platform’s python version and architecture. The script outputs an automatically generated flatpak-builder build module. The build module, if included into a flatpak-builder build manifest, will install the python packages using pip.

Getting Started

Install req2flatpak using pip (or any other python package installer), e.g., by running pip install req2flatpak.

Prepare a requirements.txt file with the packages that you want to install as part of a flatpak build. You need to specify exact versions for all the packages including their dependencies. (Various tools exist to help creating such a requirements file with fully resolved dependencies and frozen package versions; for example, you can use pip-compile or poetry export to export a suitable requirements.txt file).

Run req2flatpak. For example, run this command to generate a flatpak-builder build module from your requirements.txt file:

./req2flatpak.py --requirements-file requirements.txt --target-platforms 310-x86_64 310-aarch64

When invoked like this, req2flatpak will read the requirements file, query pypi about available downloads for the requirements, choose appropriate downloads for the specified target platforms, and generate a flatpak-builder build module. The module, if included in a flatpak-builder build manifest, will install the required packages using pip. The commandline option to define target platforms uses the format <pythonversion>-<architecture>. To learn more about available commandline options, run req2flatpak.py --help.

Note that programmatic usage of req2flatpak is also possible. This means you can write a python script to invoke req2flatpak, which allows to tweak the desired behavior in many ways.

Go read the documentation to learn more about req2flatpak’s commandline and Python APIs. The documentation includes further examples to help you get started quickly.

Documentation

See https://johannesjh.github.io/req2flatpak/

Contributing

req2flatpak is developed in an open-source, community-driven way, as a voluntary effort in the authors’ free time.

All contributions are greatly appreciated… pull requests are welcome, and so are bug reports and suggestions for improvement. See req2flatpak’s documentation for how to set up a development environment and how to contribute back to req2flatpak.

License

req2flatpak is MIT-licensed, see the COPYING file.

Changelog

v0.3.2 (2026-11-15)

Improvements:

  • Relaxed the version constraint for the packaging dependency from ^21.3 to >=21.3, see #92

Fixes:

  • Close output stream which was causing empty outfile files on Python 3.14, see #91

Full Changelog: https://github.com/johannesjh/req2flatpak/compare/v0.3.1…v0.3.2

v0.3.1 (2025-03-30) “Python 3.12”

Highlight: Compatibility with Python 3.12

Improvements for Development:

  • Improved CI #73 #79 #82

  • Added devcontainers configuration #65

  • Now using ruff for linting #87

Fixes:

  • Fixed an error when no urls are found in a pypi release in #71

Maintenance and dependency updates:

  • Updated dependencies in #62 #74

  • Improved docs in #77 #81 #86

  • Now using packaging instead of the deprecated pkg_resources package #76

Full Changelog: https://github.com/johannesjh/req2flatpak/compare/v0.2…v0.3

v0.2 (2023-06-04) “Yaml”

Highlight: req2flatpak can now generate yaml output.

Features:

  • Adds yaml output. It is now possible to generate yaml output by specifying a .yaml file extension or by specifying the --yaml commandline option.

Bugfixes:

  • Fixes sorting when architecture is None - #34

  • Fixes exception handling with invalid platforms - #39

v0.1 (2022-12-23) “Initial Release”

Highlight: This is the initial release of req2flatpak.

Features:

  • Generates a flatpak-builder build module for given python package requirements; the module will install the required packages as part of a flatpak build.

  • This initial release already comes with documentation, a clean code style, and automated tests that are run using continuous integration.

Metadata

Release files for req2flatpak 0.3.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for req2flatpak 0.3.2
File Size Uploaded Provenance Actions
req2flatpak-0.3.2.tar.gz 13.4 kB Without provenance Details for req2flatpak-0.3.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for req2flatpak 0.3.2
File Interpreter ABI Platform Actions
req2flatpak-0.3.2-py3-none-any.whl Python 3 none any Details for req2flatpak-0.3.2-py3-none-any.whl

Total release size: 26.0 kB

Release files / req2flatpak-0.3.2.tar.gz

Download URL req2flatpak-0.3.2.tar.gz
Size 13.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e322aa79b94b9003fdab4f810b30cb1a4fee808cfa4a0d374d016ae87b72341b
BLAKE2b-256 checksum
How to use checksums
cb8d6cec28fda9b95bc9da5b44f91a607d18291097a9a9d123dd551d182c5810
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1019-azure

Release files / req2flatpak-0.3.2-py3-none-any.whl

Download URL req2flatpak-0.3.2-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ab977ae80bf404f9c63911f8fb4789c2e50fb8f8e00597770ebcab0a4184a48
BLAKE2b-256 checksum
How to use checksums
af3898c73e539f29b1d5bdce261eb55f8e65c14dbde43a9fec0c9d67c2f2fcb5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.5.1 CPython/3.14.4 Linux/7.0.0-1019-azure

Security for req2flatpak 0.3.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page