Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elaborate on gir1.2-webkit2-4.0 in README.md #51

Open
sevaseva opened this issue Apr 27, 2023 · 4 comments
Open

Elaborate on gir1.2-webkit2-4.0 in README.md #51

sevaseva opened this issue Apr 27, 2023 · 4 comments
Labels
question Further information is requested

Comments

@sevaseva
Copy link

What is gir1.2-webkit2-4.0 (or how that can be installed) in various distros? That is both important (assuming gir1.2-webkit2-4.0 is still really a hard dependency as README.md suggests) and nontrivial to find out. Please consider clarifying that. Thank you!

Note that neither install.sh nor the AUR package seems to check or install it.

Right now I primarily care about Manjaro, Arch, Fedora (in this order), but some other popular distros may be worth attention too.

@sevaseva
Copy link
Author

results of a quick investigation, fwiw

Ulauncher/Ulauncher#48 (comment) from 2016 and in the context of Arch says

all gir... packages are in gobject-introspection

Below are Manjaro and AUR packages matching gobject-introspection substring today.
Only the last few lines of the output seem to be relevant, but leaving the entire original output for completeness.
Note how manjaro packages are of version 1.76 while some AUR are 1.76 and others are 1.64...

The practical question is whether or not manjaro's gobject-introspection-runtime sufficient?.. I guess I'll find out in a minute.

$ cat /etc/lsb-release
DISTRIB_ID=ManjaroLinux
DISTRIB_RELEASE=22.1.0
DISTRIB_CODENAME=Talos
DISTRIB_DESCRIPTION="Manjaro Linux"

$ pamac search -a gobject-introspection
lua-lgi-git                                                                                                                                 0.9.2.r55.g05038e4-1   AUR 
    Lua bindings for gnome/gobject using gobject-introspection library
lua-lgi                                                                                                                                     0.9.2-7                community 
    Lua bindings for gnome/gobject using gobject-introspection library
luajit-lgi-git                                                                                                                              0.9.0.r37.g9b717c3-1   AUR 
    Lua binadings for gobject using gobject-introspection library
luajit-lgi                                                                                                                                  0.9.2-4                AUR 
    LuaJIT bindings for gnome/gobject using gobject-introspection library
lua53-lgi-git                                                                                                                               0.9.2.r55.g05038e4-1   AUR 
    Lua 5.3 bindings for gnome/gobject using gobject-introspection library
lua53-lgi                                                                                                                                   0.9.2-7                community 
    Lua bindings for gnome/gobject using gobject-introspection library
lua52-lgi                                                                                                                                   0.9.1-1                AUR 
    Lua 5.2 bindings for gnome/gobject using gobject-introspection library
lua51-lgi-git                                                                                                                               0.9.2.r50.g9541863-1   AUR 
    Lua 5.1 bindings for GObject using gobject-introspection library
lua51-lgi                                                                                                                                   0.9.2-2                AUR 
    Lua 5.1 bindings for GObject using gobject-introspection library
ruby-gobject-introspection                                                                                                                  4.1.2-1                community 
    Ruby/GObjectIntrospection is a Ruby binding of GObjectIntrospection.
lib32-gobject-introspection-runtime                                                                                                         1.76.1-1               AUR 
    Introspection system for GObject-based libraries (32-bit) (runtime library)
lib32-gobject-introspection                                                                                                                 1.76.1-1               AUR 
    Introspection system for GObject-based libraries (32-bit)
gobject-introspection-runtime-git                                                                                                           1.64.0+75+g8b0a7f4c-1  AUR 
    Introspection system for GObject-based libraries (runtime library)
gobject-introspection-git                                                                                                                   1.64.0+75+g8b0a7f4c-1  AUR 
    Introspection system for GObject-based libraries
gobject-introspection-runtime                                                                                                   [Installed] 1.76.1-1               extra 
    Introspection system for GObject-based libraries - runtime
