Dataiku's external libraries feature allows you to extend the capabilities of Dataiku Data Science, making it a powerful tool for custom functionality. One of the ways to create and share these external libraries is through JSON configuration files, which is the focus of this guide.

Let's explore how you can work with Dataiku external libraries using JSON, with a particular focus on those built using Python and R, the two primary languages supported by Dataiku.

Understanding Dataiku's External Libraries JSON Configuration
Dataiku's external libraries are designed to be modular, making JSON an ideal configuration format for managing dependencies, run-time paths, and other library-specific settings.

Each external library is defined within a JSON file, with a specific structure that outlines library metadata and required dependencies. The JSON file's name is typically the same as the library's name, followed by 'json.json'.
JSON File Hierarchy

Every JSON file for an external library follows a specific hierarchy, starting with the 'library' root element. This root houses four primary sub-elements: 'name', 'version', 'dependencies', and 'script_params'.
Each of these sub-elements plays a vital role in defining the library and its behavior within Dataiku:
- name: The unique name of the library.
- version: The library's version number.
- dependencies: An array of required libraries and their versions.
- script_params: A list of key-value pairs representing parameters needed for the library's scripts.

Working with Python and R Libraries
Dataiku's external libraries support both Python and R, offering developers a choice of programming language depending on their preference and the use case at hand.
Irrespective of the chosen language, the JSON configuration file follows the same structure. The differences lie in the specifics of the 'script_params' and the actual scripts (Python or R) that make up the external library.

Practical Examples: Creating and Using External Libraries with JSON
To illustrate the power and flexibility of Dataiku's external libraries and their JSON configuration, let's consider a practical example of creating a simple Python and an R library.



















We'll walk through defining and using these libraries through JSON config files, and demonstrate how to access and manage them within Dataiku.
Creating a Simple Python Library
Let's create a simple Python external library that defines a function to greet a given name. The JSON configuration file (greet.json.json) would look like this:
{
"library": {
"name": "greet",
"version": "1.0.0",
"dependencies" : [],
"script_params": {
"greet_message": {
"type": "text",
"default": "Hello"
}
}
}
}
Creating a Simple R Library
Now, let's create a similar library in R, using the same 'greet' function. The JSON configuration file (greet.json.json) will differ slightly, as R handles parameters differently:
{
"library": {
"name": "greet",
"version": "1.0.0",
"dependencies" : [],
"script_params": {
"greet_message": {
"type": " 둣ext 또는 text"
}
}
}
}
With these JSON configuration files, we've created two external libraries - one in Python and one in R - that offer a simple greeting functionality. The final step is to upload these libraries to your Dataiku DSS environment and start using them in your data science projects.
In doing so, you unlock a world of possibilities for extending Dataiku's capabilities, sharing best practices across your team, and enables repeatable data science workflows.
Remember, this is just the starting point. Dataiku's external libraries can be as complex or as simple as your use case requires, limited only by your imagination and the boundaries of what's possible with Python and R.