Offline Flathub build with PySide6 dependency

Hi.
I am trying to publish my first app in Flathub. Unfortunately, my manifesto contained an argument granting web access permissions to the build tool to download the PySide6 dependency. I was asked to make the build offline and therefore not use this permission. Unfortunately, I don’t know how to get rid of this permission well and still be able to build the application using PySide6.

Manifest without internet access for builder:

app-id: eu.cichy1173.tabela
runtime: org.kde.Platform
runtime-version: '6.2'
sdk: org.kde.Sdk
command: tabela
finish-args:
  - --share=ipc
  - --share=network
  - --socket=x11
  - --device=dri
  - --filesystem=host
desktop-file-name: eu.cichy1173.eu.desktop
modules:
  - name: tabela
    buildsystem: simple
    build-commands:
      - python -m pip install --prefix=/app .
    sources:
      - type: git
        url: https://codeberg.org/cichy1173/tabela-flatpak.git
        commit: 73753ba98060e0b8f792f306e36eafbe941b6b55
    build-extensions:
      - org.freedesktop.Sdk.Extension.python3.9
    extra-data:
      - name: icons
        dest: share/icons/hicolor
        sources:
          - type: file
            path: tabela.png

Repository for my application: cichy1173/tabela-flatpak: Repository for Flatpak version of tabela app - tabela-flatpak - Codeberg.org

Setup.py file:

from setuptools import setup

package_name = 'tabela'
filename = 'tabela/__init__.py'

setup(
    name='tabela',
    version='1.0',
    description='Simple app that shows CSV content in table.',
    author='cichy1173',
    author_email='grzegorz@cichy1173.eu',
    packages=['tabela'],
    install_requires=[
        'PySide6',  
    ],
    entry_points={
        'console_scripts': [
            'tabela=tabela.main:main', 
        ],
    },
)

Thanks in Advance

Add these modules to your Manifest:

  - name: qt-include
    # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-787
    buildsystem: simple
    build-commands:
      - mkdir -p /app/include/qt
      - cp -R /usr/include/Qt* /app/include/qt
    cleanup:
      - /include

  - name: PySide6
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
    config-opts:
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_TESTS=OFF
    sources:
      - type: archive
        url: https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-6.5.1.1-src/pyside-setup-everywhere-src-6.5.1.1.tar.xz
        sha256: 9741a06f0b7d4b2168818448134bc7e96ddb5efb846a3915b4177ba4159b5b78
      - type: shell
        commands:
          # use qt-include
          - sed -i 's|\(--include-paths=\)|\1/app/include/qt:|' sources/pyside6/cmake/Macros/PySideModules.cmake
          # fix python module search path
          - sed -i '/--sys-path\b/ a "${pysidebindings_BINARY_DIR}/.."' sources/pyside6/cmake/Macros/PySideModules.cmake
    cleanup:
      - /plugins
      - /include
      - /bin
``

Hello! Thank You for your answer! I added this, and manifest now looks like that:

app-id: eu.cichy1173.tabela
runtime: org.kde.Platform
runtime-version: '6.2'
sdk: org.kde.Sdk
command: tabela
finish-args:
  - --share=ipc
  - --share=network
  - --socket=x11
  - --device=dri
  - --filesystem=host

modules:
  #       sha256: d9680ff298ee8b01a68de20911c60da04568a0918b3062d4c571ef170b4603ff
  - name: qt-include
    # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-787
    buildsystem: simple
    build-commands:
      - mkdir -p /app/include/qt
      - cp -R /usr/include/Qt* /app/include/qt
    cleanup:
      - /include

  - name: PySide6
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
    config-opts:
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_TESTS=OFF
    sources:
      - type: archive
        url: https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-6.5.1.1-src/pyside-setup-everywhere-src-6.5.1.1.tar.xz
        sha256: 9741a06f0b7d4b2168818448134bc7e96ddb5efb846a3915b4177ba4159b5b78
      - type: shell
        commands:
          # use qt-include
          - sed -i 's|\(--include-paths=\)|\1/app/include/qt:|' sources/pyside6/cmake/Macros/PySideModules.cmake
          # fix python module search path
          - sed -i '/--sys-path\b/ a "${pysidebindings_BINARY_DIR}/.."' sources/pyside6/cmake/Macros/PySideModules.cmake
    cleanup:
      - /plugins
      - /include
      - /bin
  - name: tabela
    buildsystem: simple
    build-commands:
      - python -m pip install --prefix=/app .
    sources:
      - type: git
        url: https://codeberg.org/cichy1173/tabela-flatpak.git
        commit: 73753ba98060e0b8f792f306e36eafbe941b6b55

