How can I build package with python and gtk?

I’ve this error:

ImportError: cannot import name Gtk, introspection typelib not found

and this

Namespace Gtk not available

I try with this config:

name: penguinpocket 
base: core18 
version: '0.1' 
summary: Unofficial linux client for Pocket.
description: |
  Unofficial linux client for Pocket.

grade: devel 
confinement: devmode 

parts:
  penguinpocket:
    plugin: python
    python-version: python3
    source: .
    #build-packages: [libgtk-3-dev]
    stage-packages: [python3-gi, python3-requests, gir1.2-gtk-3.0, libglib2.0-0, libgtk-3-0, libgdk-pixbuf2.0-0]
apps:
  test-penguinpocket:
    plugs: [desktop, x11, network, desktop-legacy]
    command: bin/com.github.michaldev.penguinpocket

Any help? I have problem with this package.

Have you tried using the desktop-gtk3 part? I believe it should do some of the configuration needed.

Also you may just be missing a dependency in stage-packages

I’ve added after: [desktop-gtk3], but no improvement (ValueError: Namespace Gtk not available).

Actually my config:
name: penguinpocket # you probably want to 'snapcraft register ’
base: core18 # the base snap is the execution environment for this snap
version: ‘0.1’ # just for humans, typically ‘1.2+git’ or ‘1.3.2’
summary: Unofficial linux client for Pocket. # 79 char long summary
description: |
Unofficial linux client for Pocket.
grade: devel # must be ‘stable’ to release into candidate/stable channels
confinement: devmode # use ‘strict’ once you have the right plugs and slots

parts:
  penguinpocket:
    # See 'snapcraft plugins'
    plugin: python
    python-version: python3
    source: .
    #source-type: git
    build-packages: [python3-gi, python3-requests, gir1.2-gtk-3.0]
    stage-packages: [python3-gi, python3-requests, gir1.2-gtk-3.0]
    after: [desktop-gtk3]
apps:
  test-penguinpocket:
    plugs: [desktop, x11, network]
command: bin/com.github.michaldev.penguinpocket

Take a look here: https://github.com/lapisdecor/hellowayland/blob/master/snap/snapcraft.yaml

Thank you for the answer. That isn’t work.
I’ve this error:

Błąd:10 http://ppa.launchpad.net/ubuntu-desktop/gnome-3-26/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
Czytanie list pakietów… Gotowe
E: The repository ‘http://ppa.launchpad.net/ubuntu-desktop/gnome-3-26/ubuntu bionic Release’ does not have a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Failed to run ‘override-pull’: Exit code was 100.

Try this on the terminal:
LANG=en_US.UTF-8 LANGUAGE=en_US snapcraft cleanbuild

Pulling gnome-3-26
Err:6 http://ppa.launchpad.net/ubuntu-desktop/gnome-3-26/ubuntu bionic Release
404 Not Found [IP: 91.189.95.83 80]
Reading package lists… Done
E: The repository ‘http://ppa.launchpad.net/ubuntu-desktop/gnome-3-26/ubuntu bionic Release’ does not have a Release file.
N: Updating from such a repository can’t be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Failed to run ‘override-pull’: Exit code was 100.
Run the same command again with --debug to shell into the environment if you wish to introspect this failure.
An error occurred when trying to execute ‘sudo -i snapcraft snap’ with ‘multipass’: returned exit code 2.

and when I try with this “sudo -i snapcraft snap”:
Could not find snap/snapcraft.yaml. Are you sure you are in the right directory?
To start a new project, use snapcraft init

and when I try snapcraft cleanbuild:
The cleanbuild command is no longer supported when using the base keyword.

You don’t need to use sudo to run snapcraft, I’m not even sure thats a good ideia.
What OS are you using?

You actually shouldn’t need the gnome part, it’s only there to provide wayland compatibility on Ubuntu 16.04.

I’ve tested on Ubuntu 18.04 and 18.10.

I don’t need use sudo to run snapcraft, but when I add gnome-3.26 section I must use with root.

Have you found a solution to this yet?
I’m also getting Namespace Gtk not available when using base: core18 with my Python3 script.

How can we include GTK3+ in our Python3 snaps when using base: core18 ?