gobject-introspection                                                                                                                       1.76.1-1               extra

@maoschanz maoschanz added the question Further information is requested label Apr 27, 2023
@maoschanz
Copy link
Owner

in the code i wrote

import gi
gi.require_version('WebKit2', '4.0')
from gi.repository import Gtk, WebKit2

so i confirm the plugin needs the gobject introspection package for WebKit2

but as you say, finding out what package is doing that isn't trivial. On my Debian i assume it's gir1.2-webkit2-4.0, but i've never confirmed it's the correct package. I only confirmed the package is needed, but is it enough? maybe the plugin needs a broader meta-package that would bring gir1.2-webkit2-4.0? i don't know

@sevaseva
Copy link
Author

Here's what I got. See the full output below.

tl;dr:

  • manjaro's python-gobject is installed,
  • yet import gi raises ModuleNotFoundError: No module named 'gi'
  • (mamba is a faster downloader kind of thing for conda)
  • installing pygobject in a conda environment does make import gi succeed,
  • but both gi.require_version('WebKit2', '4.0') and from gi.repository import Gtk, WebKit2 still fail after that
  • then in the terminal session I deactivate conda (it was activated with base env [without pygobject installed in that env] before the first command),
  • and that makes import gi and gi.require_version('WebKit2', '4.0') succeed
  • from gi.repository import Gtk, WebKit2 produces what seems like a warning rather than an error.....

This explains ModuleNotFoundError("No module named 'gi'") from the command line in #52 (the conda environment with no pygobject was active there, too) and why that problem didn't occur when starting gedit from a gnome launcher (because no conda env was active there).

Hope this helps. I'll let you take it away. I'll wait for you to publish a release and give it a try. In the meantime, if I can be of minor help, let me know. Thanks!

BTW, I noticed how you tagged this issue as a "question"... You are the boss, but that wasn't all my hope to merely get an "answer" to my "question" ;) I meant to request that you actually update README.md with helpful details on what that dependency is and how to check/install it in some common distros (unless you want to automate that in the installer and/or packaged versions of the plugin in which case you might as well still mention some useful details on that dependency just to document your knowledge by that point). Adding that info visibly in README.md will be an improvement for the project over current situation.

    ~  pamac info python-gobject                                    ✔  base  
Name                  : python-gobject
Version               : 3.44.1-1
Description           : Python Bindings for GLib/GObject/GIO/GTK+
URL                   : https://wiki.gnome.org/Projects/PyGObject
Licenses              : LGPL
Repository            : extra
Installed Size        : 1.2 MB
Groups                : --
Depends On            : gobject-introspection-runtime python
Optional Dependencies : cairo: Cairo bindings [Installed]
Required By           : gedit gnome-browser-connector gnome-tweaks gst-python ibus
                        manjaro-application-utility manjaro-hello pychess
                        python-manjaro-sdk python-nautilus
Optional For          : avahi libpeas pacman-mirrors power-profiles-daemon
Provides              : pygobject-devel=3.44.1
Replaces              : pygobject-devel<=3.36.1-1
Conflicts With        : pygobject-devel
Packager              : Jan Alexander Steffens (heftig) <[email protected]>
Build Date            : Fri 24 Mar 2023 10:24:10 AM PDT
Install Date          : Tue 18 Apr 2023 04:01:32 AM PDT
Install Reason        : Installed as a dependency for another package
Validated By          : Signature
Backup files          : --

    ~  python --version                                             ✔  base  
Python 3.10.10
    ~  python                                                       ✔  base  
Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:08:06) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'gi'
>>> 
    ~                                                        ✔  3s   base  
    ~  mamba create -n gi                                           ✔  base  

                  __    __    __    __
                 /  \  /  \  /  \  /  \
                /    \/    \/    \/    \
