Skip to content

idlesign/ctyped

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
November 21, 2019 19:18
February 17, 2019 17:33
February 17, 2019 17:33
April 4, 2019 18:48
February 17, 2019 17:33
November 21, 2019 19:18
February 17, 2019 17:33
February 17, 2019 17:33
February 17, 2019 17:33
February 17, 2019 17:33
March 21, 2019 09:25
March 2, 2019 12:29
February 17, 2019 17:33

ctyped

https://github.com/idlesign/ctyped

release lic ci coverage

Description

Build ctypes interfaces for shared libraries with type hinting

Requires Python 3.6+

  • Less boilerplate;
  • Logical structuring;
  • Basic code generator (.so function -> ctyped function);
  • Useful helpers.
from ctyped.toolbox import Library

# Define library.
lib = Library('mylib.so')

@lib.structure
class Box:

    one: int
    two: str

# Type less with function names prefixes.
with lib.scope(prefix='mylib_'):

    # Describe function available in the library.
    @lib.function
    def some_func(title: str, year: int, box: Box) -> str:
        ...

# Bind ctype types to functions available in the library.
lib.bind_types()

# Call library function.
result_string = some_func('Hello!', 2019, Box(one=35, two='dummy'))

Read the documentation for more information.

Documentation

http://ctyped.readthedocs.org/