Repository navigation
0.0.1
Release Notes
the first stable release of basedpython: a python-like language with sum types, extensions,
optional chaining and a type system that knows what your code means, transpiled to plain python
any python tool can read. it ships as the basedpython package, with two executables: by, the
type checker, transpiler and project driver, and buff, the linter and formatter
uv add --dev "basedpython>=0.0.1"getting started takes about five minutes. the
feature reference has a page for everything below
why try it
- plain python out the other end:
by buildwrites ordinary.pyfiles, so pytest, mypy,
ruff and the rest of your stack keep working - write for the newest python, ship for the oldest: polyfills
lower new syntax to run on the interpreters your users have - a type checker that is useful on plain python too: built on ty, with
sound types in place of gradual ones and
framework support for pydantic, sqlalchemy, pytest and
django - native speed when you want it:
by compilebuilds
the same source into CPython extension modules - tooling from day one: a language server, a formatter, a linter and an
intellij plugin
the language
.by keeps almost all of python's meaning; differences from python
lists every place it does not
- data and variants:
enum classsum types with payloads,
sealed classes with exhaustivematch, and
sentineldeclarations - expressions: optional chaining (
?.),
none-coalesce (??),
statement expressions
(x = match y:), destructuring and
if let,
trailing lambda blocks, and
checked casts - declarations: modifiers and visibility,
block scoping,
properties that read like declarations, an
init method shorthand, and a
mainfunction whose parameters are its command
line - extending what exists: extensions add members to
an existing type and declare its conformance to a protocol, and
conversions (__from__,__into__,__of__) say
how one type becomes another - effects: exception tracking (
raises),
local lifetimes (local,once) and
context parameters - imports and resources: lazy imports,
from x export yand
static resources
(import "config.yaml" as config)
the type system
- types that say more: intersections,
negations, tuple
and callable type literals,
typed dict literals,
template literal types and
inline protocols - computation in types: match types,
type deftype functions and
symbolic arithmetic in type parameters - generics: bound ranges,
type mappings,
safe variance, and type parameters that survive
to runtime through reified generics - inference that narrows instead of shrugging: sound types,
precise unsolved type variables,
inherited parameter types and
narrowing predicates - checks that work on
.pyas well: regex group types,
boolean conditions,
refutable unpacking,
unused return values and
string formatting - a more honest standard library: typeshed improvements
such as covariant mapping keys and precisefunctools.cache - two presets:
strictandty-compatible, chosen with
type-checking-preset
transpiling and running
by buildtranspiles a project to python, and
by runtranspiles and runs a module in one step- runtime soundness checks guard each place an unchecked
value enters a typed slot by replis an interactive session in basedpython, and
debugging stops and steps at.bylinesby transpile --reverse
rewrites existing python into basedpython
native compilation
by compile builds modules into native CPython
extension modules for python 3.11 to 3.14, including the free-threaded builds. a function it cannot
compile keeps its interpreted definition, and --verbose says which and why
editors
- the language server gives completions, inlay hints, hover,
an outline and refactorings such as moving a
definition, extracting a superclass and changing a signature - the intellij plugin makes
.bya first-class
language in PyCharm and IntelliJ IDEA, withby,buffand the debugger bundled by checkanswers from a running language server's
warm state when there is onebufflints and formats.bywith ruff's rules plus the
BYrules, and aligns consecutive assignments
frameworks
pydantic, sqlalchemy,
pytest and django
are modelled directly, so synthesized constructors, mapped columns and injected fixtures check like
ordinary code. the language server also understands
django templates, and
basedpython-ui is a compose-style ui library the
type checker knows
packaging
- a project builds into an ordinary wheel with
basedpythonas
its build backend, or into one wheel for each python
it supports api.lockrecords a project's public api as a reviewable
diff, and declared dependencies checks imports against
pyproject.tomlby initstarts an application or library, and sets
up git merges of the filesbygenerates
installing without python
each release on github carries a basedpython-<target> archive of by and buff for 17 targets,
with shell and powershell installers
since 0.0.1b2
raisecan be written as an expression
anywhere a value can, as intable.get(key) ?? raise KeyError(key)- a
matchover a sealed class's subclasses is exhaustive, closed over the
workspace - an unannotated parameter of an override takes its type from every method it
overrides - a call to a function that asserts a variable of an enclosing scope narrows that variable
- reified type parameters are tested by the same subtype relation the checker uses, at every depth,
and a type parameter reads as a type form, soT()without anisinstance(T, type)is an error - an annotation written as a literal,
x: 1, is the same type asLiteral[1] - the editor reports what stops a module that checks clean from transpiling, and offers an
"invert boolean" refactoring and renames of the overrides, parameters and modules tied to a
renamed symbol by runandby replpass the signals that end a process on to the program- a PEP 723 script's own
type-checking-presetapplies when a project override names the script api.lockis the same whatever order modules are found in- windows paths in tracebacks and sourcemaps read
C:\...rather than\\?\C:\... by --versionreports basedpython's version- the standalone archives and installers are published on the github release page
Install basedpython 0.0.1
Install prebuilt binaries via shell script
curl --proto '=https' --tlsv1.2 -LsSf https://github.com/KotlinIsland/basedpython/releases/download/0.0.1/basedpython-installer.sh | shInstall prebuilt binaries via powershell script
powershell -ExecutionPolicy Bypass -c "irm https://github.com/KotlinIsland/basedpython/releases/download/0.0.1/basedpython-installer.ps1 | iex"Download basedpython 0.0.1
Verifying GitHub Artifact Attestations
The artifacts in this release have attestations generated with GitHub Artifact Attestations. These can be verified by using the GitHub CLI:
gh attestation verify <file-path of downloaded artifact> --repo KotlinIsland/basedpythonYou can also download the attestation from GitHub and verify against that directly:
gh attestation verify <file-path of downloaded artifact> --bundle <file-path of downloaded attestation>