I have this error:

CMake Error at sources/shiboken6/cmake/ShibokenHelpers.cmake:170 (find_package):
  Could not find a package configuration file provided by "Clang" with any of
  the following names:

    ClangConfig.cmake
    clang-config.cmake

  Add the installation prefix of "Clang" to CMAKE_PREFIX_PATH or set
  "Clang_DIR" to a directory containing one of the above files.  If "Clang"
  provides a separate development package or SDK, be sure it has been
  installed.
Call Stack (most recent call first):
  sources/shiboken6/cmake/ShibokenSetup.cmake:38 (setup_clang)
  sources/shiboken6/CMakeLists.txt:14 (include)


-- Configuring incomplete, errors occurred!
See also "/run/build/PySide6/_flatpak_build/CMakeFiles/CMakeOutput.log".
See also "/run/build/PySide6/_flatpak_build/CMakeFiles/CMakeError.log".
Error: module PySide6: Proces potomny zostaΕ‚ zakoΕ„czony z kodem 1

I also tried to use Flatpak PIP Generator for generating all this modules using requirments.txt, but i have this error:

Running: "flatpak --filesystem=/home/cichy1173/Projekty/tabela-flatpak/requirements.txt --devel --share=network --filesystem=/tmp --command=pip3 run org.kde.Sdk//6.2 download --exists-action=i --dest /tmp/pip-generator-pypi-dependenciesf05pzzqh -r /home/cichy1173/Projekty/tabela-flatpak/requirements.txt"
Collecting PySide6==6.2.0
  Downloading PySide6-6.2.0-6.2.0-cp36.cp37.cp38.cp39.cp310-abi3-manylinux1_x86_64.whl (269.4 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 269.4/269.4 MB 11.0 MB/s eta 0:00:00
Collecting shiboken6==6.2.0
  Downloading shiboken6-6.2.0-6.2.0-cp36.cp37.cp38.cp39.cp310-abi3-manylinux1_x86_64.whl (996 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 996.5/996.5 kB 14.8 MB/s eta 0:00:00
Saved /tmp/pip-generator-pypi-dependenciesf05pzzqh/PySide6-6.2.0-6.2.0-cp36.cp37.cp38.cp39.cp310-abi3-manylinux1_x86_64.whl
Saved /tmp/pip-generator-pypi-dependenciesf05pzzqh/shiboken6-6.2.0-6.2.0-cp36.cp37.cp38.cp39.cp310-abi3-manylinux1_x86_64.whl
Successfully downloaded PySide6 shiboken6
========================================================================
Downloading arch independent packages
========================================================================
Traceback (most recent call last):
  File "/home/cichy1173/Projekty/tabela-flatpak/flatpak-pip-generator", line 271, in <module>
    url = get_tar_package_url_pypi(name, version)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/cichy1173/Projekty/tabela-flatpak/flatpak-pip-generator", line 88, in get_tar_package_url_pypi
    raise Exception(err)
Exception: Failed to get shiboken6-6.2.0 source from https://pypi.org/pypi/shiboken6/6.2.0/json

Sorry, forgot to mention. you need also to add this:

sdk-extensions:
  - org.freedesktop.Sdk.Extension.llvm16
build-options:
    append-path: /usr/lib/sdk/llvm16/bin
    prepend-ld-library-path: /usr/lib/sdk/llvm16/lib

This needs to be added above the modules section.

Please note that the runtime version 6.2 you use is deprecated. You should use version 6.5 instead.

Thank You for your response. I feel I am getting there, but I still have some problems.

I changed runtime for 6.5 and I changed setup.py on codeberg.

Manifest:

app-id: eu.cichy1173.tabela
runtime: org.kde.Platform
runtime-version: '6.5'
sdk: org.kde.Sdk
command: tabela
finish-args:
  - --share=ipc
  - --share=network
  - --socket=x11
  - --device=dri
  - --filesystem=host

sdk-extensions:
  - org.freedesktop.Sdk.Extension.llvm16
build-options:
    append-path: /usr/lib/sdk/llvm16/bin
    prepend-ld-library-path: /usr/lib/sdk/llvm16/lib

modules:
  - name: qt-include
    # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-787
    buildsystem: simple
    build-commands:
      - mkdir -p /app/include/qt
      - cp -R /usr/include/Qt* /app/include/qt
    cleanup:
      - /include

  - name: PySide6
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_TESTS=OFF
    sources:
      - type: archive
        url: https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-6.5.1.1-src/pyside-setup-everywhere-src-6.5.1.1.tar.xz
        sha256: 9741a06f0b7d4b2168818448134bc7e96ddb5efb846a3915b4177ba4159b5b78
      - type: shell
        commands:
          # use qt-include
          - sed -i 's|\(--include-paths=\)|\1/app/include/qt:|' sources/pyside6/cmake/Macros/PySideModules.cmake
          # fix python module search path
          - sed -i '/--sys-path\b/ a "${pysidebindings_BINARY_DIR}/.."' sources/pyside6/cmake/Macros/PySideModules.cmake
    cleanup:
      - /plugins
      - /include
      - /bin
  - name: tabela
    buildsystem: simple
    build-commands:
      - python -m pip install --prefix=/app .
    sources:
      - type: git
        url: https://codeberg.org/cichy1173/tabela-flatpak.git
        commit: bed5fcacf23d5fd958c8ce12ec584b6c96a956ff

Setup.py (I added version for pyside6)

from setuptools import setup

package_name = 'tabela'
filename = 'tabela/__init__.py'

setup(
    name='tabela',
    version='1.0',
    description='Simple app that shows CSV content in table.',
    author='cichy1173',
    author_email='grzegorz@cichy1173.eu',
    packages=['tabela'],
    install_requires=[
        'PySide6==6.5.0',  
    ],
    entry_points={
        'console_scripts': [
            'tabela=tabela.main:main',  
        ],
    },
)

But i have this problem:

INFO: pip is looking at multiple versions of tabela to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement PySide6==6.5.0 (from tabela) (from versions: none)
ERROR: No matching distribution found for PySide6==6.5.0
Error: module tabela: Proces potomny zostaΕ‚ zakoΕ„czony z kodem 1

I must add that, building with command python -m pip install . works. Also I had no issues with Snap package.

Try adding --no-deps --no-build-isolation to your pip command

THANK YOU!! It is working now that how it should be!

I am sorry for being that needy for help, but I see you have a lot of experience with Flatpak. Can you tell me if is everything right with my app for publishing app in Flathub? Repo of the app: cichy1173/tabela-flatpak: Repository for Flatpak version of tabela app - tabela-flatpak - Codeberg.org

Manifesto for flathub:

app-id: eu.cichy1173.tabela
runtime: org.kde.Platform
runtime-version: '6.5'
sdk: org.kde.Sdk
command: tabela
finish-args:
  - --share=ipc
  - --share=network
  - --socket=x11
  - --device=dri
  - --filesystem=host

sdk-extensions:
  - org.freedesktop.Sdk.Extension.llvm16
build-options:
    append-path: /usr/lib/sdk/llvm16/bin
    prepend-ld-library-path: /usr/lib/sdk/llvm16/lib

modules:
  - name: qt-include
    # https://bugreports.qt.io/projects/PYSIDE/issues/PYSIDE-787
    buildsystem: simple
    build-commands:
      - mkdir -p /app/include/qt
      - cp -R /usr/include/Qt* /app/include/qt
    cleanup:
      - /include

  - name: PySide6
    buildsystem: cmake-ninja
    builddir: true
    config-opts:
      - -DCMAKE_BUILD_TYPE=Release
      - -DBUILD_TESTS=OFF
    sources:
      - type: archive
        url: https://download.qt.io/official_releases/QtForPython/pyside6/PySide6-6.5.1.1-src/pyside-setup-everywhere-src-6.5.1.1.tar.xz
        sha256: 9741a06f0b7d4b2168818448134bc7e96ddb5efb846a3915b4177ba4159b5b78
      - type: shell
        commands:
          # use qt-include
          - sed -i 's|\(--include-paths=\)|\1/app/include/qt:|' sources/pyside6/cmake/Macros/PySideModules.cmake
          # fix python module search path
          - sed -i '/--sys-path\b/ a "${pysidebindings_BINARY_DIR}/.."' sources/pyside6/cmake/Macros/PySideModules.cmake
    cleanup:
      - /plugins
      - /include
      - /bin
  - name: tabela
    buildsystem: simple
    build-commands:
      - python -m pip install --no-deps --no-build-isolation --prefix=/app .
    sources:
      - type: git
        url: https://codeberg.org/cichy1173/tabela-flatpak.git
        commit: bed5fcacf23d5fd958c8ce12ec584b6c96a956ff

I suggest you to just create the submit PR. It will be reviewed there.

I created that files (.desktop and xml appstream which I have in root directory on codeberg repo - sorry, I tried to link this files, but the forum marked them as spam/ad), but I think, I use this files in a wrong way. How can I fix this? @JakobDev