Skip to main content

Bundle a Python project into a self-contained native binary

Project description

python2binary 🚀

python2binary adalah alat baris perintah (CLI) untuk membungkus proyek Python Anda menjadi sebuah file binary native yang mandiri (self-contained).

Cara Kerja (Pipeline)

Program ini bekerja melalui tiga tahap utama:

  1. Pack: Membungkus semua file .py dalam proyek Anda menjadi arsip .pyz (zipapp).
  2. Convert: Mengubah file .pyz menjadi header C (.h) menggunakan xxd.
  3. Compile: Menghasilkan launcher C yang menyematkan data Python tersebut dan mengkompilasinya menggunakan gcc menjadi binary native.

Binary yang dihasilkan akan mengekstrak kode Python ke folder sementara saat dijalankan dan mengeksekusinya menggunakan interpreter python3 yang ada di sistem target.

Prasyarat Sistem

Sebelum menggunakan python2binary, pastikan sistem Anda telah memiliki:

  • Python 3.8+
  • GCC: Compiler C (untuk tahap kompilasi).
  • XXD: Tool hexdump (untuk tahap konversi).

Di Ubuntu/Debian, Anda dapat menginstalnya dengan:

sudo apt-get update
sudo apt-get install build-essential xxd

Instalasi

Gunakan mode editable agar Anda dapat menjalankan perintah python2binary secara global di dalam venv Anda:

# Aktifkan venv Anda
source .binary/bin/activate

# Instal proyek
pip install -e .

Penggunaan

Setelah diinstal, Anda dapat menjalankan python2binary langsung dari terminal:

python2binary --project <direktori_proyek> --entry <file_utama> --output <folder_hasil> [--name <nama_binary>]

Parameter:

  • --project, -p: Direktori root proyek Python Anda.
  • --entry, -e: Script entry-point (misal: main.py atau app/run.py), relatif terhadap direktori proyek.
  • --output, -o: Direktori tujuan hasil build.
  • --name, -n (Opsional): Nama file binary yang dihasilkan. Default menggunakan nama folder proyek.

Contoh:

python2binary -p ./my_script_folder -e main.py -o ./dist -n my_application

Struktur Proyek

  • main.py: Entry point CLI.
  • pipeline.py: Logika utama orkestrasi pembangunan binary.
  • infrastructure/: Implementasi teknis untuk packing, konversi, dan kompilasi.
  • interfaces/: Definisi abstraksi untuk setiap tahapan pipeline.
  • schemas/: Struktur data untuk konfigurasi dan hasil build.

Lisensi

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python2binary-0.1.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python2binary-0.1.0-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file python2binary-0.1.0.tar.gz.

File metadata

  • Download URL: python2binary-0.1.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python2binary-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d667ac181d6c968bb2558e398d6f24ac42ca34d8fc089bbbcf43341d8e17ab0d
MD5 7ce6c461376449434de7874b19b708c8
BLAKE2b-256 89d5f701529703d125a971ba38c24c136b0d34a42766f202acd0099ff46e4951

See more details on using hashes here.

Provenance

The following attestation bundles were made for python2binary-0.1.0.tar.gz:

Publisher: publish.yml on FauzanAriyatmoko/python2binary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file python2binary-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: python2binary-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 13.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for python2binary-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cc4f6a337732c03bb034e7cc8a3a87cef247489d82733fba424ccee4fa5b7e7
MD5 12ea3477cd25762d326bd73209061ce1
BLAKE2b-256 7a1959d1736c2bd3d918c3d5989eaed403a0215262bd9a798a5516394eb0bc4d

See more details on using hashes here.

Provenance

The following attestation bundles were made for python2binary-0.1.0-py3-none-any.whl:

Publisher: publish.yml on FauzanAriyatmoko/python2binary

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page