Ctypes wrapper for easier Python interoperability with Fortran and C
Project description
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.
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file fancy_ctypes-0.2.1.tar.gz.
File metadata
- Download URL: fancy_ctypes-0.2.1.tar.gz
- Upload date:
- Size: 49.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
748f0b8aa0b834ac327403e479a78746e4b2cbd099482613437b1b2d475e3804
|
|
| MD5 |
49cf92ba99882eacfe8839379cf78a91
|
|
| BLAKE2b-256 |
9d1d27f972e01a6878d7f0f59bcea9b4997f0337dc92c3e375c45b98b9146da6
|
File details
Details for the file fancy_ctypes-0.2.1-py3-none-any.whl.
File metadata
- Download URL: fancy_ctypes-0.2.1-py3-none-any.whl
- Upload date:
- Size: 39.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
adcfcc92963654b672663a28ad9fe3c936133d95bd234345295774714334ab43
|
|
| MD5 |
3a4dedee44b054d68914ab04cde44d42
|
|
| BLAKE2b-256 |
8630dea7a443fea01731a0609fe40c94135e5cd32d171b8b8224cfdbfe226574
|