Differences between revisions 36 and 88 (spanning 52 versions)
Revision 36 as of 2004-01-06 04:57:25
Size: 4038
Editor: ediacara
Comment: Added Lua section with 2 links.
Revision 88 as of 2018-03-07 22:49:23
Size: 8226
Editor: WimLavrijsen
Comment: Add link to article in SciPy as it's current; dated the others; removed dead links. Marked weave as deprecated.
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<TableOfContents>>

[Hint: The idea is to create pages for the stuff, not just link it.]
Line 4: Line 8:
 * [http://www.swig.org/ SWIG] - generate extension module from your .h files
 * ["boost.python"] - write (tiny) C++ class to wrap your classes in an extension module
 * ["Pyrex"] - write your extension module on Python (!)
 * [http://cxx.sourceforge.net/ CXX]
 * [http://starship.python.net/crew/gmcm/scxx.html SCXX]
 * ["weave"] - include C code lines in Python program
 * ["SIP"] - ["Qt"] API wrapper library
 * [http://starship.python.net/crew/theller/ctypes/ ctypes] is a Python module allowing to create and manipulate C data types in Python. These can then be passed to C-functions loaded from dynamic link libraries.
 * ["elmer"] - compile and run python code from C, as if it was written in C
 * [[Pyrex]] - write your extension module on Python (!)
 * [[http://cython.org/|Cython]] -- Cython -- an improved version of Pyrex
 * [[http://cxx.sourceforge.net/|CXX]] - PyCXX - helper lib for writing Python extensions in C++
 * [[http://starship.python.net/crew/theller/ctypes/|ctypes]] is a Python module allowing to create and manipulate C data types in Python. These can then be passed to C-functions loaded from dynamic link libraries.
 * [[elmer]] - compile and run python code from C, as if it was written in C
 * [[http://www.picklingtools.com/|PicklingTools]] is a collection of libraries for exchanging Python Dictionaries between C++ and Python.
 * [[weave]] - include C code lines in Python program (deprecated in favor of Cython)
 * [[https://code.google.com/p/ackward/|ackward]] exposes parts of Python's standard library as idiomatic C++
 * [[http://cffi.readthedocs.org/|CFFI]] - interact with almost any C code from Python, based on C-like declarations that you can often copy-paste from header files or documentation.
Line 14: Line 18:
[Hint: The idea is to create pages for the stuff, not just link it.] === C/C++ Binding Generators ===
Tools to make C/C++ functions/methods accessible from Python by generating binding (Python extension or module) from header files.
Line 16: Line 21:
[wiki:Thinki/UsingPythonWithOtherLanguages Much more extensive page on Thinki]
== Articles ==
 * Embedding Python in Multi-Threaded C/C++ Applications in [http://www.linuxjournal.com/article.php?sid=3641 LinuxJournal]
 * Building Hybrid Systems with Boost.Python in [http://www.cuj.com/documents/s=8188/cuj0307abrahams/ C/C++ User Journal]
 * [http://dales.rmplc.co.uk/Duncan/accu/integratingpython.html Integrating Python, C and C++], presented at the ACCU conference by Duncan Booth, and his [http://dales.rmplc.co.uk/Duncan/accu conference slides]
 * [[boost.python]] - Expose C++ classes functions and objects to Python, and vice-versa, using just C++ compiler
 * [[https://github.com/orangeduck/PyAutoC|PyAutoC]] - Automatically wrap C functions and structs, using just C compiler.
 * [[http://pwig.sourceforge.net/|pwig]] is a SWIG extension for writing new language modules in Python.
 * [[https://github.com/gjcarneiro/pybindgen|PyBindGen]] Python bindings code generator for pure C or C++ APIs. The generator is written in Python and has low complexity. The generated code is lean, efficient, and highly readable
 * [[https://pyside.github.io/docs/shiboken/|shiboken]] - Binding Generator used to create PySide Python bindings for Qt
 * [[SIP]] - similar to SWIG but specialised for Python and C++. Used to create PyQt, the [[Qt]] API wrapper library
 * [[http://www.swig.org/|SWIG]] - generate extension module from your .h files
 * [[https://github.com/wjakob/pybind11|pybind11]] - Similar to Boost.Python, but with a lean header-only implementation for C++11-capable compilers.
 * [[https://github.com/google/clif|pyclif]] - Google tool. Similar to SWIG, but user-friendly and targeted only C++11 well-written libs.
 * [[cppyy]] - Interact with C/C++ through LLVMs JIT with automatic pythonizations for a "python feel." Support tools are available for large scale projects.
Line 22: Line 32:
-----
[[There are also interesting solutions for co-operation
between Python and such languages as Tcl,
Perl,
Fortran,
Prolog,
and many others.
We'll write more on these subjects, in time.]]
----
'''Articles'''

 * Using Python as glue [[https://docs.scipy.org/doc/numpy/user/c-info.python-as-glue.html|SciPy Documentation]]
 * Building Hybrid Systems with Boost.Python in [[http://www.boost.org/doc/libs/develop/libs/python/doc/html/article.html|C/C++ User Journal]] (2003)
 * Integrating Python, C and C++, presented at the ACCU conference by Duncan Booth (2003)
 * Embedding Python in Multi-Threaded C/C++ Applications in [[http://www.linuxjournal.com/article.php?sid=3641|LinuxJournal]] (2000)

----
'''Related'''

 * AppsWithPythonScripting

= Delphi =
 * Python4Delphi - Python for Delphi is a set of free components that wrap up the Python Dll into Delphi. (https://github.com/pyscripter/python4delphi)
Line 32: Line 49:
 * ["F2PY"] - Fortran to Python Interface Generator (http://cens.ioc.ee/projects/f2py2e/)  * [[F2PY]] - Fortran to Python Interface Generator (http://cens.ioc.ee/projects/f2py2e/)
Line 35: Line 52:
= Lisp =
 * [[CLPython]] - Python implemented in Common Lisp
 * [[http://web.archive.org/web/20050207230521/http://www.caddr.com/code/lython/|Lython (archived page)]] - Lisp front-end for Python
 * [[http://pymacs.progiciels-bpi.ca/|Pymacs]] - integration of Python with Emacs Lisp
Line 36: Line 58:
 * PyLog [http://christophe.delord.free.fr/en/pylog/prolog.html]
 * bedevere [http://bedevere.sourceforge.net/]
 * [http://agave.ahsc.arizona.edu/~schcats/projects/ prolog] a simple interface to [http://www.swi-prolog.org/ SWI-Prolog]
 * PyLog (actually two ''different'' products)
 * [[http://agave.ahsc.arizona.edu/~schcats/projects/|prolog]] a simple interface to [[http://www.swi-prolog.org/|SWI-Prolog]]
 * bedevere - Python wrapper to GNU Prolog http://bedevere.sourceforge.net/
 * [[http://pwig.sourceforge.net/|pwig]] includes examples of wrapping Python for SWI-Prolog.
 * [[http://code.google.com/p/pyswip/|pyswip]] is a ctypes based module that enables querying SWI-Prolog.
Line 40: Line 64:
See also [http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=Python+prolog] See also http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=Python+prolog
Line 43: Line 67:
 * ["Jython"] - Python implemented in Java  * [[Jython]] - Python implemented in Java
 * [[JPype]] - Allows Python to run java commands
 * [[Jepp]] - Java embedded Python
 * [[http://pypi.python.org/pypi/JCC/2.12|JCC]] - a C++ code generator for calling Java from C++/Python
 * [[http://pypi.python.org/pypi/javabridge|Javabridge]] - a package for running and interacting with the JVM from CPython
 * [[https://www.py4j.org/index.html|py4j]] - Allows Python to run java commands.
 * [[http://pybee.org/voc/|voc]] - Part of BeeWare suite. Converts python code to Java bytecode.
 * [[https://github.com/chrishumphreys/p2j|p2j]] - Converts Python code to Java. No longer developed.
Line 46: Line 77:
 * [http://www.activestate.com/Corporate/Initiatives/NET/Research.html?_x=1 ActiveState research]
 * [http://zope.org/Members/Brian/PythonNet/ Python for .NET] is a near-seamless integration of the CPython runtime with the .NET Common Language Runtime (CLR).
 * [[http://www.activestate.com/Corporate/Initiatives/NET/Research.html?_x=1|ActiveState research]]
 * [[http://zope.org/Members/Brian/PythonNet/|Python for .NET]] is a near-seamless integration of the CPython runtime with the .NET Common Language Runtime (CLR).
 * [[http://www.codeplex.com/IronPython|IronPython]] is an implementation of Python for .net, which allows you to import .net class libraries seamlessly in Python.
Line 51: Line 83:
 * PyPerl [http://aspn.activestate.com/ASPN/CodeDoc/pyperl/perlmodule.html]
 * [http://search.cpan.org/search?query=Inline%3A%3APython&mode=all Inline::Python]

* PyPerl http://search.cpan.org/dist/pyperl/
 * [[http://search.cpan.org/search?query=Inline::Python&mode=all|Inline::Python]]
Line 54: Line 87:
   
For converting/porting Perl code to Python the tool 'Bridgekeeper' http://www.crazy-compilers.com/bridgekeeper/ may be handy.

= PHP =
 * PiP (Python in PHP) http://www.csh.rit.edu/~jon/projects/pip/
 * PHP "Serialize" in Python http://hurring.com/scott/code/python/serialize/ (broken link; see the [[http://web.archive.org/web/20110807032037/http://hurring.com/scott/code/python/serialize/|Web Archive Wayback Machine]] for the latest working version)
Line 56: Line 95:
 * RPy [http://rpy.sourceforge.net]
 * RSPython [http://www.omegahat.org/RSPython]
 * RPy [[http://rpy.sourceforge.net/|http://rpy.sourceforge.net]]
 * RSPython http://www.omegahat.net/RSPython
Line 63: Line 102:
 * ["elmer"] - compile and run python code from Tcl, as if it was written in Tcl
 * [http://jfontain.free.fr/tclpython.htm TclPython] - a Python package for Tcl allows execution of Python (version 2.2 or above) code from a Tcl interpreter.
 * [http://mini.net/tcl/1324 Tcl and other languages] - Tcl's equivalent of this page.
 * [[elmer]] - compile and run python code from Tcl, as if it was written in Tcl
 * [[https://github.com/amykyta3/tclpython|TclPython]] - A package for Tcl that allows you to pass strings of Python code from a Tcl environment to a Python (Python 2.x or 3.x) interpreter.
 * [[http://wiki.tcl.tk/1324|Tcl and other languages]] - Tcl's equivalent of this page.
Line 68: Line 107:
 * [http://moin.conectiva.com.br/LunaticPython LunaticPython] - a two-way bridge between Python and Lua.
 * [http://www.equi4.com/lux/ Lux] - a mutant Lua emphasizing interoperation with Python, Perl, etc.
 * [[http://labix.org/lunatic-python|LunaticPython]] - a two-way bridge between Python and Lua.
 * [[http://pypi.python.org/pypi/lupa|Lupa]] - fast wrapper for LuaJIT2 written in Cython.
 * [[http://www.equi4.com/lux/|Lux]] - a mutant Lua emphasizing interoperation with Python, Perl, etc.

= OCaml =
 * [[http://pycaml.sourceforge.net/|Pycaml]] - write Python extension modules in OCaml (instead of C), and use Python code and native libraries from OCaml programs.

= Eiffel and Haskell =
 * Eiffel/Haskell http://epolyglot.sourceforge.net/ (last updated 2001)
 * PythonVsHaskell has a section "Using both Python & Haskell with ctypes".
Line 72: Line 119:
 * LotusNotes [http://www.dominopower.com/issuesprint/issue200008/command.html]
 * Eiffel/Haskell
[http://epolyglot.sourceforge.net/]
 * ["
PostgreSQL"] [http://www.linuxgazette.com/issue80/nielsen.html]
 * RenderMan [http://www.lysator.liu.se/~ture/terry.html]
 * LotusNotes http://www.dominopower.com/issuesprint/issue200008/command.html
 *
[[PostgreSQL]] http://www.linuxgazette.com/issue80/nielsen.html
 * RenderMan http://www.lysator.liu.se/~ture/terry.html
Line 77: Line 123:
to name a few. There are much [http://www.google.com/search?q=Python+binding&hl=en more...]
to name a few. There are much [[http://www.google.com/search?q=Python+binding&hl=en|more...]]
Line 81: Line 128:
 * Yaml: http://www.yaml.org  * Yaml: [[http://www.yaml.org/|http://www.yaml.org]]

= See also =
Thinki: [[http://web.archive.org/web/20071108024137/http://www.thinkware.se/cgi-bin/thinki.cgi/UsingPythonWithOtherLanguages|UsingPythonWithOtherLanguages]]

[Hint: The idea is to create pages for the stuff, not just link it.]

C/C++

There a various tools which make it easier to bridge the gap between Python and C/C++:

  • Pyrex - write your extension module on Python (!)

  • Cython -- Cython -- an improved version of Pyrex

  • CXX - PyCXX - helper lib for writing Python extensions in C++

  • ctypes is a Python module allowing to create and manipulate C data types in Python. These can then be passed to C-functions loaded from dynamic link libraries.

  • elmer - compile and run python code from C, as if it was written in C

  • PicklingTools is a collection of libraries for exchanging Python Dictionaries between C++ and Python.

  • weave - include C code lines in Python program (deprecated in favor of Cython)

  • ackward exposes parts of Python's standard library as idiomatic C++

  • CFFI - interact with almost any C code from Python, based on C-like declarations that you can often copy-paste from header files or documentation.

C/C++ Binding Generators

Tools to make C/C++ functions/methods accessible from Python by generating binding (Python extension or module) from header files.

  • boost.python - Expose C++ classes functions and objects to Python, and vice-versa, using just C++ compiler

  • PyAutoC - Automatically wrap C functions and structs, using just C compiler.

  • pwig is a SWIG extension for writing new language modules in Python.

  • PyBindGen Python bindings code generator for pure C or C++ APIs. The generator is written in Python and has low complexity. The generated code is lean, efficient, and highly readable

  • shiboken - Binding Generator used to create PySide Python bindings for Qt

  • SIP - similar to SWIG but specialised for Python and C++. Used to create PyQt, the Qt API wrapper library

  • SWIG - generate extension module from your .h files

  • pybind11 - Similar to Boost.Python, but with a lean header-only implementation for C++11-capable compilers.

  • pyclif - Google tool. Similar to SWIG, but user-friendly and targeted only C++11 well-written libs.

  • cppyy - Interact with C/C++ through LLVMs JIT with automatic pythonizations for a "python feel." Support tools are available for large scale projects.


Articles

  • Using Python as glue SciPy Documentation

  • Building Hybrid Systems with Boost.Python in C/C++ User Journal (2003)

  • Integrating Python, C and C++, presented at the ACCU conference by Duncan Booth (2003)
  • Embedding Python in Multi-Threaded C/C++ Applications in LinuxJournal (2000)


Related

Delphi

Fortran

Lisp

Prolog

See also http://www.google.com/search?hl=en&lr=&ie=ISO-8859-1&q=Python+prolog

Java

  • Jython - Python implemented in Java

  • JPype - Allows Python to run java commands

  • Jepp - Java embedded Python

  • JCC - a C++ code generator for calling Java from C++/Python

  • Javabridge - a package for running and interacting with the JVM from CPython

  • py4j - Allows Python to run java commands.

  • voc - Part of BeeWare suite. Converts python code to Java bytecode.

  • p2j - Converts Python code to Java. No longer developed.

C#/.NET

  • ActiveState research

  • Python for .NET is a near-seamless integration of the CPython runtime with the .NET Common Language Runtime (CLR).

  • IronPython is an implementation of Python for .net, which allows you to import .net class libraries seamlessly in Python.

Perl

See http://www.faqts.com/knowledge_base/view.phtml/aid/17202/fid/1102

For converting/porting Perl code to Python the tool 'Bridgekeeper' http://www.crazy-compilers.com/bridgekeeper/ may be handy.

PHP

R

Objective-C

Tcl

  • elmer - compile and run python code from Tcl, as if it was written in Tcl

  • TclPython - A package for Tcl that allows you to pass strings of Python code from a Tcl environment to a Python (Python 2.x or 3.x) interpreter.

  • Tcl and other languages - Tcl's equivalent of this page.

Lua

  • LunaticPython - a two-way bridge between Python and Lua.

  • Lupa - fast wrapper for LuaJIT2 written in Cython.

  • Lux - a mutant Lua emphasizing interoperation with Python, Perl, etc.

OCaml

  • Pycaml - write Python extension modules in OCaml (instead of C), and use Python code and native libraries from OCaml programs.

Eiffel and Haskell

Other (applications)

to name a few. There are much more...

Other (standards and protocols)

See also

Thinki: UsingPythonWithOtherLanguages

IntegratingPythonWithOtherLanguages (last edited 2020-07-29 18:06:27 by JaraKaca)

Unable to edit the page? See the FrontPage for instructions.