diff --git a/BallanceTasSonnet/pyproject.toml b/BallanceTasSonnet/pyproject.toml index 2263e38..2cc739b 100644 --- a/BallanceTasSonnet/pyproject.toml +++ b/BallanceTasSonnet/pyproject.toml @@ -9,7 +9,6 @@ classifiers = [ "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", ] -dynamic = ["version"] dependencies = [] [build-system] @@ -17,11 +16,7 @@ requires = ["maturin>=1.11,<2.0"] build-backend = "maturin" [tool.maturin] +binding = "pyo3" python-source = "python" manifest-path = "rust/Cargo.toml" module-name = "blctas._blctas" - -[tool.uv.workspace] -members = [ - "blctas", -] diff --git a/BallanceTasSonnet/python/blctas/_blctas/__init__.pyi b/BallanceTasSonnet/python/blctas/_blctas/__init__.pyi new file mode 100644 index 0000000..e69de29 diff --git a/BallanceTasSonnet/python/blctas/_blctas/tasfile.pyi b/BallanceTasSonnet/python/blctas/_blctas/tasfile.pyi new file mode 100644 index 0000000..38d9476 --- /dev/null +++ b/BallanceTasSonnet/python/blctas/_blctas/tasfile.pyi @@ -0,0 +1,28 @@ +import tasfile +import typing + +class TasFile: + def append(self, /, count: int, delta_time: float) -> typing.Any: ... + def batchly_clear_key_pressed(self, /, index_from: int, index_to: int) -> typing.Any: ... + def batchly_flip_key_pressed(self, /, index_from: int, index_to: int, key: tasfile.TasKey) -> typing.Any: ... + def batchly_set_delta_time(self, /, index_from: int, index_to: int, delta_time: float) -> typing.Any: ... + def batchly_set_key_pressed(self, /, index_from: int, index_to: int, key: tasfile.TasKey, pressed: bool) -> typing.Any: ... + def clear(self, /) -> typing.Any: ... + def clear_key_pressed(self, /, index: int) -> typing.Any: ... + def flip_key_pressed(self, /, index: int, key: tasfile.TasKey) -> typing.Any: ... + def get_count(self, /) -> int: ... + def get_delta_time(self, /, index: int) -> float: ... + def insert(self, /, index: int, count: int, delta_time: float) -> typing.Any: ... + def is_empty(self, /) -> bool: ... + def is_key_pressed(self, /, index: int, key: tasfile.TasKey) -> bool: ... + def remove(self, /, index_from: int, index_to: int) -> typing.Any: ... + def set_delta_time(self, /, index: int, delta_time: float) -> typing.Any: ... + def set_key_pressed(self, /, index: int, key: tasfile.TasKey, pressed: bool) -> typing.Any: ... + +class TasKey: + def __eq__(self, /, other: TasKey | int) -> bool: ... + def __ne__(self, /, other: TasKey | int) -> bool: ... + +def create(count: int, delta_time: float) -> tasfile.TasFile: ... +def load(filename: str) -> tasfile.TasFile: ... +def save(file: tasfile.TasFile, filename: str) -> typing.Any: ... diff --git a/BallanceTasSonnet/python/blctas/py.typed b/BallanceTasSonnet/python/blctas/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/BallanceTasSonnet/python/blctas/tasfile.py b/BallanceTasSonnet/python/blctas/tasfile.py index e69de29..f06ecf2 100644 --- a/BallanceTasSonnet/python/blctas/tasfile.py +++ b/BallanceTasSonnet/python/blctas/tasfile.py @@ -0,0 +1,4 @@ +import _blctas.tasfile + +if __name__ == '__main__': + print(dir(_blctas)) diff --git a/BallanceTasSonnet/rust/Cargo.lock b/BallanceTasSonnet/rust/Cargo.lock index 574449e..47cadbc 100644 --- a/BallanceTasSonnet/rust/Cargo.lock +++ b/BallanceTasSonnet/rust/Cargo.lock @@ -9,9 +9,16 @@ dependencies = [ "byteorder", "libz-sys", "pyo3", + "pyo3-introspection", "thiserror", ] +[[package]] +name = "anyhow" +version = "1.0.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a23eb6b1614318a8071c9b2521f36b424b2c83db5eb3a0fead4a6c0809af6e61" + [[package]] name = "autocfg" version = "1.5.0" @@ -40,6 +47,17 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8591b0bcc8a98a64310a2fae1bb3e9b8564dd10e381e6e28010fde8e8e8568db" +[[package]] +name = "goblin" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4db6758c546e6f81f265638c980e5e84dfbda80cfd8e89e02f83454c8e8124bd" +dependencies = [ + "log", + "plain", + "scroll", +] + [[package]] name = "heck" version = "0.5.0" @@ -55,6 +73,12 @@ dependencies = [ "rustversion", ] +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + [[package]] name = "libc" version = "0.2.180" @@ -73,6 +97,18 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "memchr" +version = "2.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" + [[package]] name = "memoffset" version = "0.9.1" @@ -94,6 +130,12 @@ version = "0.3.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" +[[package]] +name = "plain" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4596b6d070b27117e987119b4dac604f3c58cfb0b191112e24771b2faeac1a6" + [[package]] name = "portable-atomic" version = "1.13.0" @@ -145,6 +187,19 @@ dependencies = [ "pyo3-build-config", ] +[[package]] +name = "pyo3-introspection" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6cd5679197d3cfdd7d9d241edf688ec13efd4fc302b35e8596f2831a0be5109" +dependencies = [ + "anyhow", + "goblin", + "serde", + "serde_json", + "unicode-ident", +] + [[package]] name = "pyo3-macros" version = "0.27.2" @@ -185,6 +240,69 @@ version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" +[[package]] +name = "scroll" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1257cd4248b4132760d6524d6dda4e053bc648c9070b960929bf50cfb1e7add" +dependencies = [ + "scroll_derive", +] + +[[package]] +name = "scroll_derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed76efe62313ab6610570951494bdaa81568026e0318eaa55f167de70eeea67d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + [[package]] name = "shlex" version = "1.3.0" @@ -210,18 +328,18 @@ checksum = "b1dd07eb858a2067e2f3c7155d54e929265c264e6f37efe3ee7a8d1b5a1dd0ba" [[package]] name = "thiserror" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.17" +version = "2.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" dependencies = [ "proc-macro2", "quote", @@ -245,3 +363,9 @@ name = "vcpkg" version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "zmij" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94f63c051f4fe3c1509da62131a678643c5b6fbdc9273b2b79d4378ebda003d2" diff --git a/BallanceTasSonnet/rust/Cargo.toml b/BallanceTasSonnet/rust/Cargo.toml index 27e3bad..30f9799 100644 --- a/BallanceTasSonnet/rust/Cargo.toml +++ b/BallanceTasSonnet/rust/Cargo.toml @@ -9,7 +9,8 @@ name = "_blctas" crate-type = ["cdylib"] [dependencies] -pyo3 = "0.27.0" +pyo3 = { version = "0.27.0", features = ["extension-module", "experimental-inspect"] } +pyo3-introspection = "0.27.0" thiserror = "2.0.12" byteorder = "1.5.0" libz-sys = "1.1.23" diff --git a/BallanceTasSonnet/uv.lock b/BallanceTasSonnet/uv.lock index 7edc3fc..17aa288 100644 --- a/BallanceTasSonnet/uv.lock +++ b/BallanceTasSonnet/uv.lock @@ -4,9 +4,5 @@ requires-python = ">=3.8" [[package]] name = "blctas" +version = "1.0.0" source = { editable = "." } - -[package.metadata] - -[package.metadata.requires-dev] -dev = []