#python #python-bindings #bevy #setup #zeroverse

bin+lib bevy_zeroverse_ffi

bevy zeroverse ffi library

10 releases (5 breaking)

new 0.8.1 Oct 28, 2024
0.8.0 Oct 28, 2024
0.7.1 Oct 27, 2024
0.6.2 Oct 3, 2024
0.3.0 Sep 25, 2024

#530 in Game dev

Download history 242/week @ 2024-09-25 318/week @ 2024-10-02 163/week @ 2024-10-09 13/week @ 2024-10-16 307/week @ 2024-10-23

802 downloads per month

MIT license

49KB
1K SLoC

Rust 667 SLoC // 0.1% comments Python 426 SLoC // 0.1% comments

bevy_zeroverse python bindings

install bevy_zeroverse to your python environment with pip install ffi (from repository root)

install bevy_zeroverse_dataloader to your python environment with pip install ffi/python

test

cargo test -p bevy_zeroverse_ffi --no-default-features

dataloader

torch dataloader API for online bevy_zeroverse batch generation.

run the test script with python ffi/python/test.py to see the dataloader in action.

from bevy_zeroverse_dataloader import BevyZeroverseDataset
from torch.utils.data import DataLoader


dataset = BevyZeroverseDataset(
    editor=False, headless=True, num_cameras=6,
    width=640, height=480, num_samples=1e6,
)
dataloader = DataLoader(dataset, batch_size=2, shuffle=True, num_workers=1)


for batch in dataloader:
    visualize(batch)

macos setup

macos does not support running the generator off main thread. right now, the only way to generate on mac is from rust. e.g.

cargo run -p bevy_zeroverse_ffi --bin generate -- --help

windows setup

export PYO3_PYTHON="/c/Users/{user}/.pyenv/pyenv-win/versions/3.11.7/python.exe"
export PATH="/c/Users/{user}/.pyenv/pyenv-win/versions/3.11.7/libs:$PATH"

rust-analyzer

...
    "rust-analyzer.server.extraEnv": {
        "CARGO_TARGET_DIR": "target/analyzer",
        "PYO3_PYTHON": "C:\\Users\\{user}\\.pyenv\\pyenv-win\\versions\\3.11.7\\python.exe",
        "LIB": "C:\\Users\\{user}\\.pyenv\\pyenv-win\\versions\\3.11.7\\libs"
    },
...

Dependencies

~60–99MB
~1.5M SLoC