Skip to main content

Generate PEP 561 stubs for the GObject introspection library. Forked from fakegir

Project description

GenGIR: Genuine* autocompletion for your PyGObject code!

PyPI version

fakegir is a tool to build a fake python package of PyGObject modules.

GenGIR is a fork of fakegir that uses modern standards and improves on usability

The main changes are:

  • Use PEP 484 type annotations instead of docstrings
  • Install typings as a PEP 561 stub
  • Use Sphinx markup on docstrings
  • Fields are typed now
  • A cli

GenGIR stores the type info inside your user or venv site-packages as a package named gi-stubs.
Once it's installed, it should be recognized by your IDE and it should provide autocompletion and typing errors.

Installation

gengir is available on pypi, install it using

$ pip install gengir

or add it as a development dependency if you're using poetry

TODO

  • Documentation formatting (code snippets, links)
  • Signals as Literals

Building

This project uses poetry, so make sure to have that installed

Then run poetry install and poetry build. A wheel file should be created in the dist directory that can be installed using pip install ./dist/gengir*.whl

Usage

The *.gir with the type info files should be included with each GNOME library development package in /usr/share/gir-1.0/.

gengir [OPTIONS] [TYPES]...

  Generate PEP 561 stubs for the GObject introspection library.

Arguments:
  [TYPES]...  Files to use as input for the generator. If not provided it uses
              all files in /usr/share/gir-1.0/

Options:
  -o, --outdir PATH               Directory to store the package typings.
                                  $site-packages/gi-stubs by default
  --docs / --no-docs              Include docstrings in the typings  [default:
                                  docs]
  --gtk INTEGER                   GTK version to generate typings for
                                  [default: 3]

Editor support

  • VSCode has support for stub packages out of the box.
  • Jedi supports it too, so any editor using it should work.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gengir-1.0.2.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gengir-1.0.2-py3-none-any.whl (24.1 kB view details)

Uploaded Python 3

File details

Details for the file gengir-1.0.2.tar.gz.

File metadata

  • Download URL: gengir-1.0.2.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.15.8-arch1-1

File hashes

Hashes for gengir-1.0.2.tar.gz
Algorithm Hash digest
SHA256 70cfba1d9f491ee537d5cae80fc29d8786d097d0189571ceb9f7780fb4d4b475
MD5 9499594d6e61e1477f7c5076b3153c25
BLAKE2b-256 876c3b6e732e09f4a571e1037cd20e0e19c7c1f5f8be64186de2c9e1c9b84d3b

See more details on using hashes here.

File details

Details for the file gengir-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: gengir-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 24.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.10.1 Linux/5.15.8-arch1-1

File hashes

Hashes for gengir-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 28b815a795413ef105ca18c9e25dc1744c311d3c0435088f35e8986c2de6a745
MD5 606ed253e96ccfc1248b99edfddb0676
BLAKE2b-256 a86acfd643fa5c7ab098379e34ed555fc3b6faea59ffcf08d027ec495a6f7743

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page