|
| 1 | +# Modules |
| 2 | + |
| 3 | +Kotlin DataFrame is split into specific modules that give you the flexibility |
| 4 | +to only use the modules you need. |
| 5 | +In this topic you'll learn what these modules are and how to add module dependencies |
| 6 | +to an existing Gradle/Maven project. |
| 7 | + |
| 8 | +## Configure the repository |
| 9 | + |
| 10 | +Kotlin DataFrame modules are available from the Maven Central repository. |
| 11 | +To use them, add the appropriate dependency into your repositories mapping: |
| 12 | + |
| 13 | +<tabs> |
| 14 | + <tab title="Kotlin DSL"> |
| 15 | + |
| 16 | +```kotlin |
| 17 | +repositories { |
| 18 | + mavenCentral() |
| 19 | +} |
| 20 | +``` |
| 21 | + |
| 22 | +</tab> |
| 23 | + <tab title="Groovy DSL"> |
| 24 | + |
| 25 | +```kotlin |
| 26 | +repositories { |
| 27 | + mavenCentral() |
| 28 | +} |
| 29 | +``` |
| 30 | + |
| 31 | +</tab> |
| 32 | +</tabs> |
| 33 | + |
| 34 | +## General Kotlin DataFrame dependency |
| 35 | + |
| 36 | +If you don't need custom module adjustments, you can easily add a general dependency with |
| 37 | +all [core Kotlin DataFrame modules](#core-kotlin-dataframe-modules) — `dataframe-core` and all officially |
| 38 | +supported IO format modules, excluding [experimental ones](#experimental-kotlindataframe-modules). |
| 39 | + |
| 40 | +<tabs> |
| 41 | +<tab title="Kotlin DSL"> |
| 42 | + |
| 43 | +```kotlin |
| 44 | +dependencies { |
| 45 | + implementation("org.jetbrains.kotlinx:dataframe:%dataFrameVersion%") |
| 46 | +} |
| 47 | +``` |
| 48 | + |
| 49 | +</tab> |
| 50 | + |
| 51 | +<tab title="Groovy DSL"> |
| 52 | + |
| 53 | +```groovy |
| 54 | +dependencies { |
| 55 | + implementation 'org.jetbrains.kotlinx:dataframe:%dataFrameVersion%' |
| 56 | +} |
| 57 | +``` |
| 58 | + |
| 59 | +</tab> |
| 60 | +</tabs> |
| 61 | + |
| 62 | +## Core Kotlin DataFrame modules |
| 63 | + |
| 64 | +Core Kotlin DataFrame modules are `dataframe-core`, which contains all logic |
| 65 | +related to working with DataFrame, |
| 66 | +and optional modules for supporting the most important IO types: |
| 67 | + |
| 68 | +| Module | Function | |
| 69 | +|-------------------|-------------------------------------------------------------------------------------------| |
| 70 | +| `dataframe-core` | The [DataFrame](DataFrame.md) API and its implementation. | |
| 71 | +| `dataframe-json` | Provides support for JSON format writing and reading. | |
| 72 | +| `dataframe-csv` | Provides support for CSV format writing and reading. | |
| 73 | +| `dataframe-excel` | Provides support for XSL/XLSX format writing and reading. | |
| 74 | +| `dataframe-jdbc` | Provides support for JDBC data sources writing and reading. | |
| 75 | +| `dataframe-arrow` | Provides support for [Apache Arrow](https://arrow.apache.org) format writing and reading. | |
| 76 | + |
| 77 | +Add the required Kotlin DataFrame modules to your project's dependencies: |
| 78 | + |
| 79 | +<tabs> |
| 80 | +<tab title="Kotlin DSL"> |
| 81 | + |
| 82 | +```kotlin |
| 83 | +dependencies { |
| 84 | + implementation("org.jetbrains.kotlinx:dataframe-core:%dataFrameVersion%") |
| 85 | + |
| 86 | + implementation("org.jetbrains.kotlinx:dataframe-json:%dataFrameVersion%") |
| 87 | + implementation("org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%") |
| 88 | + implementation("org.jetbrains.kotlinx:dataframe-excel:%dataFrameVersion%") |
| 89 | + implementation("org.jetbrains.kotlinx:dataframe-jdbc:%dataFrameVersion%") |
| 90 | + implementation("org.jetbrains.kotlinx:dataframe-arrow:%dataFrameVersion%") |
| 91 | +} |
| 92 | +``` |
| 93 | + |
| 94 | +</tab> |
| 95 | + |
| 96 | +<tab title="Groovy DSL"> |
| 97 | + |
| 98 | +```groovy |
| 99 | +dependencies { |
| 100 | + implementation 'org.jetbrains.kotlinx:dataframe-core:%dataFrameVersion%' |
| 101 | + |
| 102 | + implementation 'org.jetbrains.kotlinx:dataframe-json:%dataFrameVersion%' |
| 103 | + implementation 'org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%' |
| 104 | + implementation 'org.jetbrains.kotlinx:dataframe-excel:%dataFrameVersion%' |
| 105 | + implementation 'org.jetbrains.kotlinx:dataframe-jdbc:%dataFrameVersion%' |
| 106 | + implementation 'org.jetbrains.kotlinx:dataframe-arrow:%dataFrameVersion%' |
| 107 | +} |
| 108 | +``` |
| 109 | + |
| 110 | +</tab> |
| 111 | + |
| 112 | +</tabs> |
| 113 | + |
| 114 | +Note that `dataframe-json` is included with `dataframe-csv` and `dataframe-excel` by default. |
| 115 | +This is to support JSON structures inside CSV and Excel files. |
| 116 | +If you don't need this functionality, you can exclude it like so: |
| 117 | + |
| 118 | +<tabs> |
| 119 | +<tab title="Kotlin DSL"> |
| 120 | + |
| 121 | +```kotlin |
| 122 | +dependencies { |
| 123 | + implementation("org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%") { |
| 124 | + exclude("org.jetbrains.kotlinx", "dataframe-json") |
| 125 | + } |
| 126 | +} |
| 127 | +``` |
| 128 | + |
| 129 | +</tab> |
| 130 | + |
| 131 | +<tab title="Groovy DSL"> |
| 132 | + |
| 133 | +```groovy |
| 134 | +dependencies { |
| 135 | + implementation('org.jetbrains.kotlinx:dataframe-csv:%dataFrameVersion%') { |
| 136 | + exclude group: 'org.jetbrains.kotlinx', module: 'dataframe-json' |
| 137 | + } |
| 138 | +} |
| 139 | +``` |
| 140 | + |
| 141 | +</tab> |
| 142 | + |
| 143 | +</tabs> |
| 144 | + |
| 145 | + |
| 146 | +## Experimental KotlinDataFrame modules |
| 147 | + |
| 148 | +These modules are experimental and may be unstable. |
| 149 | + |
| 150 | +| Module | Function | |
| 151 | +|-------------------------------|-------------------------------------------------------------------------------------------------------| |
| 152 | +| `dataframe-geo` | Provides new API for working with geospatial data and IO for geographic formats (GeoJSON, Shapefile). | |
| 153 | +| `dataframe-openapi` | Provides support for [OpenAPI JSON format](https://www.openapis.org) reading and writing. | |
| 154 | +| `dataframe-openapi-generator` | Provides [schema generation](schemas.md) from OpenAPI specifications. Requires `dataframe-openapi`. | |
| 155 | + |
| 156 | + |
| 157 | +## Kotlin DataFrame plugin |
| 158 | + |
| 159 | +The Kotlin DataFrame compiler plugin enables support for [extension properties](extensionPropertiesApi.md) |
| 160 | +in Gradle projects, allowing you to work with dataframes in a name- and type-safe manner. |
| 161 | + |
| 162 | +See [Compiler Plugin setup](Compiler-Plugin.md#setup) for installation |
| 163 | +and usage in Gradle project instructions. |
0 commit comments