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.0a16-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.0a16-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (154.6 kB view details)

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

sista-3.0.0a16-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.0a16-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (154.6 kB view details)

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

sista-3.0.0a16-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.0a16-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (154.5 kB view details)

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

sista-3.0.0a16-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.0a16-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (154.5 kB view details)

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

sista-3.0.0a16-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.0a16-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (154.8 kB view details)

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

sista-3.0.0a16-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.0a16-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (154.8 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.0a16-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c7d60fa04b8306f0ae21e1a7bd5ba8afd1f1f6b90a7ee5b71a0dc6f0df2379fb
MD5 7f694f3f077511457ff692fb7fa6f54d
BLAKE2b-256 ea321e2754430bbda541d62d9f4016fdeb426ef1c5d58e48d9da16a52acc4601

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2232121da18dbb5e3bc0488668ab3d32b27ecf6c1fc3537045bdad703c809f83
MD5 cf619078848ae97cf37aae8a38f3db90
BLAKE2b-256 76118031fbc86f3e13ecdf7adec10752be92e2b1a98f75484ec97a24621e9597

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp314-cp314-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3a5a6e6612d900c570d4229bcce41a84462b496c0bc6f17c4263dad806a81948
MD5 ff833b60ef5a60261fb2cfe706416d9d
BLAKE2b-256 2c7da2e0c32eac3c8eacbd088a71febf3ae2cdca325b69386d857fcc727ccbe8

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 21fed453de26770ed45963023dd6d0740f549b0e4a409e2a724ca4c3c447f44f
MD5 233f18310b6f03451f64985938c6bef1
BLAKE2b-256 880e2e38a8749b4020be382744d1ccb8ea0f9290cc8f85bdde0ddebb45ffc7ba

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp313-cp313-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4cb4c47f00d7fb8de7dbc2fc8977d8dbd7b96fb686cba53929ecaa4b2c4e6db5
MD5 090bc9c65b362408cfa194cb2236ddde
BLAKE2b-256 db9378d273133e42c0eb779e6f7f544784849f613b9bc4f0adef1343cd7df67f

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3e1fa1f11eedd7b7cdd5a17a0e23ad4683784353464bb2e09cd798edca2b43e9
MD5 f7783a465f8e549ae7f67a7338139455
BLAKE2b-256 bf2eaa8182fb4c46a256cc25efef147e209c0371e763552e31af48aa633902e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp312-cp312-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 82ceb13632dc3005755fca58be3391160a741794e96feb2c0f2fd40919542e1f
MD5 4c2403b4d7a859cf527d7ca6ef092e50
BLAKE2b-256 d33e53ef316ad71d5df568ec600014a54282dae2d13544f78c3e4bacb661ddf7

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b14b368fccbd5feae0c7707bdfc3393d74a09209948cd5234dd9614f4862b757
MD5 f88e98ee2866a560d90f249d08e36db6
BLAKE2b-256 cc669cb049ef6004cea8fad717f405852adc760f03d65e2c9cd5856d5306ca32

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 84e9608f1aae37bbf630e74b0571aa703073c3e6cbe258cb3841084b52a1a1f0
MD5 32f8a03874b252279754ff8b2af946ea
BLAKE2b-256 5d63931322b573531d7949d4e4bba87207ca41ee3aafcba1b1addbd4390d6307

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 63cee386f46e920b5e6324012316b7211c14f0738579b80cefd6434c621228b3
MD5 6ecf4688acf43c255c4ff6805b1c8a50
BLAKE2b-256 6e1e8aa559abe7f4934098367f764bf9072efb2b57eb8b97d550ac5987e098f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 607bab8cb9c7790bdc90ad22e93993e20d2d8c1e0c7d580e9c0fb2a0899cf8e3
MD5 5c981a8b1c39f7b68bfacbe1aff0f4db
BLAKE2b-256 7b3e315488891c14e27f375e5576ec62af2bfcd81a9faa19f75cddc72011d1a0

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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.0a16-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a16-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 5448d6b4e9156e7f5a406fdb979f87df86dd1c0be43c9c01a1ec6f7d99fba671
MD5 f44ac398f0e7cad1701dc6183bcf7669
BLAKE2b-256 5cfa98e13ccf6d621f65c6a476413e6fbc541139ab9badd0c4532d1f0156999b

See more details on using hashes here.

Provenance

The following attestation bundles were made for sista-3.0.0a16-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