Skip to main content

Modules

This page is the catalogue. Every name you can import in gopy today is listed below, with a note on how complete the port is and where the source lives. The wiring lives in stdlibinit/registry.go; each module's init() block calls imp.AppendInittab(name, factory) to register its name.

Status legend

  • Complete. Every public API is wired and behaves like CPython 3.14.
  • Partial. The module imports and the common path works, but some functions raise NotImplementedError or are missing.
  • Stub. The name is registered so import succeeds; most attributes are unimplemented.

Catalogue

Core and built-ins

ModuleStateSourceNotes
builtinsCompletemodule/builtins/print, len, range, exception types, etc.
sysCompletemodule/sys/argv, path, modules, version_info.
_ioCompletemodule/_io/C-level I/O classes; backs io.
ioCompletemodule/io/Text/binary I/O wrappers.
errnoCompletemodule/errno/Errno constants.
signalCompletemodule/signal/Signal handlers and constants.
gcCompletemodule/gc/gc.collect, generation thresholds.
_warningsCompletemodule/_warnings/The C side of warnings.
warningsCompletemodule/warnings/Filter management.

Numeric and functional

ModuleStateSourceNotes
mathCompletemodule/math/Trig, log, gamma, isqrt, isfinite.
_functoolsCompletemodule/_functools/C side of functools.
functoolsCompletemodule/functools/reduce, partial, lru_cache, ...
_operatorCompletemodule/_operator/itemgetter, attrgetter, ops.

Containers and algorithms

ModuleStateSourceNotes
collectionsCompletemodule/_collections/deque, OrderedDict, Counter, ChainMap.
_heapqPartialmodule/_heapq/Core heap ops; some helpers pending.
_bisectPartialmodule/_bisect/bisect_left, bisect_right.
_itertoolsPartialmodule/_itertools/Several iterators pending.

Text and pattern matching

ModuleStateSourceNotes
reCompletemodule/re/Full re API.
_sreCompletemodule/_sre/Pattern engine; see spec 1703 for details.
_codecsCompletemodule/_codecs/UTF-8 / 16 / 32, latin-1, ASCII.
_stringPartialmodule/_string/The C helpers behind string.Formatter.
difflibCompletemodule/difflib/SequenceMatcher, unified_diff.
fnmatchCompletemodule/fnmatch/Shell-style wildcards.
_tokenizeCompletemodule/_tokenize/Tokeniser exposed to Python.

Data formats

ModuleStateSourceNotes
_jsonCompletemodule/_json/loads, dumps, the encoder/decoder.
_csvCompletemodule/_csv/Reader / writer / dialect.
_hashlibCompletemodule/_hashlib/MD5, SHA-1, SHA-256, etc.
zlibCompletemodule/zlib/Deflate / inflate.

OS, I/O, network

ModuleStateSourceNotes
osCompletemodule/os/path, environ, getcwd, etc.
_socketCompletemodule/_socket/Low-level sockets.
socketCompletemodule/socket/High-level wrappers.
_statPartialmodule/_stat/S_ISDIR, mode bits.
_posixsubprocessStubmodule/_posixsubprocess/Registered; runtime not yet usable.

Concurrency and contexts

ModuleStateSourceNotes
_threadPartialmodule/_thread/Lock, start_new_thread, ident.
contextvarsCompletemodule/contextvars/ContextVar, copy_context.
contextlibCompletemodule/contextlib/contextmanager, suppress, ExitStack.

Date and time

ModuleStateSourceNotes
_timePartialmodule/_time/time, monotonic, sleep. Pieces pending.
_datetimePartialmodule/_datetime/date, datetime, timedelta. timezones partial.

Introspection, types, weakrefs

ModuleStateSourceNotes
tracebackCompletemodule/traceback/format_exc, extract_stack.
typesCompletemodule/types/FunctionType, MappingProxyType.
_weakrefCompletemodule/_weakref/The C side of weakref.
weakrefCompletemodule/weakref/ref, WeakValueDictionary, ...

Class machinery

ModuleStateSourceNotes
_abcPartialmodule/_abc/ABCMeta core; subclass cache partial.
dataclassesCompletemodule/dataclasses/@dataclass, field, replace.

Tooling

ModuleStateSourceNotes
argparseCompletemodule/argparse/Subset matching CPython output.
_opcodePartialmodule/_opcode/Used by dis and the compiler.
_randomStubmodule/_random/Registered; Mersenne Twister pending.
_uuidStubmodule/_uuid/Registered; native UUID pending.

What is not here yet

The following commonly used modules are not in gopy today. Track the project issues for status. If your service needs one, file a request: it helps us prioritise.

  • asyncio, selectors
  • multiprocessing, the full threading module
  • ssl, hashlib (the high-level wrapper)
  • subprocess
  • urllib.*, http.*, email
  • pathlib
  • sqlite3, dbm
  • logging (the full module; bare print works)
  • unittest, pytest

Adding your own

A Go author can register a new module in their own package with imp.AppendInittab. See Embedding for the pattern.

Reference

  • stdlibinit/stdlibinit.go. The blank-import wiring.
  • stdlibinit/registry.go. The per-module init manifest.
  • imp/inittab.go. The registration API.