pyloaderv
Developer kit for PyloaderV, the mod that lets you write GTA V mods in real Python (CPython 3.12 embedded in the game through ScriptHookV).
pip install pyloaderv
That one command gives you:
- Autocomplete and type checking for
import gtain VS Code (Pylance), PyCharm, mypy... The whole API is covered:gta.player,gta.world,gta.ped,gta.vehicle,gta.entity,gta.ui,gta.math, and all 6649 natives ingta.natives.<namespace>. Nothing to configure: no stubs folder to copy, nopyrightconfig.json. - The
pyloadervcommand to create, pack and install mods.
This package is for writing mods. Players do not need it: they only install the
PyloaderV mod in their game folder. The real gta module exists only inside the game.
Quick start
pyloaderv new MyMod
Open the MyMod folder in VS Code (select the Python interpreter where you installed
pyloaderv), edit main.py, then try it in game:
pyloaderv install MyMod/main.py --game "C:\Program Files\Rockstar Games\Grand Theft Auto V"
Press F9 in game to reload scripts after a change.
Commands
| Command | What it does |
|---|---|
pyloaderv new <folder> |
Create a mod folder with a starter main.py (and a pyrightconfig.json that hides the "stub found but no source" warning: the real gta only exists in game) |
pyloaderv pack <folder> [-o Mod.pyv] [--bytecode] |
Pack a mod folder (with main.py) into one .pyv file. --bytecode ships .pyc only and needs Python 3.12 |
pyloaderv install <file.py/.pyv> --game <GTA V folder> |
Copy scripts into <GTA V>/pyscript/ |
pyloaderv pip <packages> --game <GTA V folder> |
Install pip packages (numpy, requests...) for the game's embedded Python 3.12, into shvpy_runtime/Lib/site-packages |
Set the PYLOADERV_GAME environment variable to your GTA V folder to skip --game.
pyloaderv pip downloads Windows x64 wheels for CPython 3.12 whatever Python you run it with;
packages that only exist as source archives cannot be installed this way.
Writing a script
import gta
from gta import player, world, ui
INTERVAL_MS = 500 # on_tick cadence in ms (0 = every frame)
def on_start():
ui.notify("~g~hello ~w~from python")
def on_tick():
me = player.current()
gta.log("info", f"wanted={me.wanted_level}")
def on_key_down(vk, down, shift, ctrl, alt):
if down and vk == 0x74: # F5
ui.notify(f"peds: {len(world.get_all_peds())}")
def on_aborted():
pass
Natives with out-params (BOOL*, int*, float*, Vector3*, Entity*...) return
the values the game writes, after the normal result; trailing out-params can be omitted:
from gta import world
from gta.natives import shapetest
status, hit, pos, normal, entity = shapetest.GET_SHAPE_TEST_RESULT(handle)
target = world.raycast_from_camera() # what the camera looks at
In a .pyv mod, use relative imports for your own modules (from . import mylib): each
.pyv gets a private namespace, so two mods can ship modules with the same name.
Versions
The package version follows the PyloaderV release whose API it describes
(pyloaderv 0.9.x = PyloaderV 0.9). Story mode only: PyloaderV and its mods are not for GTA Online.
Metadata
Release files for pyloaderv 0.9.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyloaderv-0.9.1.tar.gz | 104.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pyloaderv-0.9.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 231.2 kB
Release files / pyloaderv-0.9.1.tar.gz
| Download URL | pyloaderv-0.9.1.tar.gz |
|---|---|
| Size | 104.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0eb8f81bc2b04767e1058fbac13ae5010721816e488d94d105874717f3802508
|
|
BLAKE2b-256 checksum How to use checksums |
bc05a79a7193a29c3c0a7800c3b81582ed83cf560ea4eef5b64b2244af396734
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|
Release files / pyloaderv-0.9.1-py3-none-any.whl
| Download URL | pyloaderv-0.9.1-py3-none-any.whl |
|---|---|
| Size | 126.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0b5de71d2af4f682d74c2950ae02e986cfb7d0433d650dd2613015130d924cc1
|
|
BLAKE2b-256 checksum How to use checksums |
a773e4241270a1793c20a67abbcbfb02f1399d64074bdb7192612f4e76042494
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.10
|