Changed build system to maturin to add rust extensions

This meant moving the python source out of src/ . I dislike this project
structure but will do for now while I think of something better.
setup.cfg is no longer needed and all options are either in pyproject.toml
or Cargo.toml. I still need to figure out a lot of stuff.

Co-authored-by: f-tlm <f-tlm@users.noreply.github.com>
This commit is contained in:
əlemi 2022-05-15 13:02:53 +02:00
parent 23e82be061
commit f238d902fa
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E
222 changed files with 407 additions and 222 deletions

View file

@ -1,12 +1,17 @@
[package] [package]
name = "chunk_unpacker" name = "aiocraft"
version = "1.0.0" version = "1.0.0"
edition = "2021" edition = "2021"
[lib] [lib]
name = "chunk_unpacker" name = "aiocraft"
path = "src/lib.rs" # The source file of the target.
crate-type = ["cdylib"] crate-type = ["cdylib"]
[dependencies] [dependencies]
log = "0.4.17"
pyo3-log = "0.6.0"
pyo3 = { version = "0.16.4", features = ["extension-module"] } pyo3 = { version = "0.16.4", features = ["extension-module"] }
[style]
use_tabs = true

12
aiocraft/__init__.py Normal file
View file

@ -0,0 +1,12 @@
"""aiocraft is an asyncio-driven headless minecraft client"""
# from .client import Client
from .mc import * # TODO move mc out of mc
from .client import MinecraftClient
from .server import MinecraftServer
from .mc.auth import MicrosoftAuthenticator, MojangAuthenticator
from .aiocraft import * # This is needed for PyO3 functions! No clue why or how...
__author__ = "alemidev"
__credits__ = "Thanks to pyCraft, really inspired this"

13
aiocraft/aiocraft.pyi Normal file
View file

@ -0,0 +1,13 @@
from typing import List, Optional, Iterable
def bit_pack(data:Iterable[int], bits:int, size:int): ...
class Chunk:
def __init__(self, x: int, z: int, bitmask: int, ground_up_continuous: bool): ...
def read(self, chunk_data:List[int]): ...
def merge(self, other:'Chunk'): ...
class World:
def __init__(self): ...
def get_block(self, x:int, y:int, z:int) -> Optional[int]: ...
def get(self, x:int, z:int) -> Optional[Chunk]: ...
def put(self, chunk:Chunk, x:int, z:int, merge:bool): ...

Some files were not shown because too many files have changed in this diff Show more