API wrapping creates a new interface for older applications, making them readily accessible by other applications and software components. Additionally, minimal code changes are required, which means less risk when compared to re-architecting or rebuilding an application from scratch. Scripting languages in general are a good choice for API wrapping (Tcl comes to mind). But, if the goal is to add ML capabilities, Python is the best choice, and with its growing popularity and ability to find skilled talent, some might say, the only choice.
- Python is at the forefront of advances in machine learning.
- Python has a well designed C API, which makes it ideally suited to extend or embed in applications written in C or C++.
- Python is simple to learn and use for your own developers, but can also be readily adopted by your customer base, as well.
Wrapping Applications With Python
If you’re ready to make the leap and extend your application with Python’s ML capabilities, you’ll need to consider at least the following three steps:
- If you want to incorporate extensible ML capabilities within your application, you’ll need to embed a Python runtime environment into your existing code base, where the runtime includes the base Python language plus any third-party (i.e., PyPI) packages required, as well as the Python interpreter.
- Alternatively, you may just want to open up an extension point in your application in order to allow it to be customised by your customers using their own ML routines. In this case, you can embed the Python interpreter inside your application with just a few lines of code.
- Wrap your existing C/C++ code with Python. You can find any number of tutorials online detailing the basics of how to accomplish this, such as Wrapping C/C++ for Python.
- Expose and document the new Python API so your customers can more easily extend your application’s functionality to accommodate their use case. At the very least, your customers will likely want to retrain any model you ship using their data.
Lastly, you’ll want to consider how Python gets deployed on premise. Some companies still require customers to download, install and maintain their own version of Python for use with their application. This can be problematic for a number of reasons, not least of which is support costs that invariably increase due to poor Python installations that result in system conflicts, dependency mismatches, and other issues.
Instead, consider purchasing a commercial OEM license for Python and embedding it within your application’s installer to ensure consistent deployment at customer sites.
- For more information on ActiveState’s OEM offering, refer to our OEM datasheet
- For a case study on how one customer has gained advantages in their marketplace by adding ML capabilities to their legacy application, read the Mentor Case Study