lavalink-rs bindings for Python

Overview

lavasnek_rs

Using the library

The library is available on PyPi, and you can install it via pip install lavasnek_rs --pre -U --user

To install a developement release of the library, go to the Actions tab on GitHub, select the latest commit, and download the Artifact that suits your needs. Extract the artifact, and install the .whl file with pip install -U --user filename.whl

Then you should be able to import the library and use it!

Building and Running the hikari example

If you wanna build the project from source, (for contributing, compiling to a different architecture than x86_64 or for python 3.10) you will need:

# It is highly recommended that you use Linux, either natively or with WSL2

# You will need python 3.6 or newer.
sudo apt install python3-pip curl # for Ubuntu, Debian or derivatives
sudo pacman -S python3-pip curl # for Arch, EndeavourOS, Manjaro or derivatives

# You will also need the rust programming language.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

# You will also need a lavalink server running.
# see https://github.com/freyacodes/Lavalink or use docker
docker run --name lavalink -p 2333:2333 -d -v $HOME/application.yml:/opt/Lavalink/application.yml fredboat/lavalink:dev

Then to run the project, just run all of this. Only the last 2 are repeatable.

python -m venv .env
source .env/bin/activate
pip install maturin

maturin develop
python examples/pure_hikari_basic_queue/bot.py
Comments
  • Fixed the lightbulb examples

    Fixed the lightbulb examples

    Sorry for breaking them, I should have tested everything first 😖

    mypy and flake8 both passed, but if there's any changes you'd like me to make I can :)

    opened by ghost 6
  • improving hikari and lightbulb examples

    improving hikari and lightbulb examples

    general improvements including: -fixing a lot of mypy and flake8 errors with hikari's config (not using hikari's flake8 plugins) -running black and isort with hikari's configj (not using force_single_line in isort config) -addding

    if __name__ == "__main__":
        if os.name != "nt":
            import uvloop
    
            uvloop.install()
    

    to main.py and bot.py -importing lavalink password from consts instead of getting is from environment variables again

    opened by IkBenOlie5 3
  • Typing

    Typing

    __init__.pyi:

    ...
    class ConnectionInfo:
        guild_id: int
        channel_id: int
        endpoint: int
        token: str
        session_id: str
    ...
    

    But real type is dict изображение

    Maybe you meant an object, but you made a dictionary If you want dict, you can use TypedDict

    poetry add typing_extensions
    
    from typing_extensions import TypedDict
    
    ...
    class ConnectionInfo(TypedDict):
        guild_id: int
        channel_id: int
        endpoint: int
        token: str
        session_id: str
    
    opened by LEv145 1
  • feat: add missing typehints for `decode_track`

    feat: add missing typehints for `decode_track`

    This PR adds missing typehints for missing decode_track function of the Lavalink Class and also adds missing typehints for missing track_stuck event of the LavalinkEventHandler class

    opened by thenishantsapkota 0
  • Add CI/CD support to build ARM binaries for POSIX

    Add CI/CD support to build ARM binaries for POSIX

    This is to support the new M1 macs, and people hosting their bots on ARM systems like the Raspberry Pi or Android Phones.

    • [x] Build for 64 bit aarch64-unknown-linux-gnu and aarch64-apple-darwin
    • [ ] Build for 32 bit armv7-unknown-linux-gnueabihf
    enhancement 
    opened by vicky5124 0
  • Remove old search.json

    Remove old search.json

    This was replaced by search.js as of pdoc 8.0.0

    Just a random note if anybody cares but personally I'm using a small script to still build the json search index in the projects where i'm using pdoc 8.0.0 since I still consume it for 3rd party search (e.g. bot search commands). This is pretty easy to achieve since Pdoc hasn't actually changed the format its using for the search index, its just compiling it fully instead of to am middle-ground stage

    opened by FasterSpeeding 0
  • Add tanjun example. Typing improvements.

    Add tanjun example. Typing improvements.

    This pull request adds an example using the tanjun command handler, with both message and slash commands.

    I have also applied some fixes to the typing in lavasnek_rs.pyi and one change inside the rust src.

    • Add __new__ to LavalinkBuilder in .pyi.
    • Change event_handler type from LavalinkEventHandler to object for LavalinkBuilder.build because LavalinkEventHandler is not able to be subclassed. Currently, nothing that is passed can ever be a LavalinkEventHandler.
    • Add guild_id parameter to Lavalink.play
    • Add guild_id parameter to Lavalink.play pyo3 text_signature in lib.rs
    • Make Lavalink.play synchronous in .pyi as it does not return a future. There is something off about this function, in my testing it did not behave normally unless I awaited it, as the examples in the docs show. However the rust code doesn't return a future and the type checker doesn't like that. With this change you can await the function and it behaves normally, but it may be worth looking into a better solution.

    Related to #12 .

    opened by Jonxslays 0
  • Implement missing lavalink-rs features

    Implement missing lavalink-rs features

    • [x] implement equalization
    • [x] implement node data
    • [x] implement lavalink events traits
    • [x] raise proper exceptions rather than generic builtins.Exception
    • [x] allow for nodes to be mutated and removed via python (setters)
    enhancement 
    opened by vicky5124 0
  • Make the discord gateway able to be disabled

    Make the discord gateway able to be disabled

    The discord gateway should be possible to be disabled, to use the voice implementations of the library, to not run 2 gateways in the same shard.

    Also make sure hikari voice models can be used instead of the lavalink-rs discord gateway, and make an example for it.

    enhancement 
    opened by vicky5124 0
