Skip to main content

Sista is a memory-safe and OS-agnostic library for making terminal videogames and animations

Project description

Sista Python C Extension

This directory contains the Python C extension module for the Sista library, which exposes the C API functionality to Python.

Features

  • Full access to Sista C API functions
  • Enum values exposed for foreground colors, background colors, and text attributes
  • Automatic memory management through Python capsules

Building the Extension

Prerequisites

Before building the extension, ensure you have:

  1. Python development headers installed
  2. C++ compiler (g++, clang++, etc.)
  3. The Sista C++ library built and available

Building Process

Option 1: Using setup.py (Recommended)

# Navigate to the project root directory
cd python

# Install required Python packages
pip install setuptools wheel

# Build the extension
python setup.py build_ext --inplace

Installing the Extension

Once built, the extension can be installed in your Python environment:

# Install in development mode
pip install -e .

# Or simply copy the built .so file to your Python site-packages directory

Using the Extension

After successful compilation and installation, you can use the module in Python:

import sista

# Access enum values
print(sista.F_BLACK)    # 30
print(sista.F_RED)      # 31
print(sista.B_WHITE)    # 47
print(sista.A_BRIGHT)     # 1

# Use the API functions
field = sista.create_swappable_field(10, 10)
pawn = sista.create_pawn_in_field(
    field, 'P',
    sista.create_ansi_settings(
        sista.F_RED,
        sista.B_BLACK,
        sista.A_BLINK
    ),
    sista.create_coordinates(0, 0)
)

See the demos in demo/ for more examples.

Testing

You can test the extension with the provided test script:

python demo/test_enums.py

This should output all the enum values that were successfully exposed.

Troubleshooting

Common Issues

  1. Python.h not found: Install Python development headers

    • Ubuntu/Debian: sudo apt-get install python3-dev
    • CentOS/RHEL: sudo yum install python3-devel
    • macOS: brew install python
  2. Library linking errors: Make sure the Sista libraries are built and in your library path

  3. Permission denied: Run with appropriate permissions or use virtual environments

License

This Python extension is licensed under the same license as the Sista project (GNU General Public License v3.0).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

sista-3.0.0a20-cp314-cp314t-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.14tmusllinux: musl 1.2+ x86-64

sista-3.0.0a20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (158.9 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

sista-3.0.0a20-cp314-cp314-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.14musllinux: musl 1.2+ x86-64

sista-3.0.0a20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (157.4 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

sista-3.0.0a20-cp313-cp313-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.13musllinux: musl 1.2+ x86-64

sista-3.0.0a20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (157.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

sista-3.0.0a20-cp312-cp312-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.12musllinux: musl 1.2+ x86-64

sista-3.0.0a20-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (157.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

sista-3.0.0a20-cp311-cp311-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

sista-3.0.0a20-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (157.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

sista-3.0.0a20-cp310-cp310-musllinux_1_2_x86_64.whl (1.2 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

sista-3.0.0a20-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (157.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file sista-3.0.0a20-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b5e9681b4e02ff22280a94d3c4417739f1a750653ea4166d7574ee536d470c85
MD5 2e82210e55a3207d3735343341ed43b5
BLAKE2b-256 e906fbe797b7adae0537ef8978900429f3d071370b6396af8b4d0932feae80f9

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp314-cp314t-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e571e39e388379a054ac8e3306f8ca2fde8d0ff499e3b196131681a8d38416b2
MD5 809e1252fa43ed00f4662ae8e1dac26e
BLAKE2b-256 12e7655607951b79b24b673a11b81cf4a2cca4f753748440f5fa7470c1d30431

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 f07342b49685b742d2c81c7f6db21c5aeeb3c9cc919574365c545cf9eafc923a
MD5 e86eaaa948a697263d1ec8ca8fcf7c2c
BLAKE2b-256 db84c8f58c2054593f3cefdc2bcaac7cd744450750c6e795bd0a611dc373dbae

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp314-cp314-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aca56d515ee4ba61e140226402bc9abab99a3de8ebb108edd7c116a8053473ed
MD5 372e0c361eef2a018e2e5309c1cbcb68
BLAKE2b-256 815b8b29a3218cd0c48227a39daa512af10d3cee3648de384478202ef113a1e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 7997d9a096c1667d891820aeacce998f7e69e48dcb0ff2e9b540eacb78554b53
MD5 41e429e74413b6296dc3a5c8e7fd3508
BLAKE2b-256 d181b5e2f64b14cafc65d32586e0397ce98cd1f6f68a0530508cd6966986301e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp313-cp313-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 54690e569cd11be254e883628ef74ee9978923e3dabe2ef55444e59b627ed699
MD5 ffe84e5423003157b3ff47a1ecf41560
BLAKE2b-256 273338d370ca155c5cdc1bab20eb26d54e3dbdae1d150807792a24e5ba92affb

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0949595fc1150fc2840ecae8076d9bfb07533191e92e85ce4c52f1a20cd939e1
MD5 82b9a63c4a5f82328bbb2fd2e045dbff
BLAKE2b-256 06a684d8bbd3d7cd91b39998b498607ba0930961e59c99ffa74cbeb8b332244a

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp312-cp312-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6f6d856b54ff336b2ea0f7408bce29ced976bad8044acd180a706b0a62639c00
MD5 d2b841cb7072aaf4e7857dfa7ebffff0
BLAKE2b-256 228bc80e78997ffc76ef298bbc606271b7be8fe8dd4fa7ff4088e2d36ce5fbb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 0e5d418c3cf4056003d58daaf5abb745b63b52dfd6e0fc61ad1e5c25c914072f
MD5 03dc701b68055f483bfd44da9765e426
BLAKE2b-256 77e3262c49ba5a3fdd0f8acf41065b37f378cf73424a169d0cb04791ce71272b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp311-cp311-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 248cb80322cbf2c03482ecdff7b221e1397bd11ee0397c7c58a257bfdb88ffd7
MD5 4b60a281af3c766ced68b949bc9262b1
BLAKE2b-256 8d2483e5b4b43d1f8d626d58ec54bf8382067f0c881862aabcaf950b19061b02

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9fa0876f06ab393fca0bcbbc249ccd47a5ad980173997437ca04fc9829f1ccb1
MD5 376d8d803a50759a6e2d379c192004f6
BLAKE2b-256 5a80e5cae9e297e17092eca02d58e6321877e3c0263a50b1484c21f444ba3cbb

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp310-cp310-musllinux_1_2_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sista-3.0.0a20-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a20-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c62a84d8c21f1a16c1dcb2bc8502c6a63b4c11a0ab71d33b8ba54ae30734c012
MD5 9362e11bb56d86465d109ec523e725ac
BLAKE2b-256 b0aed0ceae2ad23010865c7d44d77003cd6de68cc0b2001a52b3c55ec9b04bd6

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a20-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl:

Publisher: python-publish.yml on FLAK-ZOSO/Sista

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page