Py2Native — Community edition, MIT licensed

Ship Python as a native binary

Compile any Python script into a standalone native executable — without touching a single line of configuration.

Py2Native transpiles your sources to C with Cython and links them into one binary. Your code stops being readable; the libraries you depend on stay exactly as they are.

Windows 8+, ManyLinux 2014 / musl and macOS · x86-64 and ARM64 · CPython 3.11–3.15

One command

From sources to binary

0 spec files

Nothing to configure

19 files

Linked into one .exe

py2native build — cli

# Compile py2native itself — 19 source files into one native .exe $ uv run py2native build --exe py2native --base src/py2native cli *.py INFO pristine: Found existing pristine Python at .py2native_build\python\cpython-3.14-windows-x86_64-none INFO build: Compiling cli with sources build.py, cli.py, compiler.py, embed.py, linuxplatform.py, macplatform.py, plugin.py, pristine.py, runtime.py, templates.py, utils.py, version.py, whl.py, winnovs.py, winplatform.py, wintemplate.py, xwinonlinux.py, __init__.py INFO compiler: Compiling bootstrap.c (noInit=True) INFO compiler: Compiling build.c, cli.c, compiler.c, embed.c, linuxplatform.c, macplatform.c, plugin.c, pristine.c, runtime.c, templates.c, utils.c, version.c, whl.c, winnovs.c, winplatform.c, wintemplate.c, xwinonlinux.c, shared.c (noInit=False) INFO compiler: Objects bootstrap.obj, build.obj, cli.obj, compiler.obj, embed.obj, linuxplatform.obj, macplatform.obj, plugin.obj, pristine.obj, runtime.obj, templates.obj, utils.obj, version.obj, whl.obj, winnovs.obj, winplatform.obj, wintemplate.obj, xwinonlinux.obj, shared.obj INFO build: Compiled to .py2native_build\py2native.exe

Compiling Py2Native itself: 19 Python modules become a single native executable.

Overview

A compiler, not a packager

Standard packagers collect an interpreter and your source into an archive. Py2Native compiles your code first and only then links it, which is why the build description is a file list instead of a configuration format.

Step 1

Point at your sources

Pass the modules you want to protect. Glob patterns under --base pick up the rest, and only your code is compiled.

Step 2

Cython and the linker do the work

Py2Native transpiles your sources to C, compiles every generated file with the platform toolchain and links one binary.

Step 3

Ship a single executable

The linked binary contains your modules. No system Python, no bytecode, no .pyc files and no spec file to maintain.

The build command is the whole interface

There is no project file to keep in sync with your code. You name the entry module and the sources to compile, and optionally ask for an embedded environment, a wheel or a shared library instead of an executable.

Pro builds additionally accept a licence file and a public key, so the resulting binary can verify a signed JWT at runtime without shipping any key material beyond the public one.

build — CLI reference

# Executable (default)
uv run py2native build app app.py

# Library mode and wheel
uv run py2native build app app.py --library --wheel dist

# Embedded deployment directory
uv run py2native build app app.py --embed build/app

# Pro: verify a licence at build and runtime
uv run py2native build app app.py \
  --license license.dat --public public.pem

The same invocation shape on Windows, Linux and macOS.

Features

Built for shipped software

Everything the old toolchain made you assemble by hand: compiled output, a linked runtime, licence verification and replaceable dependencies.

Unbreakable IP protection

Your Python source is compiled to native machine code before it leaves the build machine. No bytecode, no .pyc files, no source reconstruction.

Cython
Native code
No bytecode

Zero-config builds

No spec files, no hidden imports, no configuration format to learn. The files you pass are the whole build description.

One command
No spec file

Self-contained binaries

Every executable links its own Python runtime, so the target machine never needs Python installed.

Portable
Windows / Linux / macOS

Licence verification (Pro)

Protect commercial builds with JWT licences signed with elliptic curve cryptography, verified by compiled code at runtime.

JWT
ES256 (P-256)

Runtime libraries stay replaceable

Third-party libraries remain plain Python inside a managed environment, so LGPL obligations stay satisfied and monkey patching still works.

LGPL compliant
uv environment

Library and wheel output

Produce an executable, a shared library or a PEP 427 wheel whose import hook serves your compiled modules.

--library
--wheel
--embed

Migration

Packaging should not take longer than coding

A packager makes you describe your program to a tool that only guesses at it. A compiler is told which files to build, so the guesswork and the hidden-import archaeology disappear.

The old way

PyInstaller / Nuitka workflow

You enumerate hidden imports, exclude modules you do not use, map data directories and hope the analysis holds on the target machine.

# Hunt for hidden imports...
python -m PyInstaller \
  --hidden-import=pandas._libs.tslibs \
  --hidden-import=numpy.core._multiarray_umath \
  --exclude-module=tkinter \
  --add-data="assets/*:assets" \
  --onefile app.py
Py2Native

Compiler workflow

You name the files that should be compiled. There is nothing to discover, because the compiler already knows what the program imports.

# Just pass the files you want to compile.
uv run py2native build app app.py

Licensing

Free to compile, paid to protect

Native compilation is MIT licensed and free forever. The Pro edition adds the licence checking that commercial distribution needs.

Community edition

Py2Native

MIT licence, no account, no seat counting.

Free

forever

Pro and Enterprise are priced per seat and year on the storefront.

  • ✓

    Full compilation to native machine code
  • ✓

    MIT licensed — use it in open source and commercial projects alike
  • ✓

    Windows, ManyLinux/musl and macOS targets, x86-64 and ARM64
  • ✓

    CPython 3.11 to 3.15 support, including free-threaded builds
  • ✓

    Single-file executable, shared library or wheel output
Start with the documentation
From the same workshop

Prove when your code existed

TimestampGIT stamps your GitHub repositories into the Bitcoin blockchain. Together with a native build you get both halves of the story: proof of what was written, and a binary that cannot be read back into source.

  • Cryptographic proof of the moment a revision existed
  • Runs against GitHub, no manual archive to keep
  • Independent of Py2Native — useful on its own

Compile your first binary in a few minutes

Install Py2Native as a dev dependency, name your entry module and link a native executable. No spec file, no hidden imports, no system Python on the target.

Community edition is MIT licensed. Third-party libraries remain under their own licences and stay replaceable.

Where to go next

Documentation

Installation, CLI reference, deployment recipes and the Pro edition in one page.

Read the docs →

Pricing

The Community edition is free and MIT licensed. Pro and Enterprise add licence verification.

Compare licences →

Blog

Release notes and notes on native compilation, packaging and protecting Python code.

Visit the blog →