nanobind-stubgen


Namenanobind-stubgen JSON
Version 0.1.5 PyPI version JSON
download
home_pagehttps://github.com/cansik/nanobind-stubgen
SummaryGenerate python stub files for code completion in IDEs for nanobind modules.
upload_time2024-02-07 08:19:42
maintainer
docs_urlNone
authorFlorian Bruggisser
requires_python
licenseMIT license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nanobind-stubgen [![PyPI](https://img.shields.io/pypi/v/nanobind-stubgen)](https://pypi.org/project/nanobind-stubgen/)

Generate Python stub files (`pyi`) for code completion in IDEs for [nanobind](https://github.com/wjakob/nanobind) modules.

### Installation

```
pip install nanobind-stubgen
```

### Usage

Nanobind stubgen uses the `inspect` module to reverse engineer the module structure and detects nanobind types. The doc
string of the nanobind types contains the function signature, which will be used to create the stub files.

To create pyi files for a module, first install the module and call `nanobind-stubgen` with the module name as first argument. 
Here is an example on how to generate stubs for [nanogui](https://github.com/mitsuba-renderer/nanogui):

```bash
nanobind-stubgen nanogui
```

It is possible to change the output path (by default it is the current directory) by specifying the parameter `--out`. To
create the pyi files directly in the nanogui package directory, the following command can be used (note the
changing python version):

```bash
nanobind-stubgen nanogui --out venv/lib/python3.9/site-packages
```

### Limitations
- The stub generator does not use the nanobind project, but the actual compiled python module. This means, that the generator can only detect module and function information that has been writen into the `__doc__` string by nanobind.
- Only some imports in the pyi files are added
- Method overloading is supported but only to some extent
 
### Help

```bash
positional arguments:
  module             Module to create stubs (e.g. nanogui).

optional arguments:
  -h, --help         show this help message and exit
  --package PACKAGE  Optional package path to import module from.
  --out OUT          Output path for the generated pyi files.
```

### About
MIT License


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/cansik/nanobind-stubgen",
    "name": "nanobind-stubgen",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Florian Bruggisser",
    "author_email": "github@broox.ch",
    "download_url": "",
    "platform": null,
    "description": "# nanobind-stubgen [![PyPI](https://img.shields.io/pypi/v/nanobind-stubgen)](https://pypi.org/project/nanobind-stubgen/)\n\nGenerate Python stub files (`pyi`) for code completion in IDEs for [nanobind](https://github.com/wjakob/nanobind) modules.\n\n### Installation\n\n```\npip install nanobind-stubgen\n```\n\n### Usage\n\nNanobind stubgen uses the `inspect` module to reverse engineer the module structure and detects nanobind types. The doc\nstring of the nanobind types contains the function signature, which will be used to create the stub files.\n\nTo create pyi files for a module, first install the module and call `nanobind-stubgen` with the module name as first argument. \nHere is an example on how to generate stubs for [nanogui](https://github.com/mitsuba-renderer/nanogui):\n\n```bash\nnanobind-stubgen nanogui\n```\n\nIt is possible to change the output path (by default it is the current directory) by specifying the parameter `--out`. To\ncreate the pyi files directly in the nanogui package directory, the following command can be used (note the\nchanging python version):\n\n```bash\nnanobind-stubgen nanogui --out venv/lib/python3.9/site-packages\n```\n\n### Limitations\n- The stub generator does not use the nanobind project, but the actual compiled python module. This means, that the generator can only detect module and function information that has been writen into the `__doc__` string by nanobind.\n- Only some imports in the pyi files are added\n- Method overloading is supported but only to some extent\n \n### Help\n\n```bash\npositional arguments:\n  module             Module to create stubs (e.g. nanogui).\n\noptional arguments:\n  -h, --help         show this help message and exit\n  --package PACKAGE  Optional package path to import module from.\n  --out OUT          Output path for the generated pyi files.\n```\n\n### About\nMIT License\n\n",
    "bugtrack_url": null,
    "license": "MIT license",
    "summary": "Generate python stub files for code completion in IDEs for nanobind modules.",
    "version": "0.1.5",
    "project_urls": {
        "Homepage": "https://github.com/cansik/nanobind-stubgen"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1b61b7cd5e2cfcc1cb49f62d29fe06ad8c19582c4965f7767d88405f3b70812",
                "md5": "059f8d1faef29cfa8c397a2fc2cfbf10",
                "sha256": "3f4e3c852dfb6ce2bd51fa5e710f3019180176669280fd00e7293e08dee76709"
            },
            "downloads": -1,
            "filename": "nanobind_stubgen-0.1.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "059f8d1faef29cfa8c397a2fc2cfbf10",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7918,
            "upload_time": "2024-02-07T08:19:42",
            "upload_time_iso_8601": "2024-02-07T08:19:42.184024Z",
            "url": "https://files.pythonhosted.org/packages/d1/b6/1b7cd5e2cfcc1cb49f62d29fe06ad8c19582c4965f7767d88405f3b70812/nanobind_stubgen-0.1.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-07 08:19:42",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "cansik",
    "github_project": "nanobind-stubgen",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nanobind-stubgen"
}
        
Elapsed time: 0.18828s