IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /docs/manual/basics.md). For the complete Mojo documentation index, see llms.txt.
Skip to main content
Version: 1.0
For the complete Mojo documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /docs/manual/basics.md).

Mojo standard library

All the data types, structs, traits, functions, and other APIs included with Mojo.

The standard library provides nearly everything you'll need for writing Mojo programs, including basic data types like Int and SIMD, collection types like List, reusable algorithms, and modules to support GPU programming.

Packages

  • algorithm: High performance data operations: vectorization, parallelization, reduction, memory.
  • atomic: Atomic operations and memory orderings.
  • base64: Binary data encoding: base64 and base16 encode/decode functions.
  • benchmark: Performance benchmarking: statistical analysis and detailed reports.
  • bit: Bitwise operations: manipulation, counting, rotation, and power-of-two utilities.
  • builtin: Language foundation: built-in types, traits, and fundamental operations.
  • collections: Core data structures: List, Dict, Set, Optional, plus specialized collections.
  • compile: Runtime function compilation and introspection: assembly, IR, linkage, metadata.
  • complex: Complex numbers: SIMD types, scalar types, and operations.
  • documentation: Documentation built-ins: decorators and utilities for doc generation.
  • ffi: Foreign function interface (FFI) for calling C code and loading libraries.
  • format: Provides formatting traits for converting types to text.
  • gpu: GPU programming primitives: thread blocks, async memory, barriers, and sync.
  • hashlib: Cryptographic and non-cryptographic hashing with customizable algorithms.
  • io: Core I/O operations: console input/output, file handling, writing traits.
  • iter: Iteration traits and utilities: Iterable, IterableOwned, Iterator, enumerate, zip, map.
  • itertools: Iterator tools for lazy sequence generation and transformation.
  • logger: Logging with configurable severity levels.
  • math: Math functions and constants: trig, exponential, logarithmic, and special functions.
  • memory: Low-level memory management: pointers, allocations, address spaces.
  • os: OS interface layer: environment, filesystem, process control.
  • pathlib: Filesystem path manipulation and navigation.
  • prelude: Standard library prelude: fundamental types, traits, and operations auto-imported.
  • pwd: Password database lookups for user account information.
  • python: Python interoperability: import packages and modules, call functions, type conversion.
  • random: Pseudorandom number generation with uniform and normal distributions.
  • reflection: Compile-time reflection utilities for introspecting Mojo types and functions.
  • runtime: Runtime services: async execution and program tracing.
  • stat: File type constants and detection from stat system calls.
  • subprocess: Execute external processes and commands.
  • sys: System runtime: I/O, hardware info, intrinsics, compile-time utils.
  • tempfile: Manage temporary files and directories: create, locate, and cleanup.
  • testing: Unit testing: Assertions (equal, true, raises) and test suites.
  • time: Timing operations: monotonic clocks, performance counters, sleep, time_function.
  • utils: General utils: indexing, variants, static tuples, and thread synchronization.