Python CFFI bindings for Raylib
Project description
Python Bindings for Raylib 3.7
New CFFI API static bindings. Automatically generated to be as close as possible to original Raylib. Faster, fewer bugs and easier to maintain than ctypes.
Install
We distribute a statically linked binary Raylib wheel:
pip3 install raylib
Some platforms that should be available: Windows 10 x64, MacOS 10.15 x64, Linux Ubuntu1804 x64.
If yours isn't available then pip will attempt to build from source, so you will need to have Raylib development libs installed.
If it doesn't work, build from source
How to use
There are three different ways of using this binding. You only need to pick one method, but you can combine two methods in one program if you want to.
If you are familiar with C coding and the Raylib C library and you want to use an exact copy of the C API
Use raylib.static.
If you prefer a slightly more Pythonistic API and don't mind it might be slightly slower
Use raylib.pyray.
If you insist on dynamic bindings and don't care that they are slower and less safe
Use raylib.dynamic.
RLZero
Work in progress:
A simplified API for Raylib for use in education and to enable beginners to create 3d games
Help wanted
- converting more examples from C to python
- testing and building on more platforms
Performance
For fastest permformance use Pypy rather than standard python.
Every call to C is costly, so it's slightly faster if you use Python data structures and functions when calculating in your update loop and then only convert them to C data structures when you have to call the C functions for drawing.
Bunnymark
Library | Implementation | Bunnies (60 FPS) | Percentage |
---|---|---|---|
Raylib 3.7 | C | 168100 | 100% |
Raylib Python CFFI 3.7 | Pypy 3.7 | 33800 | 20% |
Raylib Python CFFI 3.7 | Python 3.9 | 7700 | 4.5% |
Raylib Python CFFI 3.7 | Python 3.9 Nuitka | 8600 | 5.1% |
Raylib Python CFFI 3.7 Dynamic | Python 3.9 | 6300 | 3.7% |
Packaging your app
You can create a standalone binary using the Nuitka compiler. For example, here is how to package Bunnymark:
pip3 install nuitka
cd examples/textures
python3 -m nuitka --onefile --linux-onefile-icon resources/wabbit_alpha.png textures_bunnymark.py
Advert
RetroWar: 8-bit Party Battle is out now. Defeat up to 15 of your friends in a tournament of 80s-inspired retro mini games.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for raylib-3.7.0.post3-pp37-pypy37_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff7cd4849208432477d3bb23ff636efab8543aa0c33d46298bf79216f80eacb3 |
|
MD5 | 80b393e6169d91000587efe2356404c4 |
|
BLAKE2b-256 | 3b823941107cb90156796a874d35d6373cdfc74afe8d886c0a63718f6f800758 |
Hashes for raylib-3.7.0.post3-pp36-pypy36_pp73-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da3cb880758dd71b38019c167f1369c666c1e5c6a85a975f49ba808e99370405 |
|
MD5 | 9ed0eb14403ee894503a5f7f68d43c4b |
|
BLAKE2b-256 | d2f06e41d4929cb69b9088295ab08d86f61951f05278f8159c6b21ac4296ff9e |
Hashes for raylib-3.7.0.post3-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e3123fb5ee61c274bda86d5d85d334817bd3635618ef4360b8722ddc9c136732 |
|
MD5 | c09f1183434014b47c90fab5ada6414d |
|
BLAKE2b-256 | 10bc03cb64b1408307b339b967d9ed8a38eb531ec0ee553a1f2fce59cd364ae5 |
Hashes for raylib-3.7.0.post3-cp310-cp310-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61f8ce666416768e72da637b8ced2345be756f877ebdd54684f7ca431999a51c |
|
MD5 | d21160c2882f94363ad25499c499717b |
|
BLAKE2b-256 | 5f49c3ad0ee09e7b459e99084100629b8ca3848025469fb68b05e6e8bd2b29f2 |
Hashes for raylib-3.7.0.post3-cp310-cp310-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4db2b579321ad3c3066517545c70d6e6b341ba4cc6a187d9f0419f9704602aa4 |
|
MD5 | 04d371b55e9afaa3ea165f1fb6ff125e |
|
BLAKE2b-256 | 5a1df5f43c4ce6416cbdd8c489814fdfa00a5801c35693701d8492f1ebca242a |
Hashes for raylib-3.7.0.post3-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3041ab0f1cd93bce122a539ad0cc6064d01e667b118a0b8df4124517ca79527 |
|
MD5 | 7b252e3e5391b8de59c14c56272af814 |
|
BLAKE2b-256 | 959333ba280b9e4bfa40ba8fd834c3c254f6ce098e004601eebbd483f407772f |
Hashes for raylib-3.7.0.post3-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fe0523eca4c1813cfcdae612a8e89805e70e4610733f32eec5db9dd47de26cc0 |
|
MD5 | 81edb162f0439f26f172682496257e50 |
|
BLAKE2b-256 | af524ea1eb748bb54ef227948ab318705eab26fce2445fdf3e861d9347d29b32 |
Hashes for raylib-3.7.0.post3-cp39-cp39-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 913808e17ed2e68fabd89fcbb18a74aa1481e746df4b7f18895fe26fcb50dfba |
|
MD5 | f78bed8e33bf387964f3f6b7e28f9180 |
|
BLAKE2b-256 | 9adba0393513471b133d9d6a43f7741e71e63d0ddb17b47fb25901c80da2449d |
Hashes for raylib-3.7.0.post3-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0830352b82ba888c0955eb57759fb1005795c8779fac66e1226ac69392bdc941 |
|
MD5 | 62e99e2419f9c1cfd1b640aa214c9797 |
|
BLAKE2b-256 | cb2102800f3e2a2b84099e4296cb1cb45797ab517db0499398baf515c2857188 |
Hashes for raylib-3.7.0.post3-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ac90369ea5b8b3d9ca5b056fd6446f651f8295b446a5189ce6349b8d43f59baa |
|
MD5 | bd07f39c955d2750db3012dc45f2decb |
|
BLAKE2b-256 | d2b991e3a62b8def8931f59aa943e98b41d1e3d0852db73badad6cd4f151d4f1 |
Hashes for raylib-3.7.0.post3-cp38-cp38-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c347ac2da37ac54756a4b1250504749d21ee7d3b9d43eff893f9d24d10fcd53c |
|
MD5 | b36ac10eefef5d861f2f79016cdf2f06 |
|
BLAKE2b-256 | dc0e321fe162d599ba92ff70d9fbc4c6036a20e1b528a8d48974d904e545a4a9 |
Hashes for raylib-3.7.0.post3-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9cb42be84a2aec281085ae63fe9d1755fb3f7d0cba938b814426df527e9abbdd |
|
MD5 | 6c70a9755d4d35f03a6cdaabc01d9ade |
|
BLAKE2b-256 | 46f6b78e52377d92fcc2f3fea1750b06124f32b45a8f888cbb6a37c2c89cc745 |
Hashes for raylib-3.7.0.post3-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 563f6054152d90615f2612c15c633edb4bfec2cd476d9fa448a6d98de80677da |
|
MD5 | c03dfe23361b363e3f684b6e0e18516a |
|
BLAKE2b-256 | b03e38d713d715e3b90cfbcc038b56aa65d0d14f5ca736b43ae7bf378ef499a9 |
Hashes for raylib-3.7.0.post3-cp37-cp37m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7c3f3297d242a3d74195fb5e61244a9c11fb9797dbfed71910832e7116613d0 |
|
MD5 | 7931bc7a65d00db8c74ed8249b5809e7 |
|
BLAKE2b-256 | 6db34291b0d5594d6cf0d4be1b50c9bca9d332c6f7701fa3404ee54738933d73 |
Hashes for raylib-3.7.0.post3-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dbff20ece0e15b46a2ff69c873a0cc395fdb6c544b680652474229ec66b0d347 |
|
MD5 | aa5dd1f6d300a4f55c0f54679bc90eb1 |
|
BLAKE2b-256 | 9b1f3e04450fcc4ef5a4b767c220d4a7a086910c0f560a5184e804039f324df7 |
Hashes for raylib-3.7.0.post3-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ddf84148ebbd4866d7a324131c35052c103453c0763e01fc98e36a5bff76a2ef |
|
MD5 | 413558b38a36081aa07d2468cb311502 |
|
BLAKE2b-256 | 8f292cc422265aa70d94fc50ea3b9ba56872909a0ed17f0f5ec4c339f65dfacf |
Hashes for raylib-3.7.0.post3-cp36-cp36m-macosx_10_14_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a9ec3af8405bf2fc6f001207de21a22a48338f14c66b2e11b0a34e9711a9d68 |
|
MD5 | 579d664376d7cca1ea7934a102985408 |
|
BLAKE2b-256 | 2199f7ea6a72b5c6022964df7090127afe1784a89182645634b373d2e96fe9ee |