Releases(0.1.0-alpha.5)
Owner
Victoria Casasampere Fernandez
Main account in GitLab: https://gitlab.com/vicky5124/
Victoria Casasampere Fernandez
Create, open, manage your Python projects with ease, a project aimed to make python development experience a little better

Create, open, manage your Python projects with ease, a project aimed to make python development experience a little better

Dhravya Shah 7 Nov 18, 2022
Rust <-> Python bindings

rust-cpython Rust bindings for the python interpreter. Documentation Cargo package: cpython Copyright (c) 2015-2020 Daniel Grunwald. Rust-cpython is l

Daniel Grunwald 1.7k Dec 29, 2022
Rust bindings for the Python interpreter

PyO3 Rust bindings for Python. This includes running and interacting with Python code from a Rust binary, as well as writing native Python modules. Us

PyO3 7.2k Jan 4, 2023
Implementation of Monte Carlo PI approximation algorithm in Rust Python bindings

rusty_pi Implementation of Monte Carlo PI approximation algorithm in Rust Python bindings. Time of 100M iterations approximation on Core i7 10th gen:

Aleksey Popov 1 Jul 6, 2022
The polyglot bindings generator for your library (C#, C, Python, …) 🐙

Interoptopus ?? The polyglot bindings generator for your library. Interoptopus allows you to deliver high-quality system libraries to your users, and

Ralf Biedert 155 Jan 3, 2023
Pyo3 - Rust bindings for the Python interpreter

PyO3 Rust bindings for Python, including tools for creating native Python extension modules. Running and interacting with Python code from a Rust bina

PyO3 7.2k Jan 2, 2023
Very experimental Python bindings for the Rust biscuit-auth library

Overview This is a very experimental take on Python bindings for the biscuit_auth Rust library. It is very much a work in progress (limited testing, m

Josh Wright 5 Sep 14, 2022
Python bindings for heck, the Rust case conversion library

pyheck PyHeck is a case conversion library (for converting strings to snake_case, camelCase etc). It is a thin wrapper around the Rust library heck. R

Kevin Heavey 35 Nov 7, 2022
Python bindings for akinator-rs using pyo3

Akinator-py python bindings for akinator-rs using pyo3 Installation Prebuilt wheels are uploaded onto pypi, if you platform is supported, you can inst

Tom-the-Bomb 4 Nov 17, 2022
A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

A script language like Python or Lua written in Rust, with exactly the same syntax as Go's.

null 1.4k Jan 1, 2023
Rust Python modules for interacting with Metaplex's NFT standard.

Simple Metaplex Metadata Decoder Install the correct Python wheel for your Python version with pip: pip install metaplex_decoder-0.1.0-cp39-cp39-manyl

Samuel Vanderwaal 11 Mar 31, 2022
Build a python wheel from a dynamic library

build_wheel Small utility to create a Python wheel given a pre-built dynamic library (.so, .dylib, .dll). If you are just trying to produce a wheel fr

Tangram 1 Dec 2, 2021
Whitewash is python binding for Ammonia.

Whitewash Whitewash is python binding for Ammonia. Ammonia is a whitelist-based HTML sanitization library. It is designed to prevent cross-site script

Vivek Kushwaha 1 Nov 23, 2021
A simple library to allow for easy use of python from rust.

Rustpy A simple library to allow for easy use of python from rust. Status Currently this library has not received much love (pull requests welcome for

Luke 74 Jun 20, 2022
Pyxel - A retro game engine for Python

[ English | 中文 | Deutsch | Español | Français | Italiano | 日本語 | 한국어 | Português | Русский ] Pyxel is a retro game engine for Python. Thanks to its si

Takashi Kitao 11.2k Jan 9, 2023
RustPython - A Python Interpreter written in Rust

RustPython A Python-3 (CPython >= 3.9.0) Interpreter written in Rust ?? ?? ?? . Usage Check out our online demo running on WebAssembly. RustPython req

null 13.3k Jan 2, 2023
Robust and Fast tokenizations alignment library for Rust and Python

Robust and Fast tokenizations alignment library for Rust and Python Demo: demo Rust document: docs.rs Blog post: How to calculate the alignment betwee

Explosion 157 Dec 28, 2022
Arrowdantic is a small Python library backed by a mature Rust implementation of Apache Arrow

Welcome to arrowdantic Arrowdantic is a small Python library backed by a mature Rust implementation of Apache Arrow that can interoperate with Parquet

Jorge Leitao 52 Dec 21, 2022
Ypy - a Python binding for Y-CRDT

Ypy is a Python binding for Y-CRDT. It provides distributed data types that enable real-time collaboration between devices. Ypy can sync data with any other platform that has a Y-CRDT binding, allowing for seamless cross-domain communication. The library is a thin wrapper around Yrs, taking advantage of the safety and performance of Rust.

null 51 Dec 20, 2022