███████████████/  /██/  /██/  /██/  /████████████████████████
              /  / \   / \   / \   / \  \____
             /  /   \_/   \_/   \_/   \    o \__,
            / _/                       \_____/  `
            |/
        ███╗   ███╗ █████╗ ███╗   ███╗██████╗  █████╗
        ████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
        ██╔████╔██║███████║██╔████╔██║██████╔╝███████║
        ██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
        ██║ ╚═╝ ██║██║  ██║██║ ╚═╝ ██║██████╔╝██║  ██║
        ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚═════╝ ╚═╝  ╚═╝

        mamba (1.4.1) supported by @QuantStack

        GitHub:  https://github.com/mamba-org/mamba
        Twitter: https://twitter.com/QuantStack

█████████████████████████████████████████████████████████████


Looking for: []

Preparing transaction: done
Verifying transaction: done
Executing transaction: done

To activate this environment, use

     $ mamba activate gi

To deactivate an active environment, use

     $ mamba deactivate

    ~  mamba activate gi                                            ✔  base  
    ~  mamba install pygobject                                        ✔  gi  

                  __    __    __    __
                 /  \  /  \  /  \  /  \
                /    \/    \/    \/    \
███████████████/  /██/  /██/  /██/  /████████████████████████
              /  / \   / \   / \   / \  \____
             /  /   \_/   \_/   \_/   \    o \__,
            / _/                       \_____/  `
            |/
        ███╗   ███╗ █████╗ ███╗   ███╗██████╗  █████╗
        ████╗ ████║██╔══██╗████╗ ████║██╔══██╗██╔══██╗
        ██╔████╔██║███████║██╔████╔██║██████╔╝███████║
        ██║╚██╔╝██║██╔══██║██║╚██╔╝██║██╔══██╗██╔══██║
        ██║ ╚═╝ ██║██║  ██║██║ ╚═╝ ██║██████╔╝██║  ██║
        ╚═╝     ╚═╝╚═╝  ╚═╝╚═╝     ╚═╝╚═════╝ ╚═╝  ╚═╝

        mamba (1.4.1) supported by @QuantStack

        GitHub:  https://github.com/mamba-org/mamba
        Twitter: https://twitter.com/QuantStack

█████████████████████████████████████████████████████████████


Looking for: ['pygobject']

conda-forge/noarch                                  12.1MB @   4.2MB/s  2.9s
conda-forge/linux-64                                31.1MB @   4.6MB/s  6.8s
Transaction

  Prefix: /home/sevaseva/dev/conda/envs/gi

  Updating specs:

   - pygobject


  Package                        Version  Build               Channel                    Size
───────────────────────────────────────────────────────────────────────────────────────────────
  Install:
