Skip to main content

Generates a flatpak-builder build module for installing python packages defined in requirements.txt files.

Project description

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.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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

req2flatpak-0.3.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

req2flatpak-0.3.1-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file req2flatpak-0.3.1.tar.gz.

File metadata

  • Download URL: req2flatpak-0.3.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure

File hashes

Hashes for req2flatpak-0.3.1.tar.gz
Algorithm Hash digest
SHA256 528bd91151222ae9be3d293002fb04d7885db4628bdedc592473da1f364423e2
MD5 4cb31c5ace8ba7ce7f567669a19173f5
BLAKE2b-256 bebed8802a20ac61f51049612c8e8d3e44b6bcb3bc8f25b8ef6f1b9c4939d6a8

See more details on using hashes here.

File details

Details for the file req2flatpak-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: req2flatpak-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 12.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.2 CPython/3.12.3 Linux/6.8.0-1021-azure

File hashes

Hashes for req2flatpak-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1fc26c00d38d2b1c49115a764ab7decd69971fa7820548a0a232581643376a3c
MD5 3355162f4475eae0150464d5ce0f00be
BLAKE2b-256 17967f0186c12f8bdf37736690abccd07d24bb9de65f4fd6a4285b356c388a4a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page