π¦ PACKAGE MANAGER HIERARCHY β Dari npm sampai Bun, pip sampai uv
Package manager bukan hanya βtool untuk install library.β Di baliknya ada: dependency resolution algorithm, lockfile format, content-addressable storage, virtual environment isolation, dan security supply chain. Memahami ini = memahami kenapa Bun 25x lebih cepat dari npm dan uv 100x lebih cepat dari pip.
Konteks
Ini langsung relevan untuk proyek Laravel (PHP/Composer), Next.js (Node/npm atau Bun), dan Python scripting yang sudah ada di vault. Pilihan package manager mempengaruhi CI/CD speed, disk usage, dan reproducibility.
Daftar Isi
- Mengapa Package Manager Adalah Masalah Sulit
- Node.js Ecosystem β Evolusi dari npm sampai Bun
- Python Ecosystem β Evolusi dari pip sampai uv
- Bun β Deep Dive
- uv β Deep Dive
- Ekosistem Lain β Cargo, Go Modules, Composer
- Decision Matrix
Mengapa Package Manager Adalah Masalah Sulit
Dependency Resolution β NP-Hard Problem
Bayangkan kamu install:
Package A v1.0 β butuh Package C >= 2.0
Package B v1.0 β butuh Package C >= 2.5 dan < 3.0
Package D v1.0 β butuh Package C ~= 2.8 (compatible release)
Package manager harus find:
β Versi C yang satisfy SEMUA constraint sekaligus
β Jika tidak ada: error, atau compromise
Ini secara matematis adalah Boolean Satisfiability Problem (SAT)
β NP-complete untuk kasus umum
β Itulah kenapa dependency resolution bisa lambat dan tidak deterministik
Algoritma yang berbeda dipakai:
npm v1-2: greedy, bisa duplikat package (node_modules hell)
npm v3+: flat tree, deduplicate
yarn: SAT solver, reproducible via lockfile
pnpm: content-addressable store + symlink, paling efisien
uv: PubGrub algorithm (Rust), fastest currently known
Dependency Hell β Masalah Nyata
NODE_MODULES HELL (sebelum pnpm):
project/
βββ node_modules/
βββ package-a/
β βββ node_modules/
β βββ lodash@4.0.0 β copy 1
βββ package-b/
β βββ node_modules/
β βββ lodash@4.0.0 β copy 2 (identik!)
βββ package-c/
βββ node_modules/
βββ lodash@4.0.0 β copy 3 (identik!)
Hasil: node_modules bisa 500MB untuk project sederhana
"heaviest object in the universe" = node_modules folder
DIAMOND DEPENDENCY (klasik):
Your App
/ \
Pkg A Pkg B
\ /
lodash@4 lodash@3
β
CONFLICT!
Node.js Ecosystem β Evolusi dari npm sampai Bun
Timeline & Apa yang Diperbaiki Setiap Iterasi
2010: npm (Node Package Manager)
βββ Original, bundled dengan Node.js
βββ Sequential install (satu per satu)
βββ Non-deterministic: install dua kali = hasil berbeda
βββ Masalah: lambat, tidak reproducible
2016: yarn (Facebook)
βββ Parallel install: 2-3x lebih cepat dari npm
βββ Lockfile (yarn.lock): reproducible install
βββ Offline cache: tidak download ulang jika sudah ada
βββ Masalah: masih node_modules, duplikasi masih ada
2017: npm v5 (respon ke yarn)
βββ package-lock.json: lockfile seperti yarn
βββ Lebih cepat tapi masih kalah dari yarn
βββ Masalah: node_modules masih besar
2017: pnpm
βββ Content-addressable store: satu file = satu copy di disk
βββ Symlink ke global store (bukan copy)
βββ 2-3x lebih cepat dari npm, lebih hemat disk
βββ node_modules masih ada tapi jauh lebih kecil
2020: yarn berry (v2+) dengan PnP
βββ Zero-installs: tidak perlu install sama sekali
βββ Plug'n'Play: tidak ada node_modules!
βββ Import dari .yarn/cache zip files langsung
βββ Masalah: compatibility issue dengan beberapa package
2022: Bun
βββ Runtime baru (bukan Node.js), package manager, bundler, test runner
βββ Install 25x lebih cepat dari npm
βββ Bukan hanya package manager β ini RUNTIME baru
npm β Fondasi yang Harus Dipahami
# npm fundamental yang sering salah kaprah
# INSTALL
npm install # Install dari package.json
npm install pkg # Install + tambah ke dependencies
npm install -D pkg # devDependencies (tidak di-bundle ke production)
npm install -g pkg # Global install (hindari jika bisa)
npm ci # β WAJIB di CI/CD! Install PERSIS dari lockfile
# npm ci vs npm install β PENTING:
# npm install: bisa update patch version, bisa ubah lockfile
# npm ci: HANYA dari lockfile, gagal jika lockfile tidak sinkron
# Lebih cepat, lebih reproducible, hapus node_modules dulu
# WORKSPACE (monorepo)
# package.json root:
{
"workspaces": ["packages/*", "apps/*"]
}
npm install -w packages/ui # Install di workspace spesifik
npm run build --workspaces # Run di semua workspace
# SECURITY
npm audit # Cek vulnerability di dependencies
npm audit fix # Auto-fix yang bisa di-fix
npm audit fix --force # Force major update (hati-hati breaking change)
npm outdated # Lihat package yang bisa di-update
# SCRIPTS
{
"scripts": {
"start": "node index.js",
"dev": "nodemon index.js",
"build": "tsc",
"test": "jest",
"prepare": "husky install", # β auto-run setelah npm install
"prepublishOnly": "npm test" # β auto-run sebelum npm publish
}
}pnpm β Yang Seharusnya Kamu Pakai
# CARA KERJA pnpm:
# ~/.pnpm-store/ (global content-addressable store)
# βββ v3/
# βββ files/
# βββ 00/abc123... β setiap file disimpan sekali
# βββ 01/def456...
# βββ ...
#
# project/node_modules/ (symlink ke store)
# βββ .pnpm/
# βββ lodash@4.17.21/
# βββ node_modules/
# βββ lodash β ~/.pnpm-store/.../lodash β SYMLINK, bukan copy
# Install pnpm
npm install -g pnpm
# atau: corepack enable && corepack prepare pnpm@latest --activate
# SETUP PROJECT
pnpm init
pnpm add express # dependencies
pnpm add -D typescript # devDependencies
pnpm add -g pm2 # global
# WORKSPACE (monorepo) β pnpm-workspace.yaml
packages:
- 'packages/*'
- 'apps/*'
pnpm install # Install semua workspace
pnpm -r run build # Run build di semua package
pnpm --filter @myapp/ui build # Run di package spesifik
# IMPORT DARI WORKSPACE
# package.json:
{
"dependencies": {
"@myapp/utils": "workspace:*" # β Link ke local package
}
}
# BENCHMARK vs npm:
# Install 500 packages:
# npm: 120s
# yarn: 70s
# pnpm: 25s (4.8x lebih cepat dari npm)
# bun: 8s (15x lebih cepat dari npm)Python Ecosystem β Evolusi dari pip sampai uv
Fragmentasi yang Membingungkan
MASALAH UNIK PYTHON: terlalu banyak tools, masing-masing solve subset masalah
MASALAH 1: Python version management
Tiap project butuh Python versi berbeda
β Tools: pyenv, conda, asdf, mise, rtx
MASALAH 2: Virtual environment
Isolasi dependencies per project
β Tools: venv (builtin), virtualenv, conda
MASALAH 3: Dependency management
Install, lock, resolve dependencies
β Tools: pip, pip-tools, poetry, pipenv, pdm
MASALAH 4: Build & publish
Package project untuk PyPI
β Tools: setuptools, build, flit, poetry, hatch
MASALAH 5: Script execution
Run script dengan dependencies inline
β Tools: pipx, uvx
Sebelum uv: kamu butuh pyenv + venv + pip + pip-tools
= 4 tools berbeda untuk masalah yang related
Setelah uv: uv handle SEMUA ini sekaligus
pip + venv β Yang Wajib Dipahami Dulu
# VIRTUAL ENVIRONMENT β mengapa wajib
python -m venv .venv # Buat virtual environment
source .venv/bin/activate # Linux/Mac
.\.venv\Scripts\activate # Windows
pip install requests # Install ke venv, bukan global
# TANPA venv: pip install ke global Python
# β conflict antar project
# β "works on my machine" problem
# β tidak bisa isolasi versi berbeda
# pip fundamental
pip install requests==2.31.0 # Pin versi spesifik
pip install "requests>=2.28,<3.0" # Version range
pip install -r requirements.txt # Install dari file
pip freeze > requirements.txt # Export yang terinstall
# MASALAH pip freeze:
# pip freeze output tidak membedakan:
# - Package yang kamu install langsung (direct dependency)
# - Package yang ter-install karena dependency lain (transitive)
# Solusi: pip-tools
# PIP-TOOLS β reproducible Python deps
pip install pip-tools
# requirements.in (hanya direct deps):
requests>=2.28
django>=4.2
# Generate lockfile:
pip-compile requirements.in # β requirements.txt (pinned, dengan semua transitive)
# Install dari lockfile:
pip-sync requirements.txtPoetry β Sebelum uv Ada
# pyproject.toml (format standar modern)
[tool.poetry]
name = "my-project"
version = "0.1.0"
description = ""
[tool.poetry.dependencies]
python = "^3.11"
requests = "^2.31"
django = "^4.2"
[tool.poetry.group.dev.dependencies]
pytest = "^7.0"
black = "^23.0"
ruff = "^0.1"poetry install # Install + buat venv otomatis
poetry add requests # Install + update pyproject.toml
poetry add -G dev pytest # Dev dependency
poetry run python app.py # Run dalam venv tanpa activate
poetry shell # Aktivasi venv
poetry build # Build package untuk publish
poetry publish # Publish ke PyPI
# KELEBIHAN poetry:
# β
All-in-one: dependency + venv + build + publish
# β
pyproject.toml: format standar
# β
Lockfile (poetry.lock): reproducible
# β
Dependency groups (dev, test, docs terpisah)
# KEKURANGAN poetry:
# β LAMBAT dibanding uv (Python-based, bukan Rust)
# β Tidak mengelola Python version (butuh pyenv terpisah)
# β Resolver kadang hang di project besar
# β Ekosistem terpisah dari pip (kadang confusing)Bun β Deep Dive
Bukan Hanya Package Manager
BUN = Runtime + Package Manager + Bundler + Test Runner + Transpiler
Semuanya dalam satu binary (< 50MB)
DITULIS DALAM: Zig (bukan Rust!)
ENGINE: JavaScriptCore (Apple, sama yang dipakai Safari)
bukan V8 (Chrome/Node.js)
MENGAPA Zig?
β Zig punya kontrol memory sangat granular
β Comptime (computation at compile time)
β Bun bisa optimize per-platform saat compile
β Lebih cepat dari Rust untuk beberapa workload I/O
MENGAPA JavaScriptCore?
β JSC startup time jauh lebih cepat dari V8
β JSC optimize berbeda dari V8 β bisa lebih cepat untuk some workloads
β Tapi: V8 lebih battle-tested untuk server workload
Kenapa Bun Install Lebih Cepat
BENCHMARK (install Next.js project dari scratch):
npm: 87 detik
yarn: 67 detik
pnpm: 23 detik
bun: 6 detik β ~14x lebih cepat dari npm
TIGA ALASAN TEKNIS:
1. SYMLINK STORAGE (mirip pnpm):
~/.bun/install/cache/
β Satu file, satu copy di disk
β Symlink ke project, bukan copy
2. PARALEL ASYNC I/O:
npm: download satu per satu (atau beberapa)
bun: download SEMUA package sekaligus
extract SEMUA sekaligus
resolve SEMUA sekaligus
pakai Zig's async I/O primitives
3. BINARY LOCKFILE (bun.lockb):
npm: package-lock.json (JSON, perlu parse text)
bun: bun.lockb (binary format)
β Baca lockfile = baca binary, jauh lebih cepat
β Tapi: tidak human-readable (butuh bun convert)
bun bun.lockb # Lihat isi lockfile dalam format readable
4. NATIVE IMPLEMENTATION:
npm: Node.js (JavaScript process manage JavaScript install)
bun: Zig + NAPI (native code manage install)
β Bun tidak punya overhead memulai JS engine untuk install
Bun sebagai Runtime
// bun run app.ts β langsung tanpa compile!
// TypeScript native, tidak perlu ts-node atau tsc
// Bun-specific APIs (tidak ada di Node.js):
const file = Bun.file("./data.json")
const json = await file.json() // β built-in JSON file reader
// Bun.serve β HTTP server built-in
const server = Bun.serve({
port: 3000,
fetch(request: Request): Response {
const url = new URL(request.url)
if (url.pathname === "/") {
return new Response("Hello World")
}
return new Response("Not Found", { status: 404 })
},
})
// Bun Shell β run shell commands dari TypeScript
import { $ } from "bun"
const output = await $`ls -la`
console.log(output.text())
// Built-in SQLite
import { Database } from "bun:sqlite"
const db = new Database("mydb.sqlite")
const query = db.query("SELECT * FROM users WHERE id = $id")
const user = query.get({ $id: 1 })Bun: Compatibility dan Gotchas
COMPATIBILITY STATUS (2026):
β
npm packages: 99%+ kompatibel
β
package.json scripts
β
Node.js core APIs (fs, path, http, crypto, dll)
β
CommonJS dan ESM
β
TypeScript, JSX native
β
.env file loading otomatis
GOTCHAS:
β οΈ Beberapa native addon (N-API) mungkin tidak kompatibel
β οΈ JavaScriptCore vs V8: behavior edge case bisa berbeda
β Kode yang bergantung pada V8-specific GC behavior: beware
β οΈ bun.lockb tidak human-readable
β Sulit review di PR
β Bun menyediakan: bun bun.lockb untuk print readable version
β οΈ Bun masih < 2 tahun mature β beberapa edge case belum tercover
KAPAN PAKAI BUN:
β
New project yang tidak butuh Node.js strict compatibility
β
Script dan tooling (build scripts, utilities)
β
API server di mana startup time penting (serverless)
β
CI/CD pipeline yang install npm packages (speed win)
β
Full-stack TypeScript dengan Bun runtime
KAPAN TIDAK PAKAI BUN:
β Legacy project dengan native addons spesifik
β Production yang butuh battle-tested stability
β Team yang belum familiar (learning curve)
uv β Deep Dive
Dari Astral (Pembuat Ruff)
UV = Universal Python package + project manager
DITULIS DALAM: Rust (sama seperti Ruff linter)
PEMBUAT: Astral (Charlie Marsh dan tim)
Astral philosophy:
"Developer tooling yang bergerak dengan kecepatan bahasa sistem"
β Ruff: linter 10-100x lebih cepat dari flake8/pylint
β uv: package manager 10-100x lebih cepat dari pip
BENCHMARK (install PyTorch + deps dari scratch):
pip: 120 detik
poetry: 90 detik
uv: 8 detik β ~15x lebih cepat dari pip
BENCHMARK (resolusi cold cache):
pip: 45 detik
uv: 0.8 detik
APA YANG DI-REPLACE uv:
pip β uv pip install / uv add
pip-tools β uv pip compile
pyenv β uv python install / uv python pin
virtualenv β uv venv
pipx β uvx (run tools tanpa install)
poetry β uv add, uv run, uv build (sebagian)
uv: Semua Perintah yang Perlu Diketahui
# βββ INSTALL UV βββββββββββββββββββββββββββββββββββββββββββββββ
curl -LsSf https://astral.sh/uv/install.sh | sh
# atau: pip install uv
# βββ PYTHON VERSION MANAGEMENT ββββββββββββββββββββββββββββββββ
uv python install 3.12 # Download dan install Python 3.12
uv python install 3.11 3.12 # Install multiple
uv python list # Lihat Python yang tersedia
uv python pin 3.12 # Pin versi untuk project ini (.python-version)
uv run python --version # Run dengan Python yang di-pin
# βββ PROJECT MANAGEMENT βββββββββββββββββββββββββββββββββββββββ
uv init my-project # Buat project baru
cd my-project
uv add requests # Install + tambah ke pyproject.toml
uv add --dev pytest ruff # Dev dependency
uv remove requests # Hapus dependency
uv sync # Sync environment dengan pyproject.toml + lockfile
uv lock # Update lockfile tanpa install
uv run python app.py # Run dalam project environment
uv run pytest # Run tool dalam environment
# βββ VIRTUAL ENVIRONMENT ββββββββββββββββββββββββββββββββββββββ
uv venv # Buat .venv di current directory
uv venv --python 3.11 # Dengan Python version spesifik
source .venv/bin/activate # Activate (masih perlu untuk beberapa workflow)
# βββ PIP COMPATIBILITY ββββββββββββββββββββββββββββββββββββββββ
# uv punya pip-compatible interface
uv pip install requests
uv pip install -r requirements.txt
uv pip freeze
uv pip compile requirements.in -o requirements.txt # pip-tools compatible
# βββ GLOBAL TOOLS (pengganti pipx) ββββββββββββββββββββββββββββ
uvx ruff check . # Run ruff tanpa install permanent
uvx black . # Run black tanpa install
uv tool install ruff # Install sebagai global tool
uv tool list # Lihat installed tools
# βββ INLINE SCRIPT DEPENDENCIES (PEP 723) βββββββββββββββββββββ
# Cara baru: dependencies di dalam script!
# script.py:
# /// script
# requires-python = ">=3.11"
# dependencies = [
# "requests",
# "rich",
# ]
# ///
# import requests
# from rich import print
# ...
uv run script.py # uv install deps, run, cleanup β semuanya otomatisKenapa uv Cepat β Mekanisme
ALASAN 1: PubGrub Resolution Algorithm (Rust implementation)
β Algorithm dependency resolution terbaru (dikembangkan Dart/pub team)
β Lebih efisien dari SAT solver yang dipakai poetry
β Rust = zero-cost abstraction + no GC pause
ALASAN 2: Content-Addressable Cache
~/.cache/uv/
βββ wheels/ β compiled wheel cache per versi
β βββ sha256:abc123/
β βββ requests-2.31.0-py3-none-any.whl
βββ archives/ β source distribution cache
βββ sha256:def456/
β Package yang pernah didownload TIDAK pernah didownload lagi
β Hash-based: kalau hash sama, file pasti sama
β Multi-project share cache: install di project berbeda = instant
ALASAN 3: Parallel Everything
β Resolve dependencies: parallel
β Download wheels: parallel
β Install: parallel
β Rust async (tokio) untuk I/O concurrent
ALASAN 4: Pre-built Wheels
β PyPI menyediakan pre-built binary wheel untuk most packages
β uv prioritaskan wheel over source distribution
β Tidak perlu compile C extension jika wheel tersedia
ALASAN 5: Lazy Dependency Graph
β Tidak download SEMUA package info dulu
β Lazy evaluation: hanya fetch apa yang dibutuhkan untuk resolve
uv: Compatibility
KOMPATIBEL DENGAN:
β
pip (drop-in replacement untuk most commands)
β
pyproject.toml (PEP 517/518/621)
β
requirements.txt
β
setup.py / setup.cfg (legacy)
β
conda environments (sebagian)
β
Virtual environments standard
TIDAK FULLY REPLACE:
β οΈ conda: uv tidak handle non-Python deps (CUDA, C libraries)
β Data science dengan GPU: conda masih diperlukan
β οΈ poetry publishing: uv build ada tapi publish masih beta
β οΈ conda environment: uv tidak baca environment.yml
KETERBATASAN:
β Non-PyPI package source (custom registry: bisa tapi setup extra)
β Conda packages (hanya pip-compatible packages)
Ekosistem Lain β Pembanding
Rust: Cargo β Standar Emas
# Cargo = BUILT-IN ke Rust, bukan afterthought
# Ini yang membuat banyak developer Rust happy
cargo new my-project # Init project
cargo build # Compile
cargo run # Build + run
cargo test # Test
cargo bench # Benchmark
cargo doc # Generate documentation
cargo publish # Publish ke crates.io
# Cargo.toml β single source of truth:
[package]
name = "my-project"
version = "0.1.0"
edition = "2021"
[dependencies]
tokio = { version = "1", features = ["full"] }
serde = { version = "1", features = ["derive"] }
[dev-dependencies]
criterion = "0.5" # Hanya untuk test/benchmark
# KENAPA CARGO DIANGGAP TERBAIK:
# β
Satu tool untuk semua (build, test, doc, publish)
# β
Reproducible via Cargo.lock
# β
Workspace untuk monorepo built-in
# β
Features system (conditional compilation)
# β
Tidak ada dependency hell (setiap crate bisa punya versi berbeda)
# β
Integrated dengan rustup (toolchain management)
# KETERBATASAN:
# Compile time Rust sangat lama (bukan masalah cargo, tapi bahasa)
# Incremental compile membantu tapi masih lama untuk project besarGo: Go Modules β Simpel tapi Opinionated
go mod init github.com/username/project
go get github.com/gin-gonic/gin@v1.9.0
go mod tidy # hapus unused, download yang kurang
go mod download # download semua deps tanpa install
go mod vendor # vendoring: copy semua deps ke ./vendor
# go.mod β deklaratif:
module github.com/username/project
go 1.21
require (
github.com/gin-gonic/gin v1.9.0
github.com/stretchr/testify v1.8.4
)
# go.sum β lockfile (hash verification):
github.com/gin-gonic/gin v1.9.0 h1:ZAV...
github.com/gin-gonic/gin v1.9.0/go.mod h1:...
# KELEBIHAN:
# β
Built-in (tidak perlu install terpisah)
# β
Verifikasi hash (supply chain security)
# β
GOPATH dan module proxy (sum.golang.org)
# KEKURANGAN:
# β Tidak ada version manager built-in (perlu asdf atau mise)
# β Semantic versioning enforcement longgar
# β Major version harus ganti import path (v2 = github.com/pkg/v2)PHP: Composer β Mature tapi Lambat
composer init # Init project
composer require laravel/framework # Install
composer require --dev phpunit/phpunit
composer install # Install dari composer.lock
composer update # Update semua
composer dump-autoload # Regenerate autoloader
# composer.json:
{
"require": {
"php": ">=8.1",
"laravel/framework": "^10.0"
},
"require-dev": {
"phpunit/phpunit": "^10.0"
},
"autoload": {
"psr-4": {
"App\\": "app/"
}
}
}
# MASALAH COMPOSER:
# PHP-based = lambat (no Rust, no Zig)
# composer install di fresh: 30-60 detik untuk Laravel
# Solusi: composer install --prefer-dist --no-interaction (CI/CD flag)Decision Matrix
Pilih Package Manager per Ekosistem
NODE.JS 2026:
New project:
βββ Prefer Bun if:
β β TypeScript-first
β β Tidak butuh strict Node.js compat
β β Speed is priority (CI/CD)
β β Personal project / startup
β
βββ Prefer pnpm if:
β β Monorepo
β β Team yang sudah familiar
β β Butuh strict Node.js compat
β β Enterprise dengan banyak package
β
βββ Prefer npm if:
β Simplicity utama
β Semua developer familiar
β Legacy project maintenance
PYTHON 2026:
New project:
βββ uv (hampir semua kasus kecuali data science)
Data science / ML:
βββ conda (atau mamba) untuk handle CUDA + sistem library
Legacy project:
βββ Migrate ke uv jika mungkin
βββ Tetap poetry/pip-tools jika ada custom workflow
Script one-off:
βββ uvx atau uv run --with (PEP 723)
Perbandingan Kecepatan β Semua Ekosistem
INSTALL SPEED BENCHMARK (fresh install, 100+ packages):
Node.js:
npm: 100% (baseline)
yarn: 65%
pnpm: 25%
bun: 7% β 14x lebih cepat dari npm
Python:
pip: 100% (baseline)
poetry: 85%
pdm: 70%
uv: 5% β 20x lebih cepat dari pip
Rust:
cargo: β (compiled language, different category)
Compile time: sangat lama
Dependency download: mirip pnpm (content-addressable)
Go:
go get: cukup cepat (binary download, tidak compile deps)
Pro/Con Summary Table
| Manager | Speed | Reliability | DX | Compatibility | Maturity |
|---|---|---|---|---|---|
| npm | π΄ Lambat | β Stabil | β Familiar | β Universal | β 15 tahun |
| pnpm | π‘ Cepat | β Stabil | β Baik | β Baik | β 7 tahun |
| yarn berry | π‘ Cepat | β οΈ Kadang issues | β οΈ Beda mindset | β οΈ Perlu check | π‘ 6 tahun |
| Bun | π’ Sangat cepat | β οΈ Masih muda | β All-in-one | β 99%+ | β οΈ 2 tahun |
| pip | π΄ Lambat | β Stabil | π΄ Manual setup | β Universal | β 15+ tahun |
| poetry | π‘ OK | β Stabil | β Baik | β Baik | β 6 tahun |
| uv | π’ Sangat cepat | β Stabil | β All-in-one | β pip-compat | π‘ 1.5 tahun |
| cargo | π’ Cepat | β Excellent | β Best-in-class | β Native | β 11 tahun |
| go mod | π’ Cepat | β Stabil | β Simple | β Native | β 6 tahun |
Setup CI/CD yang Optimal
# .github/workflows/ci.yml β dengan package manager caching
# NODE.JS dengan pnpm (recommended untuk production)
- name: Setup pnpm
uses: pnpm/action-setup@v3
with:
version: 9
- name: Cache pnpm store
uses: actions/cache@v4
with:
path: ~/.local/share/pnpm/store
key: pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: pnpm-
- name: Install dependencies
run: pnpm install --frozen-lockfile # Equivalent npm ci
# NODE.JS dengan Bun (fastest CI)
- name: Setup Bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: Cache Bun cache
uses: actions/cache@v4
with:
path: ~/.bun/install/cache
key: bun-${{ hashFiles('**/bun.lockb') }}
- name: Install
run: bun install --frozen-lockfile
# PYTHON dengan uv (recommended)
- name: Install uv
uses: astral-sh/setup-uv@v3
with:
enable-cache: true # Otomatis cache ~/.cache/uv
- name: Install Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --frozen # Equivalent pip-sync dari lockfile
- name: Run tests
run: uv run pytestRekomendasi Konkret 2026
Node.js: Mulai project baru β Bun. Existing project β pnpm untuk migration yang aman.
Python: Apapun project barunya β uv. Tidak ada alasan untuk tidak migrasi kecuali conda/GPU dependency.
Untuk portfolio kamu: ganti
npm installdi CI dengan Bun atau pnpm β CI time bisa turun 5-10 menit untuk project Next.js.
Jangan Over-Engineer
Memilih package manager bukan architectural decision terbesar. Yang lebih penting: lockfile selalu di-commit ke git (reproducibility) dan CI pakai
--frozen-lockfile/--locked(jangan biarkan CI update deps sendiri). Dua hal ini lebih penting dari pilihan antara npm, pnpm, atau Bun.
π Lihat Juga
- CD Deep Dive β caching package manager di pipeline
- Bahasa Pemrograman β konteks Zig (Bun) dan Rust (uv)
- API Protocols β runtime yang di-serve oleh Bun
- Platform Technologies β WebAssembly target dari Bun
- Master Index
Package Manager Hierarchy | npm β pnpm β Bun Β· pip β poetry β uv Β· Cargo Β· Go Modules Β· PubGrub Β· Content-Addressable Storage Β· CI Caching