NgapakIn & Larapak MVC 🚀
NgapakIn adalah bahasa pemrograman open-source dengan ekstensi .ngpk, dirancang dengan sintaksis berbasis bahasa Ngapak / Banyumasan / Indonesia.
Larapak adalah MVC Web Framework lengkap yang berjalan di atas VM NgapakIn, dirancang meniru arsitektur elegan Laravel dengan fungsionalitas modern seperti ORM, Migrasi, Job Queues, Session/Cookies, Validasi, Caching, Event Dispatcher, Package Manager, hingga Language Server Protocol (LSP).
🌟 Fitur Utama Ekosistem (Phase 1 - Phase 5)
- Inti Bahasa NgapakIn (Phase 1 & 2):
- Sintaksis berbasis dialek Banyumasan (
gawe,rampung,nek - ya - liyane,balekna). - Tipe data lengkap: Angka, Teks, Boolean (
bener/salah), dan Null (kosong). - Stack-based Virtual Machine (VM) yang efisien dengan eksekusi bytecode cepat.
- Sintaksis berbasis dialek Banyumasan (
- Larapak MVC Framework (Phase 3):
- Web Server berbasis standard library HTTP.
- Routing dinamis (
routes/web.ngpk,routes/api.ngpk). - Blade-like Template Engine dengan layouting (
@layout,@sekat,@mlebui).
- Database & ORM System (Phase 4):
- Kelas berorientasi objek (
kelas ... extends Model). - Fluent SQL Query Builder berbasis SQLite.
- Skema Migrasi (
schema.gawe,schema.buang) dan CLI migration engine.
- Kelas berorientasi objek (
- Ecosystem & Advanced Features (Phase 5):
- Autentikasi: Fitur
authbawaan (mlebu,metu,user,cek). - Sesi & Cookies: Penyimpanan sesi berbasis database SQLite, helper cookies.
- Validasi: Validator input dengan aturan
required,email,numeric,min,max. - Cache: Penyimpanan data sementara berbasis SQLite dengan waktu kedaluwarsa (TTL).
- Event/Listener: Dispatcher event bawaan untuk pemrograman reaktif.
- Job Queues: Pemrosesan latar belakang (background queue workers) dengan
queue:work. - Package Manager: Pemasangan paket otomatis beserta auto-discovery Service Provider.
- REPL Terminal: Interactive terminal interaktif via
repl. - Step Debugger: Breakpoint debugger interaktif (
sstep,ccontinue,llocals,gglobals). - VSCode Support & LSP: Syntax highlighting TextMate & diagnostik LSP syntax errors.
- Autentikasi: Fitur
📁 Struktur Folder Proyek
ngapakin/
├── .github/workflows/ # CI/CD Pipeline
├── app/
│ ├── Controllers/ # Controller Kelas Larapak
│ ├── Jobs/ # Background Jobs
│ ├── Middleware/ # Request Middlewares
│ └── Models/ # Model Database (Autoloaded)
├── database/
│ ├── migrations/ # Berkas Migrasi Database
│ └── seeders/ # Berkas Database Seeder
├── editors/vscode/ # Ekstensi VSCode & LSP Server
├── framework/ # Modul Internal Larapak Core
├── ngapak/ # Compiler, Lexer, Parser & VM NgapakLang
├── packages/ # Lokasi Paket yang Diinstal
├── routes/ # Rute web & API (.ngpk)
├── tests/ # Berkas Unit Testing
├── ngapakin.py # Entrypoint CLI
└── README.md
🛠️ Instalasi & Penggunaan
Prasyarat
- Python 3.8 ke atas (tanpa ketergantungan pustaka pihak ketiga).
Cara Kloning & Memulai Proyek
git clone https://github.com/IlhamHattaManggala/ngapakin.git
cd ngapakin
💻 Panduan CLI Command
Larapak menyediakan CLI helper komprehensif melalui ngapakin.py:
# Menjalankan berkas kode biasa
python ngapakin.py run berkas.ngpk
# Menjalankan server web Larapak (port default: 8000)
python ngapakin.py serve 8000
# Melihat daftar rute terdaftar
python ngapakin.py route:list
# Membuat komponen baru (Scaffolding)
python ngapakin.py make:controller UserController
python ngapakin.py make:model Member
python ngapakin.py make:middleware AuthMiddleware
python ngapakin.py make:migration create_users_table
python ngapakin.py make:job SendEmailJob
# Migrasi Database
python ngapakin.py migrate # Jalankan migrasi
python ngapakin.py rollback # Kembalikan migrasi terakhir
python ngapakin.py db:seed # Jalankan seeder database
# Layanan Ekosistem
python ngapakin.py cache:clear # Hapus data cache
python ngapakin.py queue:work # Jalankan pemroses job queue
python ngapakin.py package:install auth-helper # Pasang paket baru
python ngapakin.py repl # Masuk ke REPL interaktif
python ngapakin.py debug berkas.ngpk # Debug bytecode berkas
python ngapakin.py test # Jalankan seluruh unit test suite
📖 Cara Menggunakan Fitur Ekosistem
1. Validasi & Autentikasi
# Validasi data request
data = ["email": "ilham@example.com", "umur": 20]
aturan = ["email": "required|email", "umur": "required|numeric|min:18"]
val = validator.gawe(data, aturan)
nek val.gagal() ya
tulis "Validasi Gagal!"
tulis val.errors()
liyane
tulis "Validasi Sukses!"
rampung
# Login user
nek auth.mlebu("ilham@example.com", "password123") ya
tulis "Berhasil Login!"
tulis auth.user().name
liyane
tulis "Login Gagal!"
rampung
2. Caching & Sesi
# Sesi
sesi.pasang("cart_total", 150000)
total = sesi.entuk("cart_total")
# Cache (Simpan data 60 detik)
cache.pasang("weather_jakarta", "Hujan", 60)
cuaca = cache.entuk("weather_jakarta")
3. Event & Queue
# Event
gawe kirimNotif(data)
tulis "Mengirim notifikasi ke user ID: " + data
rampung
event.listen("user.registered", kirimNotif)
event.dispatch("user.registered", 99)
# Queue Job
queue.push("SendEmailJob", ["pesan": "Halo Selamat Datang!"])
🔍 Interactive Breakpoint Debugger
Jalankan debug program menggunakan perintah python ngapakin.py debug <file.ngpk>. Ketika VM menyala di mode tracing debugger, Anda dapat memasukkan perintah berikut di shell dbg>:
satau [Enter]: Melangkah 1 instruksi bytecode (Step Over/Into).c: Lanjutkan eksekusi normal tanpa jeda (Continue).lataulocals: Cetak semua variabel lokal di call frame aktif.gatauglobals: Cetak semua variabel global yang terdaftar.storstack: Cetak kondisi VM stack saat ini.qatauquit: Hentikan program seketika.
🎨 VSCode Extension & LSP Setup
- Salin seluruh isi direktori
editors/vscodeke dalam folder ekstensi VSCode lokal Anda:- Windows:
%USERPROFILE%\.vscode\extensions\ngapaklang-vscode - Linux/macOS:
~/.vscode/extensions/ngapaklang-vscode
- Windows:
- Jalankan ulang VSCode. Berkas berekstensi
.ngpkkini mendapatkan pewarnaan sintaksis. - Language Server otomatis memindai sintaksis dan menampilkan tanda garis bawah merah jika terjadi error penulisan (LSP Diagnostics).
🧪 Pengujian Pipeline
Kami menjaga kualitas ekosistem dengan unit testing komprehensif. Jalankan perintah berikut untuk memvalidasi:
$env:PYTHONPATH="."; pytest
🗺️ Roadmap Masa Depan
- v1.1.0: Dukungan HTTP Client terintegrasi untuk komunikasi API eksternal.
- v1.2.0: Relasi ORM Polimorfik (Many-to-Many dinamis).
- v1.3.0: Enkripsi berkas bytecode
.ngpkcterkompresi tingkat lanjut. - v2.0.0: Compiler NgapakIn JIT (Just-In-Time) untuk kecepatan setara kode mesin.
📄 Lisensi
Dilindungi oleh Lisensi MIT - Lihat berkas LICENSE untuk detail.
Metadata
Release files for ngapakin 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ngapakin-1.0.1.tar.gz | 58.3 kB | Without provenance | Details for ngapakin-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ngapakin-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for ngapakin-1.0.1-py3-none-any.whl |
Total release size: 116.0 kB
Release files / ngapakin-1.0.1.tar.gz
| Download URL | ngapakin-1.0.1.tar.gz |
|---|---|
| Size | 58.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8e7a8536510da0ef571a13eec28cd4ce6a3e4a4f47dcc5e172a9ee31dd4800c2
|
|
BLAKE2b-256 checksum How to use checksums |
05793f30419ba929a58db408cc1173e1fddc371bb5370e3455327cb9182a2aec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Release files / ngapakin-1.0.1-py3-none-any.whl
| Download URL | ngapakin-1.0.1-py3-none-any.whl |
|---|---|
| Size | 57.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
de81273c70aedc8e68136def818e62d319303e70d2821234363dead607d37f9a
|
|
BLAKE2b-256 checksum How to use checksums |
139be9df5efc4c8051a3927d5490d22a6a7c3fb843e581d24574bb07693f47b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.15
|
Security for ngapakin 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.