───────────────────────────────────────────────────────────────────────────────────────────────

  + _libgcc_mutex                    0.1  conda_forge         conda-forge/linux-64     Cached
  + _openmp_mutex                    4.5  2_gnu               conda-forge/linux-64     Cached
  + bzip2                          1.0.8  h7f98852_4          conda-forge/linux-64     Cached
  + ca-certificates            2022.12.7  ha878542_0          conda-forge/linux-64     Cached
  + cairo                         1.16.0  h35add3b_1015       conda-forge/linux-64        1MB
  + expat                          2.5.0  hcb278e6_1          conda-forge/linux-64      137kB
  + font-ttf-dejavu-sans-mono       2.37  hab24e00_0          conda-forge/noarch        397kB
  + font-ttf-inconsolata           3.000  h77eed37_0          conda-forge/noarch         97kB
  + font-ttf-source-code-pro       2.038  h77eed37_0          conda-forge/noarch        701kB
  + font-ttf-ubuntu                 0.83  hab24e00_0          conda-forge/noarch          2MB
  + fontconfig                    2.14.2  h14ed4e7_0          conda-forge/linux-64      272kB
  + fonts-conda-ecosystem              1  0                   conda-forge/noarch          4kB
  + fonts-conda-forge                  1  0                   conda-forge/noarch          4kB
  + freetype                      2.12.1  hca18f0e_1          conda-forge/linux-64      626kB
  + gettext                       0.21.1  h27087fc_0          conda-forge/linux-64        4MB
  + icu                             72.1  hcb278e6_0          conda-forge/linux-64     Cached
  + ld_impl_linux-64                2.40  h41732ed_0          conda-forge/linux-64     Cached
  + libexpat                       2.5.0  hcb278e6_1          conda-forge/linux-64       78kB
  + libffi                         3.4.2  h7f98852_5          conda-forge/linux-64     Cached
  + libgcc-ng                     12.2.0  h65d4601_19         conda-forge/linux-64     Cached
  + libgirepository               1.76.1  h8bf6c18_0          conda-forge/linux-64      281kB
  + libglib                       2.76.2  hebfc3b9_0          conda-forge/linux-64        3MB
  + libgomp                       12.2.0  h65d4601_19         conda-forge/linux-64     Cached
  + libiconv                        1.17  h166bdaf_0          conda-forge/linux-64     Cached
  + libnsl                         2.0.0  h7f98852_0          conda-forge/linux-64     Cached
  + libpng                        1.6.39  h753d276_0          conda-forge/linux-64      283kB
  + libsqlite                     3.40.0  h753d276_1          conda-forge/linux-64      804kB
  + libstdcxx-ng                  12.2.0  h46fd767_19         conda-forge/linux-64     Cached
  + libuuid                       2.38.1  h0b41bf4_0          conda-forge/linux-64     Cached
  + libxcb                          1.13  h7f98852_1004       conda-forge/linux-64     Cached
  + libzlib                       1.2.13  h166bdaf_4          conda-forge/linux-64     Cached
  + ncurses                          6.3  h27087fc_1          conda-forge/linux-64     Cached
  + openssl                        3.1.0  hd590300_2          conda-forge/linux-64     Cached
  + pcre2                          10.40  hc3806b6_0          conda-forge/linux-64        2MB
  + pip                           23.1.2  pyhd8ed1ab_0        conda-forge/noarch          1MB
  + pixman                        0.40.0  h36c2ea0_0          conda-forge/linux-64      643kB
  + pthread-stubs                    0.4  h36c2ea0_1001       conda-forge/linux-64     Cached
  + pycairo                       1.23.0  py311hdece40b_0     conda-forge/linux-64      114kB
  + pygobject                     3.44.1  py311he2aa4b6_0     conda-forge/linux-64      335kB
  + python                        3.11.3  h2755cc3_0_cpython  conda-forge/linux-64       31MB
  + python_abi                      3.11  3_cp311             conda-forge/linux-64        6kB
  + readline                         8.2  h8228510_1          conda-forge/linux-64     Cached
  + setuptools                    67.7.2  pyhd8ed1ab_0        conda-forge/noarch        583kB
  + tk                            8.6.12  h27826a3_0          conda-forge/linux-64     Cached
  + tzdata                         2023c  h71feb2d_0          conda-forge/noarch       Cached
  + wheel                         0.40.0  pyhd8ed1ab_0        conda-forge/noarch       Cached
  + xorg-kbproto                   1.0.7  h7f98852_1002       conda-forge/linux-64       27kB
  + xorg-libice                   1.0.10  h7f98852_0          conda-forge/linux-64       59kB
  + xorg-libsm                     1.2.3  hd9c2040_1000       conda-forge/linux-64       26kB
  + xorg-libx11                    1.8.4  h0b41bf4_0          conda-forge/linux-64      830kB
  + xorg-libxau                    1.0.9  h7f98852_0          conda-forge/linux-64     Cached
  + xorg-libxdmcp                  1.1.3  h7f98852_0          conda-forge/linux-64     Cached
  + xorg-libxext                   1.3.4  h0b41bf4_2          conda-forge/linux-64       50kB
  + xorg-libxrender               0.9.10  h7f98852_1003       conda-forge/linux-64       33kB
  + xorg-renderproto              0.11.1  h7f98852_1002       conda-forge/linux-64       10kB
  + xorg-xextproto                 7.3.0  h0b41bf4_1003       conda-forge/linux-64       30kB
  + xorg-xproto                   7.0.31  h7f98852_1007       conda-forge/linux-64       75kB
  + xz                             5.2.6  h166bdaf_0          conda-forge/linux-64     Cached
  + zlib                          1.2.13  h166bdaf_4          conda-forge/linux-64     Cached

  Summary:

  Install: 59 packages

  Total download: 51MB

