这是indexloc提供的服务,不要输入任何密码

gen_dartpy 0.0.3 copy "gen_dartpy: ^0.0.3" to clipboard
gen_dartpy: ^0.0.3 copied to clipboard

A library for generating dart bindings to python code via python's C API

A library for generating bindings to interface with Python via Python's C api

Usage #

A simple usage example:

import 'package:dartpy/dartpy.dart';
import 'package:dartpy/dartpy_annotations.dart';
part 'gen_dartpy_example.g.dart';

@PyFunction(module: 'multiply')
int multiply(int a, int b) => pymultiply(a, b);

@PyFunction(module: 'multiply', name: 'multiply')
double mult_double(double a, double b) => pymultiplydouble(a, b);

@PyFunction(module: 'multiply', name: 'multiply')
num mult_num(num a, num b) => pymultiplynum(a, b);

void main() {
  try {
    print(multiply(6, 4));
    print(mult_double(6.13, 5.2));
    print(mult_num(6, 5.2));
    print(mult_num(6, 2));
  } on DartPyException catch (e) {
    if (pyErrOccurred()) {
      dartpyc.PyErr_Print();
    }
    print(e.message);
  }
}

With the following python code:

def multiply(a,b):
    print("Will compute", a, "times", b)
    return a*b

Lint issues? #

Add the following to a build.yaml file in your project directory

targets:
  $default:
    builders:
      source_gen|combining_builder:
        options:
          ignore_for_file: 
            - "type=lint"

Features and bugs #

Please file feature requests and bugs at the issue tracker.

"Python" is a registered trademark of the Python Software Foundation

1
likes
35
points
46
downloads

Publisher

unverified uploader

Weekly Downloads

A library for generating dart bindings to python code via python's C API

View/report issues

License

MIT (license)

Dependencies

analyzer, build, dartpy, source_gen

More

Packages that depend on gen_dartpy