Skip to content

Conversation

@sezanzeb
Copy link
Owner

@sezanzeb sezanzeb commented Nov 29, 2025

closes #1170

pip, in many cases, fails to install data files, which need to go into system paths, and instead puts them (despite them being absolute paths, and common workarounds/fixes) into /usr/lib/python3/inputremapper/usr/share/...

python3 setup.py install is deprecated. So I had to remove the existing installation shell script.

meson fails to install the module into a path that can actually be imported, and its python features require one to specify each individual file of the module.

So instead input-remapper will use a custom python solution. Hopefulls this works well enough to prevent all ModuleNotFoundErrors in the future.

Surprisingly, this is not much more code that would otherwise be required. We already had the data_files list and would need it with meson as well with more boilerplate. The python code to generate translations was already there. We (even with meson) need to figure out the correct python-package target path (see code comments). And on the upside, we have a lot of flexibility and control without having to dig into configuration, unexpected behavior and deal with any further limitations.

This PR also changes github workflows

  • runs tests not as root anymore, which previously probably made them run with ubuntu-lts python3.12 every time, instead of the min and max versions
  • adds ruff
  • tests if the .deb build and the install module install correctly and result in a working system

Important changes for packaging:

  • setup.py is replaced with pyproject.toml now. So setup.py install cannot be used anymore
  • building can be done via python3 -m install --root ./foo, which puts all files in the expected target directory structure in root. In my case, on ubuntu 25.04, the module ends up in foo/usr/lib/python3/dist-packages. It picks the best option from python3 -c "import sys; print(sys.path)" for this. If this is missing a feature to make it helpful for packaging, please let me know
  • commit_hash.py is not built anymore, instead, values are inserted into installation_info.py

@sezanzeb
Copy link
Owner Author

sezanzeb commented Nov 29, 2025

TODO:

  • Fix ci
  • backup my computer
  • try python3 -m install --root / locally (works fine in the workflow vm already)
  • wait until next weekend in case something comes to mind
  • Tell package maintainers about the change
  • shell.nix uses setup.py
  • Merge

@sezanzeb sezanzeb changed the title Switch to pyproject.toml, move to custom solution for building Switch to pyproject.toml and custom solution for building Nov 30, 2025
@sezanzeb
Copy link
Owner Author

@LunNova shell.nix uses setup.py (python setup.py egg_info), which is removed in this PR. I don't know anything about this file and don't use it, could you please check how this needs to change?

@LunNova
Copy link
Contributor

LunNova commented Dec 22, 2025

Kinda busy right now, could just delete shell.nix. If I'm actively submitting patches and it's convenient to have around again in the future I can PR an updated version.

@sezanzeb sezanzeb merged commit 0e1e0be into main Dec 25, 2025
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

setup.py and especially data_files are deprecated

6 participants