Closed RedBearAK closed 2 months ago
From the README:
From release 0.5 onwards, the version numbering of this package will relate to releases of libxkbcommon as follows:
If the Python package version is major.minor[.patch] then it requires at least release major.minor.0 of libxkbcommon to build and run, and should work with any subsequent release. The patch version of the Python package is unrelated to the patch version of libxkbcommon.
So release 1.0.1 requires libxkbcommon-dev >= 1.0, release 1.5 requires libxkbcommon-dev >= 1.5, and so on. I don't know how to express this requirement in the setup.cfg
file, though.
If you don't use any features of releases 1.5 and 1.6 then it is safe to require <1.5 as you have done.
Yeah, I saw that note, but the version of libxkbcommon-dev
on Ubuntu 20.04 was 0.10.1 or something, so I really didn't know what to make of it in relation to the note.
For now I've gone ahead and pinned xkbcommon
to <=1.0.1
for everything. The fact that two different versions were released at the same time had me a little confused, and concerned that another parallel release between 1.0.1 and 1.5 might cause the same problem. (?)
At the moment I have no understanding of which distros and distro versions the 1.5 release would even work on. I'd have to try to test the version of libxkbcommon-dev
available on different distro types (under different package names), and on Ubuntu 20.04 it definitely wasn't 1.0 or greater. So I don't really understand the relationship.
I also have no clue if I would ever use features in 1.5 or later. I have only been using this module for accessing the list of keyboard layouts, and the keymaps. Don't really know much more about what this is for.
The plan is to use the extracted keymaps to help an evdev
keymapper be smarter about working with non-US layouts. But I haven't gotten very far with that.
I think I'll have to address this with a documentation update, listing relevant versions of libxkbcommon and the API features introduced in them and recommending that people always specify a maximum version when depending on python-xkbcommon. For your case I'd recommend depending on xkbcommon<1.1
so you will pick up any bug fixes released in the 1.0 series.
If you are also using python-xkbregistry
then I'd recommend depending on xkbregistry<1.1
as well.
Ubuntu 20.04 has libxkbcommon-0.10 — I am surprised python-xkbcommon 1.0.1 still works on it, I removed ubuntu-20.04 from the CI after release 0.8!
xkb_keysym_to_upper()
and xkb_keysym_to_lower()
xkb_keymap_key_get_mods_for_level()
XKB_CONTEXT_NO_SECURE_GETENV
I plan to maintain branches for 1.0, 1.5 and 1.6 going forward, at least until there are no supported distros left that have earlier libxkbcommon than 1.5.
I think I'll have to address this with a documentation update, listing relevant versions of libxkbcommon and the API features introduced in them and recommending that people always specify a maximum version when depending on python-xkbcommon.
For those who read the documentation like they should, that would be good. Wouldn't have helped me, I didn't really expect this to be something that would change much. Shows what I know.
For your case I'd recommend depending on xkbcommon<1.1 so you will pick up any bug fixes released in the 1.0 series.
Sounds like a good idea. I'll do that. A lot of Linux users are stuck on LTS distros that probably won't be updating libxkbcommon-dev
anytime soon.
If you are also using python-xkbregistry then I'd recommend depending on xkbregistry<1.1 as well.
OK, but I actually kind of had the opposite problem with xkbregistry
. It was so new that it had no supporting package on AlmaLinux 8.x (my proxy for RHEL 8 and clones). I gave up on using it. Seems like I can get what I need from xkbcommon
.
Unless xkbregistry
has the miraculous ability to tell me the user's currently active layout at any given time, and when it changes. That would be incredibly helpful. I have found some D-Bus signals in KDE Plasma and a dconf
key that can be watched with dconf watch
in GNOME, but all other methods I've found on the web for knowing the active layout have failed to show anything but a list of enabled layouts. Not the active one, or when the user switches layouts.
It is my current understanding that neither xkbcommon
nor xkbregistry
has the ability to know the currently active layout. I have to find some way to talk to X11 or the Wayland compositor, or use some other native method like those I recently discovered for Plasma and GNOME. From Python.
I plan to maintain branches for 1.0, 1.5 and 1.6 going forward, at least until there are no supported distros left that have earlier libxkbcommon than 1.5.
That's... gonna be a while, I think.
Thanks for the info. I should be good from now on, I hope. 👍🏽
You should be able to get the currently active layout for Wayland reasonably easily — the way keyboard handling works in Wayland clients is that the compositor passes the keymap to the client (by sending an fd for them to mmap), and the client then uses something like libxkbcommon to interpret the keymap and make sense of the keycodes being sent.
There's an example of this in the demo app for my pure Python Wayland implementation but please don't base any new code on that — use pywayland instead if you want to go down that route.
Under X, you would probably want to use libxkbcommon-x11
as described in #14. Someone will have to write the Python bindings for that, though — it'll be a separate project that depends on python-xkbcommon and also xcffib.
I've released version 1.5.1 with the documentation update so it will show on the project page on pypi.
I will hold off releasing version 1.6 because that will catch out even more people (it's only present in Ubuntu 24.04 as far as I can tell — Debian bookworm only has libxkbcommon-1.5). Let's give it six months to a year before a release...
@sde1000 @flacjacket @mbey-mw
Somebody using a project of mine that installs
xkbcommon
in a Python virtual environment filed a report this morning about a weird installation error on Ubuntu 20.04. I was able to replicate on Ubuntu, and just kind of assumed thelibxkbcommon
on Ubuntu 20.04 was too old for the latestxkbcommon
release, even though that didn't make too much sense. So I pinned the version to something older for Ubuntu 20.04 and it started working again.But then I tested other distros and I've been running into the same error, where previously I was installing
xkbcommon
without any issue on distros as old as CentOS 7, as long as thelibxkbcommon
development package was installed.For now, I'm pinning the version to avoid the new 1.5 release.
This makes the install use the 1.0.1 version that was released on the same day. Yesterday.
https://pypi.org/project/xkbcommon/#history
Since I don't know exactly what is going wrong, I'm hesitant to rely on that. I'm thinking about pinning to the 1.0.1 release explicitly until I know more about the cause of this problem.
The error messages go like this, during installing packages in the
venv
withpip
.I have a wide selection of different distros I have to keep this working on, if I'm going to use this Python module. Just want to know what's happening here.