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

picop.hot (preferred) or from picop import …

Typed containers, bytes/str, ANSI, GC toggles, string value ops

Protocols

Unknown concrete type

picop / picop.cy*

Abstract mapping/sequence/number/object bridges

Runtime

Extension / embedding authors

picop public + cimport SDK

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

cydict

dict

dict_get, dict_pop, dict_set, dict_len, …

cylist

list

list_append, list_get / list_get_checked, list_len, …

cytuple

tuple

tuple_get, tuple_len, tuple_pack*

cyset

set / frozenset

set_add, set_contains, …

cybytes / cybytearray

bytes / bytearray

len / eq / contains / startswith / …

cystr / cyunicode

str value ops / UTF-8 intern

Prefer cystr for value ops

cyansi

terminal SGR

Not CPython; builds on unicode intern

cygc

GC

gc_collect, gc_is_enabled, …

cyarray / cymemoryview / cybuffer / cyslice

buffers / slice

Core-adjacent

Curated starter export: picop.hot.

1.0 freeze (Core + cimport contracts)#

As of 1.0.0:

Surface

Frozen?

Contract

picop.__all__

Yes

Core star-import / discovery set — additive in minors; drop/rename/semantic change → major

picop.hot.__all__

Yes

Micro-opt marketing set — same policy

Full public barrel beyond __all__

Protocols/Runtime provisional

Still importable; may evolve under minors

cimport picop / from picop.cy* cimport …

Documented SDK

Wider than Python; cimport-only helpers stay out of this Python API reference

Soft letter/bare/*_string (post-0.3)

Implementation only

Prefer word-prefix / *_cstr

picop imports / cimports

Supported

Former cypy Python imports and Cython cimport shims were removed in 3.0

Protocols (typed unknown)#

Module

Prefer instead when typed

cymapping

cydict

cysequence

cylist / cytuple

cynumber

cylong / cyfloat / cycomplex / cybool

cyobject

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

from picop.hot import …

Core marketing surface — micro-opt starters

import picop / from picop import …

Full public barrel; Core discovery via __all__

from picop.cydict import dict_get

Module-scoped public

cimport picop / from picop.cydict cimport …

Full Cython SDK (wider than Python)

from picop… / from picop… cimport

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 stdlib

  • Documenting every cimport / cdef symbol in the public Python API

  • Treating Protocol/Runtime losers as Core micro-opt defaults