Skip to main content

FancyTypes

Syntax sugar for ctypes that provides a more confortable way to load and setup shared libraries for your projects. The goal of this simple package is to reduce boilerplate and replace tedious syntax with something more intuitive and fancier.

Features

  • Load shared libraries and only interface the desired procedures.
  • Parse argument and result types together through a dedicated parser function.
  • Multiple type aliases available (e.g. real64 / float64 for 64-bit floating point numbers)
  • Improved syntax to define C struct and union types
  • Tools to work with NumPy arrays

All ctypes types are compatible even if FancyTypes does not provide its own specific class for them. For example, char support is limited since the main focus of the package is numerical computing, so syntax improvements to pass strings around are limited to turning them into NumPy arrays and not much else. Typically, strings and I/O can be handled on the Python side.

Dependency free

The only dependency is NumPy for array handling. The NumPy package is pretty much part of the standard library amongst the Python numerical computing ecosystem, so any project that could potentially use this will most likely already depend on NumPy on its own.

Documentation

Read the documentation and find out if this package could be useful to you.

Installation and importing

The package can be installed from PyPI

pip install fancy-ctypes

Alternatively, download this repository and run

pip install .

The package is imported as

import fancytypes

# For confort
import fancytypes as ft

Platform

The package is intended to be platform agnostic, although shared libraries are not. This is a tool that interfaces those libraries with Python, but users still need to build them first however they want.

Metadata

Release files for fancy-ctypes 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for fancy-ctypes 0.2.1
File Size Uploaded
fancy_ctypes-0.2.1.tar.gz 49.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for fancy-ctypes 0.2.1
File Interpreter ABI Platform
fancy_ctypes-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 89.2 kB

Release files / fancy_ctypes-0.2.1.tar.gz

Download URL fancy_ctypes-0.2.1.tar.gz
Size 49.8 kB
Tags Source
SHA-256 checksum
How to use checksums
748f0b8aa0b834ac327403e479a78746e4b2cbd099482613437b1b2d475e3804
BLAKE2b-256 checksum
How to use checksums
9d1d27f972e01a6878d7f0f59bcea9b4997f0337dc92c3e375c45b98b9146da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / fancy_ctypes-0.2.1-py3-none-any.whl

Download URL fancy_ctypes-0.2.1-py3-none-any.whl
Size 39.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
adcfcc92963654b672663a28ad9fe3c936133d95bd234345295774714334ab43
BLAKE2b-256 checksum
How to use checksums
8630dea7a443fea01731a0609fe40c94135e5cd32d171b8b8224cfdbfe226574
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page