Skip to content

Commit

Permalink
Use Sequence instead of List in pyi
Browse files Browse the repository at this point in the history
Update to PyO3 0.21
  • Loading branch information
VirxEC committed Mar 30, 2024
1 parent a587044 commit 8e4b1ca
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 39 deletions.
66 changes: 37 additions & 29 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rlviser-py"
version = "0.6.3"
version = "0.6.4"
edition = "2021"
description = "Python implementation that manages a UDP connection to RLViser"
license = "MIT"
Expand All @@ -16,7 +16,7 @@ name = "rlviser_py"
crate-type = ["cdylib"]

[dependencies]
pyo3 = "0.20.0"
pyo3 = "0.21.0"

[profile.release]
lto = true
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]


[tool.maturin]
features = ["pyo3/extension-module", "pyo3/abi3-py37"]
8 changes: 4 additions & 4 deletions rlviser_py.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import List, Optional, Tuple
from typing import Sequence, Optional, Tuple

from RocketSim import BallState, CarConfig, CarState, GameMode, Team

Expand All @@ -7,13 +7,13 @@ type TRotmat = Tuple[TVec3, TVec3, TVec3]
type TBall = Tuple[TVec3, TRotmat, TVec3, TVec3]
type TCar = Tuple[int, TVec3, TRotmat, TVec3, TVec3, float, bool, bool, bool, float]

def set_boost_pad_locations(locations: List[TVec3]) -> ...:
def set_boost_pad_locations(locations: Sequence[TVec3]) -> ...:
pass

def get_state_set() -> Optional[Tuple[List[float], TBall, List[TCar]]]:
def get_state_set() -> Optional[Tuple[Sequence[float], TBall, Sequence[TCar]]]:
pass

def render(tick_count: int, tick_rate: float, game_mode: GameMode, boost_pad_states: List[bool], ball: BallState, cars: List[Tuple[int, CarState]]) -> ...:
def render(tick_count: int, tick_rate: float, game_mode: GameMode, boost_pad_states: Sequence[bool], ball: BallState, cars: Sequence[Tuple[int, CarState]]) -> ...:
pass

def quit() -> ...:
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ macro_rules! pynamedmodule {
#[doc = $doc]
#[pymodule]
#[allow(redundant_semicolons)]
fn $name(_py: Python, m: &PyModule) -> PyResult<()> {
$(m.add_function(wrap_pyfunction!($func_name, m)?)?);*;
fn $name(_py: Python, m: Bound<PyModule>) -> PyResult<()> {
$(m.add_function(wrap_pyfunction!($func_name, &m)?)?);*;
$(m.add($var_name, $value)?);*;
Ok(())
}
Expand All @@ -38,7 +38,7 @@ pynamedmodule! {
}

thread_local! {
static BOOST_PAD_LOCATIONS: RefCell<Vec<Vec3>> = RefCell::new(Vec::new());
static BOOST_PAD_LOCATIONS: RefCell<Vec<Vec3>> = const { RefCell::new(Vec::new()) };
}

/// Set the boost pad locations to send to RLViser in each packet
Expand Down

0 comments on commit 8e4b1ca

Please sign in to comment.