Python Desktop application distribution

Indeed, a wheel with pinned dependencies (both direct and indirect) would perfectly do the job, but i did not found a way to create 2 wheels from the same repository (using poetry), one that pinned one not. My request on poetry has been denied some times ago:

$ poetry build
=> generates dist/myapp.whl

$ poetry build --frozen-wheel --suffix "-pinned"
=> generates dist/myapp-pinned.whl
1 Like

Right… one more example showing that Python packaging is better at dealing with libraries than applications.

If I were you I guess maybe I would investigate writing a script that modifies the pyproject.toml (based on the lockfile) and use it in a CI/CD pipeline.

Maybe something like this:

  • Let Poetry export a requirements.txt (see also poetry-plugin-export)
  • Read the requirements.txt
  • Read the pyproject.toml file with tomllib
  • Generate a new pyproject.toml file where
    • the dependencies are substituted with the pinned ones and all the indirect ones
    • the project name is changed (-pinned suffix?)
  • Let Poetry (or build) generate a wheel

Maybe not super easy, but seems feasible (at least on paper).

And, as I write the above I realize that maybe I should look if there are plugins that do this… and well, yes:

1 Like