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

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

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

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

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

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

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

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

sista-3.0.0a17-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.0a17-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.0a17-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.0a17-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.0a17-cp314-cp314t-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for sista-3.0.0a17-cp314-cp314t-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 9b4f8354f6b76d38a668949f703410d41cd29fc0ddb7dcce480ddccd8f89c4fb
MD5 8e2de619f71fe2d5d1ef6652121b6e26
BLAKE2b-256 f077d70c9d7452c6a7a9557cf9cb960c2907acfca7bd3413ebfeaabe3382becf

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp314-cp314t-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 597930a7bed53120fa74f9e8e16942d3257f64b31b8256623eb357c62738cf13
MD5 228b3269296386bad741b16e03c71998
BLAKE2b-256 52c8d02f1a7d7533219340b1c5107438dcdced9f2c344609dd1eb847af78fcb2

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp314-cp314-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 3e215f3d69e224fb879344b8a7e27d7b1e22f86dc91fd715410e72d491fc036a
MD5 b939e58c2874e9ed3c6293e32be3074e
BLAKE2b-256 a01dcc0c4f8f4d6f827d33e45c085d4a614db5ab469d5de4b9c4816d9cd1f9b8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp314-cp314-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 68b873c0a6d7ae12b52679277f71a1a5f6b961fee669e221b034d49b261fb953
MD5 f1be44c448e6ca6dc1a53a0d43f7ef21
BLAKE2b-256 674c70b7a446070f55aad328d93904c1573fa725482274fa081568a5ad8915c8

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b4d99e8f353cff9799b9bd42e3e6c423d8a2b5c345adcb14eb22dc848e1970ea
MD5 2b0a9fdd5a8566c6ae5b8846702d8050
BLAKE2b-256 1f1bbd65d496dbd734a1b9c06812c0483982173331d8b58b1d3e96db13a64f7f

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 aa33f935205d8bed5edf3b60f82bf5e8192c5730d87739c24ea9755495255b87
MD5 7449767dd9ef1b9634e448657ca25a8b
BLAKE2b-256 2412fd3c25000328ecff0b60c99ce1f0c49803fd33898d798de50443b687084b

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 ab9d2f50fb9c32373ee6f970598c565a831b42b288516735b249cb9fc01cb766
MD5 ed09ed3f7be32ff2bafca00e7236f694
BLAKE2b-256 1abd66391e7b6d3365220157fa731f7fc4ec0bf28e71d8571b43f788e46d01f4

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 57e43ac7ed4be75dca1d5bb382442e9f6505d17fa6b252bae7f31890b586b05e
MD5 5b72597dd8360d6b1fb196f9f980ccd3
BLAKE2b-256 76186279b9cbc8058ff8da6959531b11bcfe86dc83d81cadaeefc6bf4e943ea7

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 4bc03d04526857ff9fce5dc57dbbf7e1077ec2f48f9f88eed9aed46c5ebbdfbb
MD5 bdb3c638f370fabb1b279c388221b8a9
BLAKE2b-256 72d7a040391e17e0dfedb4befce8060859626f9ad9f7652066ca0e0756d778ad

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e3ca0abe2ab3e43f42bdee1be322052dcd4138a44ce2197da798ee3e712fee69
MD5 2acac876db13bc36ddf8f98039531a51
BLAKE2b-256 bae17660ae8ee8723cb3c12319e12f3418cfbe820a7c2d06e2498b9e60540248

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 1d4352ba464d48ca6379d9840c61f8a5d1823cb3e173bcfef1a461702fec8bb3
MD5 9472ae5a87cb7019b7fbf7a1432c4217
BLAKE2b-256 432c12675db52e57ef124ac7f3ed2b4aba806e66bc2bf1bc5b0aed2375603ec1

See more details on using hashes here.

Provenance

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

File metadata

File hashes

Hashes for sista-3.0.0a17-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d88ee9a2ba0d2323887e91b58350ed14055224d4bcf7f3ad01f45e9b41413b6b
MD5 3ec88e562e53a06cfdc317eb92050342
BLAKE2b-256 ffe5d9c485bafb9883d4e56f082a98b146967804fa51be3b58064cfec7ca40cf

See more details on using hashes here.

Provenance

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