├── LICENSE ├── README.md ├── STUB.md ├── files ├── pycharm.gif └── vscode.gif ├── isaacgym-stubs ├── __init__.py └── gymapi.pyi ├── pyproject.toml └── setup.py /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022, Yuzhe Qin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Isaac Gym Python Stubs for Code Completion 2 | 3 | [![PyPI version](https://badge.fury.io/py/isaacgym-stubs.svg)](https://badge.fury.io/py/isaacgym-stubs) 4 | ========================================== 5 | 6 | Enable code completion for IsaacGym simply with `pip install isaacgym-stubs`, even without IsaacGym itself! 7 | 8 | ```bash 9 | # Install from PyPi for the latest 1.0rc4 version (preview 4), the 1.1 in 1.1rc4 of the package version means enhanced stub, it still corresponds to isaacgym 1.0rc4 10 | pip3 install isaacgym-stubs 11 | 12 | # Install it for other IsaacGym version, e.g. preview 3 13 | pip3 install isaacgym_stubs==1.0rc3 14 | 15 | # Or preview 2 16 | pip3 install isaacgym_stubs==1.0rc2 17 | 18 | # Alternatively, install from Github 19 | # pip3 install git+https://github.com/yzqin/isaacgym-stubs.git 20 | 21 | ``` 22 | 23 | Begin your code with the typical `from isaacgym import gymapi` and enjoy auto-completion. 24 | 25 | The magic of `stub` is that you even **do not need to pip install IsaacGym itself**. 26 | 27 | For example, you may want to run IsaacGym on server but develop the code on a MacBook. 28 | IsaacGym may not support Mac. But you can still install this repo on MacBook and get smooth code completion during 29 | development! 30 | 31 | ### Demo 32 | 33 | **VsCode** 34 | 35 | ![VsCode Demo](files/vscode.gif) 36 | 37 | **PyCharm** 38 | 39 | ![PyCharm Demo](files/pycharm.gif) 40 | 41 | ### Troubleshooting 42 | 43 | 1. The Python interpreter specified in your IDE should be the Python where isaacgym-stubs is installed. For 44 | example, if you install this repository with conda Python but select the system Python as the interpreter in your 45 | IDE, you won't have any code auto-completion. Follow the official instruction 46 | [here](https://code.visualstudio.com/docs/python/environments) for VSCode 47 | and [here](https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html) for PyCharm. 48 | 2. Code auto-completion will not function if there's a directory named `issacgym` in your workspace. In this 49 | case, the isaacgym symbol in your import will point to the directory instead of this package, disrupting the 50 | auto-completion. Ensure that there's no `isaacgym` directory in your IDE workspace. 51 | 3. Depending on which IDE you are using, sometimes you may need to restart the IDE after `pip install` for re-indexing. 52 | 53 | ### Overview 54 | 55 | This repository contains the `pyi` stub for the IsaacGym library, which can be used for code completion and type 56 | checking. 57 | According to the guidelines outlined in [PEP-561](https://peps.python.org/pep-0561/), Python stub files contain only 58 | type information and no runtime code. 59 | The `stub` in this repo is generated based on IsaacGym version `1.0rc4`. 60 | 61 | ### Generating Enhanced `pyi` Files 62 | 63 | The base `.pyi` files are typically created using tools like `mypy` or `pybind11-stubgen`. For improved 64 | documentation, [Lai Wei](https://github.com/I-am-Future) has developed 65 | an [automated script](https://github.com/I-am-Future/isaacgym-stubs-enhanced/blob/enhanced/enhance-pyi.ipynb) that 66 | extracts information from IsaacGym 67 | documentation to produce more descriptive and useful `.pyi` files. For additional information, refer 68 | to [issue #2](https://github.com/yzqin/isaacgym-stubs/issues/2). 69 | 70 | 71 | -------------------------------------------------------------------------------- /STUB.md: -------------------------------------------------------------------------------- 1 | ### How to generate the `pyi` file: 2 | 3 | ```bash 4 | pip3 install mypy 5 | stubgen -m gym_38 # If you are using Python 3.8 6 | 7 | ``` 8 | 9 | Then rename the `gym_38.pyi` as `gymapi.pyi` and place it in the stub directory. You may also need some manual label to 10 | clean up the auto-generated stub. 11 | -------------------------------------------------------------------------------- /files/pycharm.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzqin/isaacgym-stubs/8f62bb475b6f3a52ed536f5bce6e3759f648a989/files/pycharm.gif -------------------------------------------------------------------------------- /files/vscode.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yzqin/isaacgym-stubs/8f62bb475b6f3a52ed536f5bce6e3759f648a989/files/vscode.gif -------------------------------------------------------------------------------- /isaacgym-stubs/__init__.py: -------------------------------------------------------------------------------- 1 | from .gymapi import * 2 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.black] 2 | line-length = 88 # Default. 3 | 4 | [project] 5 | name = "isaacgym-stubs" 6 | version = "1.1rc4" 7 | authors = [ 8 | { name = "Yuzhe Qin", email = "y1qin@ucsd.edu" }, 9 | ] 10 | description = "Isaac Gym Python Stubs for Code Completion" 11 | readme = "README.md" 12 | requires-python = ">=3.6" 13 | classifiers = [ 14 | "Programming Language :: Python :: 3", 15 | "License :: OSI Approved :: MIT License", 16 | "Operating System :: OS Independent", 17 | ] 18 | 19 | [project.urls] 20 | "Homepage" = "https://github.com/yzqin/isaacgym-stubs" -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='isaacgym-stubs', 5 | author="Yuzhe Qin", 6 | author_email="y1qin@ucsd.edu", 7 | description="PEP 561 type stubs for isaacgym.gymapi", 8 | version='1.1rc4', 9 | packages=['isaacgym-stubs'], 10 | package_data={"isaacgym-stubs": ['gymapi.pyi', '__init__.pyi']}, 11 | ) 12 | --------------------------------------------------------------------------------