diff options
author | Adrian Herrmann <adrian.herrmann@qt.io> | 2024-03-19 15:57:03 +0100 |
---|---|---|
committer | Adrian Herrmann <adrian.herrmann@qt.io> | 2024-03-20 12:57:06 +0100 |
commit | 4d0a7ad688503283ec89cc58a006dad907b7cbd0 (patch) | |
tree | 4200fc41e7e08b03f238df6aa1bec7f0c0f9dd8e /sources/shiboken6 | |
parent | d6da98035d0f494e52b32e1afb52738baf7efd8b (diff) |
doc: Add page for shiboken6-genpyi
Add a documentation page for the shiboken6-genpyi tool. This also
removes an unused argument.
Change-Id: I79939f45391694f1ca57b9a4f9da58ffc30cfd28
Reviewed-by: Christian Tismer <tismer@stackless.com>
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'sources/shiboken6')
-rw-r--r-- | sources/shiboken6/doc/index.rst | 13 | ||||
-rw-r--r-- | sources/shiboken6/doc/shiboken-genpyi.rst | 32 | ||||
-rw-r--r-- | sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py | 4 |
3 files changed, 45 insertions, 4 deletions
diff --git a/sources/shiboken6/doc/index.rst b/sources/shiboken6/doc/index.rst index db842134b..68f96dded 100644 --- a/sources/shiboken6/doc/index.rst +++ b/sources/shiboken6/doc/index.rst @@ -91,6 +91,18 @@ Documentation .. grid-item-card:: :class-item: text-center + Generating Python stub files. + +++ + .. button-ref:: shiboken-genpyi + :color: primary + :outline: + :expand: + + shiboken6-genpyi + + .. grid-item-card:: + :class-item: text-center + Known issues and FAQ. +++ .. button-ref:: considerations @@ -109,4 +121,5 @@ Documentation shibokenmodule.rst typesystem.rst examples/index.rst + shiboken-genpyi.rst considerations.rst diff --git a/sources/shiboken6/doc/shiboken-genpyi.rst b/sources/shiboken6/doc/shiboken-genpyi.rst new file mode 100644 index 000000000..44d0edb97 --- /dev/null +++ b/sources/shiboken6/doc/shiboken-genpyi.rst @@ -0,0 +1,32 @@ +.. _shiboken6-genpyi: + +shiboken6-genpyi +================ + +`shiboken6-genpyi` is a command line tool to generate Python stub files +(.pyi) for any shiboken binding-based module (not just PySide). Stub +files define signatures of all classes, methods (including overloads), +constants and enums of a module. Signatures also contain type hints. +This helps your module integrate with Python type checkers and IDEs. +For example, if you use any function from your module, your IDE's +function lookup feature will show you the function signature and its +parameters and return value including types. + + +Usage +----- + +To generate stub files for a module, run the following command: + +.. code-block:: bash + + shiboken6-genpyi <module_names> [OPTIONS] + +where `<module_names>` is a space-separated list of module names (the +modules must be importable from the working directory) and where +`[OPTIONS]` can be one of the following: + +* **--quiet**: Run the tool quietly without output to stdout. +* **--outpath <output_dir>**: Specify the output directory for the + generated stub files. If not specified, the stub files are generated + in the location of the module binary. diff --git a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py index 670d4d366..d2a9bd272 100644 --- a/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py +++ b/sources/shiboken6/shibokenmodule/files.dir/shibokensupport/signature/lib/pyi_generator.py @@ -288,9 +288,6 @@ def generate_pyi(import_name, outpath, options): wr.print(line) if not options.quiet: options.logger.info(f"Generated: {outfilepath}") - # PYSIDE-1735: .pyi files are no longer compatible with Python, because - # enum classes contain ellipsis which a Python enum forbids. - # We will implement tests with Mypy, instead. def main(): @@ -307,7 +304,6 @@ def main(): parser.add_argument("module", help="The full path name of an importable module binary (.pyd, .so)") # noqa E:128 parser.add_argument("--quiet", action="store_true", help="Run quietly") - parser.add_argument("--check", action="store_true", help="Test the output") parser.add_argument("--outpath", help="the output directory (default = location of module binary)") # noqa E:128 options = parser.parse_args() |