Package: req2flatpak
req2flatpakreq2flatpakis 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 Usereq2flatpak is for programmers
who want to package a python application using flatpak.The req2flatpak script takes python package requirements as input, e.g., asrequirements.txtfile. It allows to specify the target platform’s
python version and architecture. The script outputs an automatically
generatedflatpak-builderbuild module. The build module, if included
into a flatpak-builder build manifest, will install the python packages
using pip.Getting StartedRunpip install req2flatpakto install the latest release of req2flatpak.It is possible to use req2flatpak from the commandline,
as well as programmatically from a python script.Commandline usage means you can invoke req2flatpak’s commandline interface
as follows, in order to generate aflatpak-builderbuild module
from given python package requirements:./req2flatpak.py--requirements-filerequirements.txt--target-platforms310-x86_64310-aarch64When 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,
runreq2flatpak.py--help.Programmatic usage is also possible.
This means you can invoke functionality from req2flatpak in your own python script,
allowing you to tweak the desired behavior in many ways.
Thedocumentationdescribes req2flatpak’s python api and includes code examples
to help you get started quickly.DocumentationSeehttps://johannesjh.github.io/req2flatpak/Contributingreq2flatpak 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.Related WorkTheflatpak-pip-generatorscript is very similar to this project. Both scripts basically serve the same purpose,
and this project took a lot of inspiration from
flatpak-pip-generator. In fact, this project was created when we
discussed feature request#296in flatpak-pip-generator. A prototype followed from this feature
request, and since it was written from scratch, the prototype became
this separate project.Comparison betweenflatpak-pip-generatorandreq2flatpak.py:
Each of the two projects has its own benefits.
A comparison will likely change over time.
As in Oct, 2022, in my personal opinion (johannesjh),
I see the following similarities and differences:Both projects generate build modules for flatpak-builder.Both projects consist of a single script file with minimal
dependencies, and are thus very easy to install.flatpak-pip-generatorresolves dependencies and freezes
dependency versions, whereasreq2flatpak.pyasks the user to
provide a fully resolved list of dependencies with frozen dependency
versions. Various tools exist which make this easy, e.g.,
pip, pip-compile and poetry.flatpak-pip-generatoris older and thus likely to be more mature.
It supports more commandline options and probably has a more complete
feature set.req2flatpak.pyis faster. The script itself runs faster because
it does not need to download package files in order to generate the
build module. And the flatpak build runs faster because all packages
(from the entirerequirements.txtfile) are installed in a single
call topip install.req2flatpak.pyre-implements some functionality of pip. In
contrast,flatpak-pip-generatoruses pip’s official
functionality. Specifically,req2flatpak.pyre-implements how pip
queries available downloads from pypi and how pip chooses suitable
downloads to match a given target platform.req2flatpak.pyprefers binary wheels, whereasflatpak-pip-generatorprefers source packages.Licensereq2flatpak is MIT-licensed, see theCOPYINGfile.Changelogv0.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.yamlfile extension
or by specifying the--yamlcommandline option.Bugfixes:Fixes sorting when architecture is None -#34Fixes exception handling with invalid platforms -#39v0.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.