Skip to content

Standard Library Reference

Sharpy's standard library provides Python-familiar APIs backed by .NET implementations.

Built-in Functions

Built-in functions available without any import: abs(), all(), any(), ascii(), bin(), bool(), breakpoint(), chr(), double(), enumerate(), filter(), float(), format(), format_align(), format_float(), and 31 more.

Core Types

Type Description
list A mutable sequence of elements, similar to Python's `list`. Supports negative indexing, slicing, and Python-style methods.
dict A mutable mapping of keys to values, similar to Python's dict. Supports Python-style methods like get(), pop(), items(), keys(), and values().
set A mutable set of unique elements, similar to Python's `set`. Supports set operations: union, intersection, difference, and symmetric difference.
complex A complex number type, similar to Python's complex.

Modules

Module Description
argparse A named group of arguments for organization in help text. Arguments still belong to the parent parser; groups are for help formatting.
bisect Array bisection algorithm, similar to Python's bisect module. Provides functions to maintain a list in sorted order without having to sort the list after each insertion.
collections A ChainMap groups multiple dictionaries together to create a single, updateable view. Like Python's collections.ChainMap.
copy Shallow and deep copy operations, similar to Python's `copy` module.
csv Reads CSV data and maps each row to a dictionary keyed by field names, similar to Python's `csv.DictReader`.
datetime Represents a date (year, month, day).
fnmatch Unix filename pattern matching, matching Python's fnmatch module.
functools Higher-order functions and operations on callable objects, similar to Python's functools module.
glob Unix-style pathname pattern expansion, similar to Python's glob module. Supports ``, `?`, `[seq]`, and `*` patterns.
hashlib Represents a hash object that accumulates data and computes cryptographic hashes. Mirrors Python's hashlib hash object API.
heapq Heap queue algorithm (priority queue), similar to Python's heapq module. Implements a min-heap using a list as the underlying storage.
io In-memory text stream using a string buffer, similar to Python's io.StringIO. Extends TextWriter so it can be used anywhere a TextWriter is expected (e.g., csv module).
itertools Itertools module — tools for creating iterators.
json Python-compatible json module. Provides dumps/loads for string serialization and dump/load for file I/O.
logging A named logger that outputs messages at or above a configured level. Output format: LEVEL:name:message (written to stderr).
math Mathematical functions, similar to Python's math module. This module provides access to mathematical functions defined by the C standard.
operator Operator module — functions corresponding to the intrinsic operators of Python.
os OS-level operations, similar to Python's os module. Wraps System.IO and System.Environment for file, directory, and environment operations.
pathlib Object-oriented filesystem path, similar to Python's pathlib.Path. Immutable — all mutation methods return new Path instances.
random Pseudo-random number generators for various distributions, similar to Python's random module.
re Wraps a .NET `System.Text.RegularExpressions.Match` with Python-compatible API.
shutil High-level file operations, similar to Python's shutil module. Provides functions for copying, moving, and removing files and directory trees.
statistics Mathematical statistics functions, similar to Python's `statistics` module.
string String constants matching Python's string module. Provides character classification constants for ASCII characters.
sys Provides access to system-specific parameters and functions, similar to Python's sys module.
tempfile Temporary file and directory creation, similar to Python's tempfile module.
textwrap Text wrapping and filling, matching Python's textwrap module.
time Represents a time value as a named tuple of components, similar to Python's `time.struct_time`.