OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-atomspace / examples / type-system / demo-types / chempydemo.pyx

28 lines · pyx ref:
#!python
#cython: language_level=3
#
# chempydemo.pyx
#
# Example cython file showing how to define a python module
# containing the custom Atom Types. The cython compiler will
# convert this into the C++ file `chempydemo.cpp` which is
# then compiled into a shared object. The shared object can
# be loaded and used as a python module. See the `apps` directory
# for an example of using this.

from opencog.atomspace import regenerate_types
from opencog.atomspace import add_node, add_link

# The chem_types_init() function is defined in the ChemTypes.cc file.
# Calling it causes the shared library defining the type constructors
# to be loaded.
cdef extern:
    void chem_types_init()

chem_types_init()
types = regenerate_types()

# This file is located in the build directory; it is generated by
# the CMake scripts.
include "examples/type-system/demo-types/chem_types.pyx"