PitchHut logo
Kotlin-Package-Manager
Easily scaffold and manage Kotlin/Android projects and dependencies.
Pitch

Kotlin Package Manager (KPM) provides a streamlined solution for managing Kotlin projects. With zero third-party dependencies and features like Android SDK integration, npm-like simplicity, and automatic Gradle sync, KPM simplifies project setup, dependency management, and customization. Effortlessly create and manage projects tailored for JVM and Android.

Description

Kotlin Package Manager (KPM) is an innovative tool designed to simplify the management of Kotlin and Android projects without the need for third-party dependencies. It provides a seamless experience akin to npm, making it an essential companion for Android and JVM development.

Key Features

  • Zero Dependencies: Operate efficiently without external libraries.
  • Android First: Offers full integration with the Android SDK and support for Jetpack Compose.
  • NPM-Like Experience: Effortlessly add libraries using simple commands, e.g., kpm add picasso to automatically resolve the latest versions.
  • Custom TOML Parser: Allows parsing of project manifests without external dependencies.
  • Gradle Integration: Automatically generates and syncs your build.gradle.kts files.
  • Project Templates: Quickly initialize projects with sensible defaults tailored to your needs.
  • Maven Central Integration: Seamlessly search and add dependencies from Maven Central.
  • Global Configuration: Configure global settings similar to npm, bun, or pip, allowing for consistent project management across the board.
  • IDE Auto-Sync: Automatically triggers IDE sync after any dependency changes.

Getting Started

KPM enables developers to jump right into project creation and dependency management:

Create New Projects

Easily set up a new project with the following commands:

# Create an Android app with Compose UI
kpm new MyApp --android --compose

# Set up a Ktor API server
kpm new MyAPI --ktor

# Initialize a simple JVM application
kpm new MyApp

# Create an Android library
kpm new MyLib --android --library

Manage Dependencies

Add and manage dependencies with ease:

# Adding dependencies automatically resolves the latest version
kpm add picasso          # → com.squareup.picasso:picasso:2.8
kpm add retrofit         # → com.squareup.retrofit2:retrofit:2.9.0

# Add test libraries
kpm add junit --test
kpm add mockito --test

# Search for libraries based on keywords
kpm search image
kpm search networking

Build and Run Projects

Compiling and executing applications is straightforward:

cd MyApp
kpm build               # Builds your project automatically
kpm run                 # Launches your application
kpm test                # Executes tests

Configure Global Settings

Global configuration can significantly streamline the project setup:

# Initialize global settings
kpm config init

# Set default user preferences
kpm config set default_author "Jane Developer"

# Add global dependencies for all projects
kpm config add-global timber

Project Structure

Each project set up with KPM will have a standardized structure that includes configuration files, dependency management files, and source directories for both main and test code. This structure simplifies project navigation and collaboration.

Example Project Structure

my-app/
├── kpm.toml            # Project manifest
├── kpm.lock            # Dependency lockfile
├── build.gradle.kts    # Gradle build file
├── settings.gradle.kts  # Gradle settings file
└── src/
    ├── main/kotlin/
    │   └── Main.kt     # Entry point for the application
    └── test/kotlin/

Conclusion

KPM is an effective solution for managing Kotlin projects, providing powerful features that simplify dependency management and project configuration. The combination of simplicity, flexibility, and support for modern frameworks makes it an invaluable tool for developers looking to enhance productivity in Kotlin-based development environments.

0 comments

No comments yet.

Sign in to be the first to comment.