No project description provided
Project description
cython-extensions-sc2
API Documentation - for a full list of included functions.
cython-extensions-sc2
is a library designed for the python-sc2 API.
Its purpose is to offer optimized Cython alternatives for commonly used functions,
along with additional useful custom functions.
Note: This library is included for ares-sc2
users by default, no further setup is required.
For bot authors who have a working development environment for python-sc2
or sharpy-sc2
,
there are no additional requirements. Simply check out the releases, download the appropriate zip for your system,
and place the cython_extensions
folder in your bot's root directory. Each release includes a binary that is compatible with the ai-arena
ladder, making it ready for deployment.
Example speedups, results may vary depending on machine and exact scenario. This is by no means a list of all functionality offered.
function | speedup |
---|---|
units.closest_to |
6.85 - 13x speedup depending on scenario |
distance_to |
3 to 7x speedup depending on scenario |
position.center |
2x speedup |
already_pending for units |
6.62x speedup |
units.in_attack_range |
2.05x speedup |
units.sorted_by_distance_to |
8.62x speedup |
unit.is_facing |
9.1x speedup |
Point2.towards |
14.29x speedup |
Tip: use cy_distance_to_squared
where possible for extra 1.3x speedup.
Getting started
Note: currently only python 3.11 is supported unless you clone the project and compile it yourself, more versions will be supported in the future.
To quickly get up and running locally, install with:
pip install cython-extensions-sc2
But when shipping to ladder, grab ubuntu-latest_python3.11.zip
from releases in this repo
and extract cython_extensions
directory within the zip to the root of your bot's directory.
Bot developer
If you already have a python-sc2
, or sharpy-sc2
development environment setup,
then cython-extensions
should work out the box with your bot. Simply check out the releases on this
repo and download the correct zip
for your system.
For example a Windows user should download windows-latest_python3.11.zip
.
Inside this zip you will find a cython_extensions
directory, this should be placed in your bot's root directory
like so:
MyBot
└───cython_extensions
│ └───cython-extensions library files
└───your bot files and directories
For ease of use all cython functions are importable via the main module, for example:
from cython_extensions import cy_distance_to, cy_attack_ready, cy_closest_to
note: in this project all library functions have a cy_
prefix to prevent confusion with python alternatives.
Contributor / Cloning the project
- Install poetry
- Run
poetry install
This will set up a new environment, install all required dependencies and compile the cython code for your system.
If you modify the cython code, run poetry build
to compile it.
Contributing
Contributors are very welcome! There are many missing alternative python-sc2
functions, and if you're
into optimization, the existing functions could likely be improved.
Please use conventional commits if you choose to contribute, it helps the automatic releases detect a new version and generates an accurate changelog.
Example git messages:
feat: add new cython function
fix: fixed buggy function
test: add new test
ci: update github workflow
docs: add new docs
chore: add dependency
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 Distributions
Built Distributions
File details
Details for the file cython_extensions_sc2-0.3.3-cp311-cp311-win_amd64.whl
.
File metadata
- Download URL: cython_extensions_sc2-0.3.3-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 372.8 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cef3e1b8f3f0cfe0deb7fbd2c3ffb5ff0d84c166818aab2a89556178eb99fd9e |
|
MD5 | f6c72374fa20860ce08843873133e8e8 |
|
BLAKE2b-256 | de547484ddfbf1ce0bff741d00e0ce2af3e27d12f50f159f24bced099e4c96a1 |
File details
Details for the file cython_extensions_sc2-0.3.3-cp311-cp311-manylinux_2_35_x86_64.whl
.
File metadata
- Download URL: cython_extensions_sc2-0.3.3-cp311-cp311-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 2.9 MB
- Tags: CPython 3.11, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d71a7b87c39336c3e9aea4bdc04e88e1897ffdedfb0a476285a96253b23bb23a |
|
MD5 | e8e55448408f69c46e5182e68d30a194 |
|
BLAKE2b-256 | 9ac57928902613e39f5d5061d1e43c696771ca7109517bda700ee0c709e4012f |
File details
Details for the file cython_extensions_sc2-0.3.3-cp311-cp311-macosx_12_0_x86_64.whl
.
File metadata
- Download URL: cython_extensions_sc2-0.3.3-cp311-cp311-macosx_12_0_x86_64.whl
- Upload date:
- Size: 966.8 kB
- Tags: CPython 3.11, macOS 12.0+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7950e35f358303f01a207f9680e7113ae11b08e560aa27dc68f6720c1846b3ef |
|
MD5 | c8bf7c6fe4301f189f6bc4d2c4385c4a |
|
BLAKE2b-256 | 4c25ba1a43519906afb336afba0c7fbd6970d31c690da273ba02ac1c20e2aedb |