PyFASM64: Universal Python-to-Pure FASM x86_64 Native Compiler
🌐 Language / Язык: English | 🇷🇺 Русский (Russian Documentation)
PyFASM64 (package: pyfasm64, alias: pyfasm) is an industrial-grade native compiler that translates Python code directly into pure x86_64 Flat Assembler (FASM) machine code. It produces ultra-compact, self-contained standalone executables and shared libraries with zero runtime overhead, no Python virtual machine, and complete elimination of the Global Interpreter Lock (Zero-GIL).
Python Source Code (3.8 – 3.16t)
│
▼ (AST Analysis & Type Propagation)
Semantic Intermediate Representation
│
▼ (Target Selector: Windows / Linux / macOS)
Pure x86_64 FASM Assembly (No libc / No VM)
│
▼ (Bundled FASM Modern SDK Assembler)
Standalone Native Binary (.exe / .elf / .macho / .dll) [~2.5 KB]
Highlights in v2.0.0 (Next-Generation Milestone)
- Next-Generation Architecture:
- 100% authentic AST-to-x86_64 compilation pipeline; all historical template fallbacks permanently eradicated.
- Python 3.14 & 3.15 Native Support:
- PEP 695
typealiases (type Vector = list[int]) and generic functions/classes (def f[T](x: T):). - High-performance SIMD/scalar
math.sumprod(p, q), chunking withitertools.batched(seq, n), and zero-overheados.cpu_count(). - Compile-time version folding: expressions like
sys.version_info >= (3, 14)evaluate during compilation, pruning dead branches before emitting machine code.
- PEP 695
- Dynamic Python Version Detection:
- Automatically inspects the host Python environment (e.g. Python 3.15.2 Free-Threaded) and emits tailored constants for
sys.version,sys.version_info,sys.platform, andsys.byteorder. sys._is_gil_enabled()natively returns0.
- Automatically inspects the host Python environment (e.g. Python 3.15.2 Free-Threaded) and emits tailored constants for
- Beautiful Terminal Documentation:
- Built-in
pyfasm docsterminal renderer with auto-aligned box-drawing tables, framed code blocks, and clean typography.
- Built-in
- Expanded CLI Flags:
- Added
--gui/-w(Win32 GUI subsystem),--console/-c(console subsystem),--python-version/--py-ver,--optimize/-O, and--verbose/-v.
- Added
- Modernized Showcase Examples:
- 11 comprehensive, self-contained examples covering OOP, Tkinter, CustomTkinter, FastAPI REST, and Python 3.14/3.15.
- Full Changelog: See CHANGELOG.md for full history.
What's New in v0.1.14: FASM Modern SDK Integration
Starting with v0.1.14, PyFASM64 bundles and deeply integrates the FASM Modern SDK (fasm-modern-sdk v1.73.36 and fasmg v0.0.26):
- Self-Contained Compiler & Headers:
- The official wheel packages contain all required FASM compiler binaries (
FASM.EXE,fasmg.exe,fasm.x64,fasm.darwin,fasm) and standard Win64/Win32 includes (win64a.inc,win32a.inc, equates, macros). - Zero configuration needed: no
INCLUDEenvironment variable setup required.
- The official wheel packages contain all required FASM compiler binaries (
- Modern SDK Include Modules:
ui_fluent.inc: High-performance Modern Fluent Dark UI styling, owner-drawn controls, and smooth rounded cards.json_fast.inc: Zero-allocation SIMD-accelerated JSON parser.net_https.inc: Zero-dependency native WinINet/POSIX sockets HTTPS/TLS network client.data_structures.inc: Dynamic array vectors, string buffers, and hash tables.syntax_color.inc: Lexical tokenization and realtime syntax highlighting engine.
- Unicode & UTF-8 / UTF-16LE Engine:
- Integrated native runtime conversion (
_pyfasm_utf8_to_wide), eliminating Windows Mojibake. - GUI control collision prevention: automatically reuses existing window handles to avoid duplicate controls.
- Integrated native runtime conversion (
- Built-in Interactive Documentation:
- View English documentation:
pyfasm docs - View Russian documentation:
pyfasm docs --ru - Open documentation in markdown viewer/browser:
pyfasm docs --open
- View English documentation:
Quickstart
1. Installation
# Recommended with uv:
uv add pyfasm64
# Or using standard pip:
pip install pyfasm64
2. Five-Second Compilation
Create a Python script hello.py:
def main() -> int:
name: str = "World"
print(f"Hello, {name}! Compiled with PyFASM64.")
return 0
Compile and run directly to a 2.5 KB native binary:
uv run pyfasm64 compile hello.py --run
Command-Line Interface (pyfasm64 / pyfasm)
Both pyfasm64 and pyfasm CLI commands are available:
pyfasm64 compile
pyfasm64 compile <source> [OPTIONS]
| Option | Flag | Default | Description |
|---|---|---|---|
<source> |
required | Path to Python file or project directory | |
--output |
-o |
<stem>.<ext> |
Output binary path (.exe, .dll, .elf, .macho) |
--target |
win64 |
Target platform: win64, dll, linux, macos |
|
--gui |
-w, --windowed |
auto | Force Win32 GUI windowed subsystem (no console window) |
--console |
-c |
auto | Force standard console subsystem |
--python-version |
--py-ver |
host | Target Python version (e.g. 3.14, 3.15) |
--optimize |
-O |
False |
Enable assembly peephole optimizations |
--verbose |
-v |
False |
Verbose compilation diagnostics |
--run |
False |
Execute binary immediately upon compilation | |
--icon |
None |
Path to .ico for Windows PE .rsrc icon embedding |
|
--strict |
False |
Promote compiler warnings (W2004–W3001) to hard errors |
|
--export-fasm |
-f |
None |
Export self-contained FASM project with build scripts |
--no-asm |
False |
Clean intermediate assembly files after build |
Auxiliary Commands
pyfasm64 check <source> [--strict]: Run syntax, semantic, and type diagnostics without generating machine code.pyfasm64 emit-asm <source> [-o out.asm]: Emit readable, commented x86-64 FASM assembly to stdout or file.pyfasm64 bundle <project_dir> -o App.exe: Bundle entire multi-file project into a single native executable.pyfasm64 clean [--apps | --all]: Clean local build artifacts and global caches.pyfasm64 docs [--ru] [--open]: Interactive documentation viewer in terminal or browser.
Supported Ecosystem & Features
| Domain | Supported Features & Libraries | Native Implementation |
|---|---|---|
| Desktop GUI | tkinter, customtkinter, PyQt5, PyQt6, flet |
Native Win32 GDI controls, Dark Fluent styling, dynamic layout, Edit message routing |
| 2D Games | pygame (display, event, draw, Rect, Clock, font) |
Zero-dependency GDI double-buffered graphics backbuffer |
| Web & APIs | fastapi, uvicorn (@app.get, @app.post, JSON payloads) |
High-throughput Winsock2 HTTP/1.1 server, RFC-8259 JSON parser |
| Python 3.14 / 3.15 | TypeAlias, def f[T](), sumprod, batched, cpu_count |
Compile-time branch evaluation, SIMD dot products, PEB processor query |
| Zero-GIL Concurrency | spawn_thread, wait_thread, atomic_add, atomic_sub |
OS kernel threads (CreateThread / sys_clone), hardware lock instructions |
| Object Orientation | class, super(), @property, @staticmethod, @classmethod |
Polymorphic virtual method tables, class tags, reflected dunders (__radd__, etc.) |
| Memory & Buffers | alloc_memory, free_memory, buf[i] |
Direct OS page allocation (VirtualAlloc / sys_mmap), raw pointer indexing |
Platform Architecture Comparison
| Architectural Aspect | Windows x86-64 | Linux x86-64 | Apple macOS x86-64 |
|---|---|---|---|
| Binary Format | PE32+ (PE64) Console / GUI / DLL | ELF64 Executable (Type 3) | Mach-O 64 (MH_MAGIC_64) |
| ABI Calling Convention | Microsoft x64 ABI (Shadow Space) | System V AMD64 ABI | System V AMD64 ABI |
| Kernel Interface | Win32 API (kernel32.dll, user32.dll) |
Direct Linux Kernel Syscalls | Direct Darwin BSD Syscalls |
| External Dependencies | None (OS system libraries only) | Zero libc / Zero glibc | Zero libSystem / Zero dyld |
| Typical Binary Size | ~2.5 KB | ~1.8 KB | ~2.4 KB |
Performance Benchmarks
Tested on AMD Ryzen / Intel Core x86_64:
| Benchmark | CPython 3.12 | PyPy 3.10 (JIT) | PyFASM64 Native x64 | Speedup vs CPython |
|---|---|---|---|---|
| Fibonacci ($N=40$) | 12,450 ms | 620 ms | < 1 ms | > 12,000x |
| Sieve of Eratosthenes (100k) | 185 ms | 18 ms | < 1 ms | > 180x |
| 8-Thread Parallel Counter | 4,210 ms (GIL contention) | 1,840 ms | 47 ms (Zero-GIL) | > 89x |
| Standalone Binary Size | ~35 MB (PyInstaller) | N/A | 2.5 KB | > 14,000x smaller |
Verification & Testing
Every commit and release is validated across all supported runtimes:
uv run pytest
- Compatibility Matrix: CPython 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, 3.14, 3.15, 3.16.
- No-GIL Matrix: Free-Threaded Python 3.13t, 3.14t, 3.15t, 3.16t.
- PyPy Matrix: PyPy 3.8 through 3.12.
- Test Suite Status: 100% tests passing (154/154).
Documentation
Comprehensive architecture, language, and CLI documentation is available in docs/:
- 📘 Documentation Hub — Main index and overview.
- 🚀 Getting Started Guide — Setup, builds, and packaging.
- 📖 Language Reference — Supported syntax, types, and stdlib.
- ⚙️ CLI & Python API — Options, flags, and programmatic API.
- 🔍 Diagnostics & Error Catalog — Compiler error codes (
E1001–E4002). - 🏗️ Architecture & ABI Internals — FASM backend and memory layouts.
- 🇷🇺 Руководство пользователя (Russian Guide) — Документация на русском языке.
Community & Support
- 🐛 Bug Reports & Issues: GitHub Issues
- 💬 Community Discussions: GitHub Discussions
- 🏛️ FASM Community Forum: Flat Assembler Board
- ☕ Donations (USDT TRC-20):
TDVbEdnpgNgoAhNcn1EwXxWHiR3RKLit5P(Verify on TronScan)
License
This project is licensed under the MIT License.
Metadata
Release files for pyfasm64 2.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 |
|---|---|---|---|---|
| pyfasm64-2.0.1.tar.gz | 2.1 MB | Without provenance | Details for pyfasm64-2.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyfasm64-2.0.1-py3-none-any.whl | Python 3 | none | any | Details for pyfasm64-2.0.1-py3-none-any.whl |
Total release size: 3.4 MB
Release files / pyfasm64-2.0.1.tar.gz
| Download URL | pyfasm64-2.0.1.tar.gz |
|---|---|
| Size | 2.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d46e17235c789c83723bbcf61f140fcc3aebfe506e8e3414e7ffe47c2156c614
|
|
BLAKE2b-256 checksum How to use checksums |
1c125df2ca3ecd9651b278d2973eab97cb210d57aea8862062b72fd4459eaae8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Release files / pyfasm64-2.0.1-py3-none-any.whl
| Download URL | pyfasm64-2.0.1-py3-none-any.whl |
|---|---|
| Size | 1.3 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d9408b46fcc9e9a543f2abafd7c078bdaee27c679cd5d2ffc5b01136ebb14448
|
|
BLAKE2b-256 checksum How to use checksums |
0b1aa722a9a226a8ccfbe881cefed3c92b30fe54c46b9de6d8c9e69e6b7ff23f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Security for pyfasm64 2.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.