───────────────────────────────────────────────────────────────────────────────────────────────


Confirm changes: [Y/n] y
fonts-conda-forge                                    4.1kB @  19.3kB/s  0.2s
font-ttf-inconsolata                                96.5kB @ 392.6kB/s  0.2s
font-ttf-dejavu-sans-mono                          397.4kB @   1.5MB/s  0.3s
xorg-libice                                         59.4kB @ 216.4kB/s  0.1s
font-ttf-source-code-pro                           700.8kB @   2.4MB/s  0.3s
expat                                              136.8kB @ 453.4kB/s  0.0s
font-ttf-ubuntu                                      2.0MB @   6.3MB/s  0.3s
libpng                                             282.6kB @ 840.1kB/s  0.1s
xorg-libxrender                                     32.9kB @  97.8kB/s  0.0s
libgirepository                                    281.0kB @ 804.1kB/s  0.0s
libglib                                              2.7MB @   7.2MB/s  0.1s
pycairo                                            113.9kB @ 299.0kB/s  0.0s
pygobject                                          335.3kB @ 875.0kB/s  0.0s
xorg-renderproto                                     9.6kB @  25.0kB/s  0.0s
pixman                                             642.5kB @   1.6MB/s  0.0s
gettext                                              4.3MB @  10.4MB/s  0.2s
cairo                                                1.1MB @   2.6MB/s  0.0s
freetype                                           625.7kB @   1.4MB/s  0.1s
xorg-kbproto                                        27.3kB @  60.6kB/s  0.0s
fonts-conda-ecosystem                                3.7kB @   8.1kB/s  0.0s
pcre2                                                2.4MB @   5.2MB/s  0.1s
xorg-libsm                                          26.4kB @  56.3kB/s  0.0s
xorg-xproto                                         74.9kB @ 154.9kB/s  0.0s
setuptools                                         582.7kB @   1.2MB/s  0.0s
fontconfig                                         272.0kB @ 538.1kB/s  0.0s
libsqlite                                          804.2kB @   1.6MB/s  0.1s
xorg-xextproto                                      30.3kB @  57.7kB/s  0.0s
xorg-libxext                                        50.1kB @  94.5kB/s  0.0s
libexpat                                            78.0kB @ 143.0kB/s  0.0s
python_abi                                           5.7kB @  10.4kB/s  0.0s
xorg-libx11                                        829.9kB @   1.4MB/s  0.1s
pip                                                  1.4MB @   2.3MB/s  0.1s
python                                              31.1MB @  38.4MB/s  0.4s

Downloading and Extracting Packages

Preparing transaction: done
Verifying transaction: done
Executing transaction: done
    ~  python                                                              ✔  38s   gi  
