(kit-python-package-main-doc)=
# Kit Python Package
**Kit** is published as a Python (PIP, wheel) package. This means that you can use **Kit** as a Python library in your Python projects.
It [can be found PyPI index](https://pypi.org/project/omniverse-kit/). But it is a placeholder package, to install **Kit** from PyPI you need pass an extra index URL to pip:
```bash
pip install omniverse-kit --extra-index-url https://pypi.nvidia.com
```
## Getting Started
```bash
python -m venv myenv
myenv\Scripts\activate
pip install omniverse-kit --extra-index-url https://pypi.nvidia.com
python -m omni.kit_app
```
In this example we create a new virtual environment, activate it, install **Kit** into it as python package, and run **Kit**. It will start in the same way as if it was started from the `kit.exe`, but instead your python is used.
## KitApp Example
The `omni.kit_app` module provides an initial bootstrapping and `KitApp` class, which is a Pythonic way to start **Kit**. It is a thin wrapper around the `kit.exe` command line interface, and it provides a way to start **Kit** from Python, to pass command line arguments to it, to control the basic update loop:
```{literalinclude} ../../../../../source/extensions/omni.kit.core.tests/omni/kit/core/tests/scripts/example_kit_app_ui.py
:language: py
```
In this example we startup **Kit** asking it to enable `omni.ui` extension. Use it to build a simple UI window. After that we keep app update loop running until app is signaled to exit.
That will only work if among enabled extension is `omni.kit.loop` (or similar) which implements the main update loop interface (`omni::kit::IRunLoopRunner`). Otherwise **Kit** will exit.
The `from omni.kit_app import KitApp` import must be the first of omniverse imports, it sets up the environment (loads Carbonite, adds library and python paths).
Typically extensions subscribe to update loop events (like render UI every frame, process new input events, etc). However, for some applications it might be useful to have a full control over the update loop. To call explicit API of various extensions, rather than rely on their event-based API:
```{literalinclude} ../../../../../source/extensions/omni.kit.core.tests/omni/kit/core/tests/scripts/example_kit_app_simple.py
:language: py
```
In this example we startup **Kit** asking it to enable `omni.usd` extension. After that extension is available (added to `sys.path`, startup was called) and we can use it in our Python code.
## EULA
On the first import of `omni.kit_app` module, it will ask you to accept the EULA. This is a one-time operation, if accepted, it will not ask again. An alternative way to accept the EULA is to set the environment variable `OMNI_KIT_ACCEPT_EULA` to `yes`.
## Editable Mode
You can install **Kit** python package in editable mode, which means that you can modify the source code and see the changes immediately. This is useful for development and debugging.
Assuming you've built **Kit** from source:
```bash
pip install -e [path to kit source]/_build/packages/python/omniverse-kit
```
Raw data
{
"_id": null,
"home_page": null,
"name": "omniverse-kit",
"maintainer": null,
"docs_url": null,
"requires_python": "==3.10.*",
"maintainer_email": null,
"keywords": "nvidia, omniverse, kit, kernel",
"author": "Kit Team",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/f8/1c/c957131be37bf260c666a2e22b16d6cf3ff6deaf3389281672b880833953/omniverse_kit-106.5.0.162521.tar.gz",
"platform": null,
"description": "(kit-python-package-main-doc)=\n\n# Kit Python Package\n\n**Kit** is published as a Python (PIP, wheel) package. This means that you can use **Kit** as a Python library in your Python projects.\n\nIt [can be found PyPI index](https://pypi.org/project/omniverse-kit/). But it is a placeholder package, to install **Kit** from PyPI you need pass an extra index URL to pip:\n\n```bash\npip install omniverse-kit --extra-index-url https://pypi.nvidia.com\n```\n\n## Getting Started\n\n```bash\npython -m venv myenv\nmyenv\\Scripts\\activate\npip install omniverse-kit --extra-index-url https://pypi.nvidia.com\npython -m omni.kit_app\n```\n\nIn this example we create a new virtual environment, activate it, install **Kit** into it as python package, and run **Kit**. It will start in the same way as if it was started from the `kit.exe`, but instead your python is used.\n\n\n## KitApp Example\n\nThe `omni.kit_app` module provides an initial bootstrapping and `KitApp` class, which is a Pythonic way to start **Kit**. It is a thin wrapper around the `kit.exe` command line interface, and it provides a way to start **Kit** from Python, to pass command line arguments to it, to control the basic update loop:\n\n```{literalinclude} ../../../../../source/extensions/omni.kit.core.tests/omni/kit/core/tests/scripts/example_kit_app_ui.py\n:language: py\n```\n\nIn this example we startup **Kit** asking it to enable `omni.ui` extension. Use it to build a simple UI window. After that we keep app update loop running until app is signaled to exit.\nThat will only work if among enabled extension is `omni.kit.loop` (or similar) which implements the main update loop interface (`omni::kit::IRunLoopRunner`). Otherwise **Kit** will exit.\n\nThe `from omni.kit_app import KitApp` import must be the first of omniverse imports, it sets up the environment (loads Carbonite, adds library and python paths).\n\nTypically extensions subscribe to update loop events (like render UI every frame, process new input events, etc). However, for some applications it might be useful to have a full control over the update loop. To call explicit API of various extensions, rather than rely on their event-based API:\n\n```{literalinclude} ../../../../../source/extensions/omni.kit.core.tests/omni/kit/core/tests/scripts/example_kit_app_simple.py\n:language: py\n```\n\nIn this example we startup **Kit** asking it to enable `omni.usd` extension. After that extension is available (added to `sys.path`, startup was called) and we can use it in our Python code.\n\n## EULA\n\nOn the first import of `omni.kit_app` module, it will ask you to accept the EULA. This is a one-time operation, if accepted, it will not ask again. An alternative way to accept the EULA is to set the environment variable `OMNI_KIT_ACCEPT_EULA` to `yes`.\n\n## Editable Mode\n\nYou can install **Kit** python package in editable mode, which means that you can modify the source code and see the changes immediately. This is useful for development and debugging.\n\nAssuming you've built **Kit** from source:\n\n```bash\npip install -e [path to kit source]/_build/packages/python/omniverse-kit\n```\n",
"bugtrack_url": null,
"license": "NVIDIA Proprietary Software",
"summary": "Omniverse Kit Kernel",
"version": "106.5.0.162521",
"project_urls": {
"Documentation": "https://docs.omniverse.nvidia.com/kit/docs/kit-manual",
"Home page": "https://developer.nvidia.com/omniverse"
},
"split_keywords": [
"nvidia",
" omniverse",
" kit",
" kernel"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "f81cc957131be37bf260c666a2e22b16d6cf3ff6deaf3389281672b880833953",
"md5": "7bf7bc18855ff16e3fd1c1f2d0028fd4",
"sha256": "2dd0e6d0f752b6d9dea2148e511626521623e13aeb8b7cfe3f44d67cc52d7ee0"
},
"downloads": -1,
"filename": "omniverse_kit-106.5.0.162521.tar.gz",
"has_sig": false,
"md5_digest": "7bf7bc18855ff16e3fd1c1f2d0028fd4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "==3.10.*",
"size": 1989,
"upload_time": "2024-12-18T22:13:27",
"upload_time_iso_8601": "2024-12-18T22:13:27.883085Z",
"url": "https://files.pythonhosted.org/packages/f8/1c/c957131be37bf260c666a2e22b16d6cf3ff6deaf3389281672b880833953/omniverse_kit-106.5.0.162521.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-18 22:13:27",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "omniverse-kit"
}