Coverage#
Product contract for what picop is, what it ships, and how to choose helpers.
picop is not a reimplementation of the Python standard library, and it is not a full 1:1 port of Cython’s Includes/cpython. It is a curated CPython C-API accelerator for Cython, primarily on Python 3.15, retaining 3.14 and free-threaded 3.14t/3.15t compatibility.
Use picop for Python imports and Cython cimports. The former cypy imports and cimport shims were removed in 3.0; migrate to matching picop module paths.
Product tiers#
Tier |
Who |
Import |
Contents |
|---|---|---|---|
Core |
Micro-opts / typed hot paths |
|
Typed containers, bytes/str, ANSI, GC toggles, string value ops |
Protocols |
Unknown concrete type |
|
Abstract mapping/sequence/number/object bridges |
Runtime |
Extension / embedding authors |
|
datetime, codecs, marshal, file, weakref, capsule, contextvars, thin clocks, process plumbing |
Rule of thumb: prefer Core when the type is known; use Protocols only when it is not; use Runtime for non-hot-path / embedding needs.
Parity: helpers that are not faster from plain Python#
Not every helper beats the builtin. The Tier A bench finds helpers that lose to the
builtin in every measured case, and a few that win or lose depending on the input —
mostly Protocols/Runtime thin wrappers, with a handful of Core names (dict_pop,
set_add, tuple_get, tuple_pack2). They stay in the API. A Python wrapper
loss does not establish whether the corresponding typed Cython call wins:
benchmark the actual calling mode and input shape. The repository’s
PERF_PARITY.md
records measured Python losses, and the
consumer catalog
describes access modes, contracts, and available evidence.
Core (prefer for micro-opts)#
Module |
Maps to |
Notes |
|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
len / eq / contains / startswith / … |
|
|
Prefer |
|
terminal SGR |
Not CPython; builds on unicode intern |
|
GC |
|
|
buffers / slice |
Core-adjacent |
Curated starter export: picop.hot.
1.0 freeze (Core + cimport contracts)#
As of 1.0.0:
Surface |
Frozen? |
Contract |
|---|---|---|
|
Yes |
Core star-import / discovery set — additive in minors; drop/rename/semantic change → major |
|
Yes |
Micro-opt marketing set — same policy |
Full public barrel beyond |
Protocols/Runtime provisional |
Still importable; may evolve under minors |
|
Documented SDK |
Wider than Python; cimport-only helpers stay out of this Python API reference |
Soft letter/bare/ |
Implementation only |
Prefer word-prefix / |
|
Supported |
Former |
Protocols (typed unknown)#
Module |
Prefer instead when typed |
|---|---|
|
|
|
|
|
|
|
typed module above |
Runtime (public and/or cimport)#
Public Runtime helpers include datetime, codecs, marshal, file, weakref, capsule, contextvars, cytime clocks, sentinel checks, and object-model / scalar modules (cyfunction, cymethod, cylong, …). cylong also offers cimport-only fixed-width conversions and PyLongWriter integer construction; see its tracker and Cython demo. Since 3.1/3.2, cycall adds tuple-free calls, and cyframe, cycode, cytraceback, and cycellobject add frame, code-object, traceback, and cell readers. Float pack/unpack wrappers validate buffer length before raw-pointer reads; trusted-caller contracts are in SAFETY. Embedding / process helpers such as cyerr, cymem, cythread, and cylock are cimport only and are not documented here as Python callables.
Python integer construction in picop.uuid uses CPython’s public PyLongWriter where supported.
Import surfaces#
Entry |
Role |
|---|---|
|
Core marketing surface — micro-opt starters |
|
Full public barrel; Core discovery via |
|
Module-scoped public |
|
Full Cython SDK (wider than Python) |
|
Supported Python and Cython SDK |
Discourage from picop import *.
Overlap decision tree#
Known concrete type?
dict → cydict (dict_get, dict_len, …)
list → cylist
tuple → cytuple
set → cyset
bytes → cybytes
str → cystr value ops; encode/intern → cyunicode
Unknown mapping / sequence / number-like?
→ cymapping / cysequence / cynumber
Still too dynamic?
→ cyobject (last resort)
Not a goal#
Full Cython
cpython.*parity or full Python stdlibDocumenting every cimport /
cdefsymbol in the public Python APITreating Protocol/Runtime losers as Core micro-opt defaults