From .py to .so, checked at every step
Each stage draws on the same checked definition of your program — no phase re-parses it with different rules.
Write
Instructions, accounts, errors in one .py. → program.py
Check
PSxxxx diagnostics with file, line, column. → a clean list, or a fix
Emit C
Readable C with runtime checks, per source line. → program.c
Build .so
Native SBF via Solana clang — cached, byte-identical. → program.so
Ship
Anchor-style IDL + solders client + manifest. → your client
You write — from examples/counter/programs/counter.py
@instruction
def increment(authority: Signer, counter: Mut[Counter], by: u64) -> None:
"""Add `by` to the count; only the stored authority may call this."""
require(counter.authority == authority.key, CounterError.Unauthorized)
counter.count += by
The compiler writes
static uint64_t pyf_increment(RtCtx *rt) {
/* (data-length checks: omitted in this excerpt) */
/* 2. accounts: 2 role-checked in declared order */
RtAccount *acc_authority = &rt->accounts[0u];
if (!acc_authority->is_signer) {
rt_fail_log(1001u, "counter.py", 49u, "signer required: authority");
return 1001u;
}
/* … writable, owner, size, and discriminator checks follow … */
uint64_t rt_t2 = 0u;
rt_ld_u64(acc_counter->data, 40u, &rt_t2);
uint64_t rt_t3;
uint64_t rt_t4 = rt_checked_add_u64(rt_t2, dp_by, &rt_t3);
if (rt_t4 != RT_OK) {
rt_fail_log(rt_t4, "counter.py", 52u, "checked add (u64)");
return rt_t4;
}
rt_st_u64(acc_counter->data, 40u, rt_t3);
return 0u; /* RT_OK */
}
RT_SIZE_COUNTER = 49
Straight from the emitted C: rt_ld_u64(acc_counter->data, 40u, …)
loads count, and RT_OFF_COUNTER_BUMP is 48.
Both chunks are real: the Python lines are the increment
instruction from examples/counter, and the C is what the
compiler emits for them — accounts role-checked, discriminator
verified, arithmetic overflow guarded, every failure attributed to a
source line. Read the full C in the
playground (Check, then the C tab).
What PythSol gives you
on this site runs from the page here;
in your terminal needs the
pythsol CLI and its toolchain.
Checked, not executed
The site parses your AST and type-checks accounts, seeds, and lamports — your Python is never executed in the browser.
Native, not WASM
clang targets the Solana SBF backend directly, so
pythsol build produces a real, deployable program with
verifiable bytecode.
IDL + client included
Every build emits an Anchor-style IDL and a solders client. Show
them in the playground's result tabs, or let
pythsol build write them to disk.
LiteSVM tests
pythsol test runs the real bytecode in-process with
LiteSVM — no validator, no network, no RPC cost.
Workflow tools
Faucet, deploy, wallet, verify, port, and profiling ship in the CLI — no extra glue is needed.
Solana-native types
PDAs with seeds, token and ATA CPI guards, lamport moves, and data enums are part of the language, not an afterthought.
Try it in the browser
No install. Pick an example, run Check for
PSxxxx diagnostics with file, line, and column, then
open the tabs to read the generated C, the IDL, and the solders
client. Nothing on the page runs your Python.
Learn from working programs
Six examples ship with tests written against the real bytecode — read them locally or follow the walkthroughs.
Counter
One PDA. initialize stores the authority. increment adds a u64 when the signer matches.
accountpdarequireerror
Ledger
FixedArray of four u64 slots, a deposit, an if/else apply, and a for-range fill.
FixedArrayiffor
Vault
Lamport PDA. deposit uses system_transfer. close returns the lamports to the authority.
SeedsHasOneCloseTosystem_transfer
Escrow
One lamport deal. make funds the PDA, take pays the maker and closes to the taker, cancel closes to the maker.
SeedsCloseTosystem_transfer
Multisig treasury
Owners approve a payout; the PDA signs the lamport transfer and approvals reset after release.
FixedArrayPubkeySeedsbitmask
Poll
Four allowlisted voters. A u8 bitmask records who voted; yes and no counts live on the account.
FixedArrayboolbitmaskrequire
Local development
Eight commands from a fresh checkout
git clone https://github.com/PythSol/pythsol cd pythsol pip install -e ".[test]" pythsol init app --template counter cd app pythsol check programs/app.py pythsol test pythsol build
Python 3.11+. Nothing else for check and test.
pythsol test runs the built bytecode in LiteSVM, in-process.
pythsol build needs the SBF platform tools —
pythsol doctor names exactly what is missing on your machine.
What pythsol build leaves on disk
What PythSol is
- A typed Python subset that a compiler can lower to C and native SBF bytecode.
- A checker with stable
PSxxxxdiagnostics that carry file, line, and column. - A generator for an Anchor-style IDL, a solders client, and a build manifest.
- A test runner — real bytecode in LiteSVM, offline and fast.
What it isn't
- Not all of Python - no async, no f-strings, no stdlib imports on-chain. Comprehensions must be a fixed-range array initializer.
- Not an interpreter: the site parses and type-checks, it never executes your Python.
- No in-browser SBF compile —
.sobuilds run where Solana's clang lives (your machine or Docker). - Not audited yet — a published security audit is still ahead.
Milestones, not dates
What ships next.
No launch dates. A milestone is done when its checks pass and the docs match the code.
-
Shipped · 0.1.0
Compiler and CLI
Typed Python checked and lowered to C, native SBF builds, Anchor-style IDL, solders client, and LiteSVM tests.
-
Shipped · live
Playground and docs
The in-browser checker, quickstart, language and accounts pages, and this site.
-
In progress
$PS token
Launch on Pump.fun, with trading fees funding compiler and docs work. The contract address goes up on the token card.
-
Shipped · PyPI
PyPI packaging
pip install pythsolfrom the public index, version 0.1.1. -
Later
Mainnet path
Deployment and verification hardening. Mainnet stays opt-in behind
--yes, never the default.
$PS · community token
This is our token.
$PS is the PythSol token. Trading fees go back into development — the compiler, the docs, the examples, and this playground.
- Fees fund development, not a team payout.
- Launches on Pump.fun; buy from the button on this card.
- Check the contract address here before every buy.
Contract address
Coming soon
The address and the coin page go live at launch. $PS is not an investment or a claim on PythSol.
Questions worth asking
Does this site run my Python?
No. The playground sends your source to a checker that parses it
and reports PSxxxx diagnostics. Emitting C is a pure
transformation of the checked AST. Compiling to .so
happens only on a machine with the SBF tools — loopback
pythsol serve, Docker, or your workstation.
What's in the typed subset?
Annotated integers u8–u128 and
i8–i128, bool,
Pubkey, Signer,
Mut/Init/Account,
FixedArray, Option,
FixedString, capacity-carrying
Vec[T, N], unit @enum with
match, @struct,
@event + emit, plain helpers, and
if/while/for over
range. Compiler-known calls are
require, len, range,
emit, system_transfer,
token_transfer, token2022_transfer,
ata_create, and the width casts. Stdlib and
third-party imports are refused. Full details on the
Language page.
What does pythsol build write?
The generated C, the native SBF .so, an Anchor-style
IDL, a solders client, and a manifest.json that ties
them together. Rebuilds are cached and byte-identical for the same
source.
How do tests run without a validator?
pythsol test executes the real program bytecode
in-process through LiteSVM — no validator, no RPC, no airdrop. The
four shipped examples all pass.
Can I deploy to mainnet?
pythsol deploy defaults to devnet. The CLI refuses
mainnet unless you pass --yes, and the faucet never
touches it. pythsol verify compares the on-chain
bytecode against your local .so by hash.