Python 3.11.3 | packaged by conda-forge | (main, Apr  6 2023, 08:57:19) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version('WebKit2', '4.0')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sevaseva/dev/conda/envs/gi/lib/python3.11/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace WebKit2 not available
>>> 
>>> from gi.repository import Gtk, WebKit2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/sevaseva/dev/conda/envs/gi/lib/python3.11/site-packages/gi/importer.py", line 136, in load_module
    raise ImportError('cannot import name %s, '
ImportError: cannot import name Gtk, introspection typelib not found
>>> 

    ~  mamba deactivate                                                                                                              ✔  base  
    ~  python --version                                                                                                                       ✔ 
Python 3.10.10
    ~  python                                                                                                                                 ✔ 
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import gi
>>> gi.require_version('WebKit2', '4.0')
>>> from gi.repository import Gtk, WebKit2
<stdin>:1: PyGIWarning: Gtk was imported without specifying a version first. Use gi.require_version('Gtk', '4.0') before import to ensure that the right version gets loaded.
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/gi/importer.py", line 142, in load_module
    introspection_module = get_introspection_module(namespace)
  File "/usr/lib/python3.10/site-packages/gi/module.py", line 263, in get_introspection_module
    module = IntrospectionModule(namespace, version)
  File "/usr/lib/python3.10/site-packages/gi/module.py", line 110, in __init__
    repository.require(namespace, version)
gi.RepositoryError: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3.10/site-packages/gi/importer.py", line 144, in load_module
    raise ImportError(e)
ImportError: Requiring namespace 'Gtk' version '3.0', but '4.0' is already loaded
>>> 

@maoschanz
Copy link
Owner

(mamba is a faster downloader kind of thing for conda)

interesting, i forgot about those env managers

Elaborate on gir1.2-webkit2-4.0 in README.md

coming back to the original question, on a Debian Sid system:

  • gir1.2-webkit2-4.0 is a GI data package, it installs both itself, the lib it describes (libwebkit2gtk-4.0-37), the dependencies of this lib, and other GI data for these dependencies (like gir1.2-gtk-3.0)
  • gedit installs both itself, also some GI data like gir1.2-gtk-3.0, and python3-gi
  • python3-gi comes with libgirepository-1.0-1, python3, etc.

so if i understand GI correctly, i have the webkit2gtk lib, and the data which tells libgirepository how to access its methods. Then gedit comes with both python3 (to run plugins) and the python3-gi interface allowing to access libgirepository from python code. In the end, i can access webkit2gtk (a C library) from my python code using from gi.repository import WebKit2

as you can see in your first command, on manjaro there are also dependency relationships between python-gobject and various packages such as gedit. I wrote the readme assuming all users would have gedit in their environment, thus all its dependencies should be available to the plugin. On arch:

  • gedit -> gedit
  • libwebkit2gtk-4.0-37 -> webkit2gtk
  • python3-gi -> python-gobject? or pygobject? no need to know, because it should come with gedit anyway!

then what packages provide the GI data (for gtk3 and webkit2)? My guess is that debian made an over-complicated structure of tiny interdependent packages while arch put all the stuffs in the same bigger one: the arch equivalent of gir1.2-webkit2-4.0 probably just comes with Arch's webkit2gtk, at least if the package's file list means what i think it means. So you should be fine if you just use the list used by the dude who created the AUR package a few years ago, even if his package doesn't work anymore

i think installing only a single package in your mamba environment is a problem. It's probably not reasonable either to install a new entire gedit each time you install a gnome-related lib in a new python environment... so i'm not sure what's the solution, if there is any


I meant to request that you actually update README.md with helpful details

so i'll update it... with the answer to the question. It's not a bug or a feature, i have nothing to implement 🤷

from gi.repository import Gtk, WebKit2 produces what seems like a warning rather than an error.....

the tracebacks i see really look like errors to me, but it's hard to be conclusive with an out-of-context step by step execution

unless you want to automate that in the installer and/or packaged versions of the plugin

tbh it's a project i developed during my college courses: i took notes in markdown, i read a random tutorial about the gedit api, and then this plugin happened. The "installer" is merely a quick way to update it, on a system where it's already running fine, as i change things in the code. I should rename the "update" script btw, that one isn't really about updating anything 😬 it's about removing all local changes to install the cleaner code from this github remote

i've no idea how packaging works, it's a topic that bores me deeply, i let this task to actual distro contributors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants