Skip to content

Top-level symbols (pg.*)

Everything importable directly from the pygx package (conventionally imported as pg). Each symbol links to its full documentation on the module page that defines it.

Classes and functions

Symbol Defined in Summary
pg.allow_empty_field_description pygx.symbolic Sets whether symbolic fields may be declared without a description.
pg.allow_repeated_class_registration pygx.symbolic Sets whether a serialization type name may be registered twice.
pg.set_origin_stacktrace_limit pygx.symbolic Sets the maximum number of stack frames captured for origin tracking.
pg.allow_partial pygx.symbolic Returns a context manager that allows partial values in scope.
pg.allow_writable_accessors pygx.symbolic Returns a context manager that makes accessors writable in scope.
pg.auto_call_functors pygx.symbolic Returns a context manager to enable or disable auto call for functors.
pg.notify_on_change pygx.symbolic Returns a context manager to enable or disable notification upon change.
pg.notify_once pygx.symbolic Returns a context manager that coalesces change notifications.
pg.enable_type_debug pygx.symbolic Toggle inclusion of pygx-internal frames in type-error tracebacks.
pg.is_type_debug_enabled pygx.symbolic Returns True if type-error tracebacks include pygx-internal frames.
pg.warn_on_field_override_no_annotation pygx.symbolic Toggle the warning emitted for bare-assignment field overrides.
pg.is_warn_on_field_override_no_annotation_enabled pygx.symbolic Returns True if bare-assignment field-override warnings are emitted.
pg.warn_on_capability_narrowing pygx.symbolic Toggle the warning emitted when a subclass narrows a class capability.
pg.is_warn_on_capability_narrowing_enabled pygx.symbolic Returns True if capability-narrowing warnings are emitted.
pg.track_origin pygx.symbolic Returns a context manager to enable or disable origin tracking.
pg.as_sealed pygx.symbolic Returns a context manager to treat symbolic values as sealed/unsealed.
pg.Symbolic pygx.symbolic Base for all symbolic types.
pg.PureSymbolic pygx.symbolic Base class for classes whose objects are considered pure symbolic.
pg.Dict pygx.symbolic Symbolic dict.
pg.dict pygx.symbolic Symbolic dict.
pg.List pygx.symbolic Symbolic list.
pg.list pygx.symbolic Symbolic list.
pg.Object pygx.symbolic Base class for symbolic user classes.
pg.ClassWrapper pygx.symbolic Base class for symbolic class wrapper.
pg.Functor pygx.symbolic Symbolic functions (Functors).
pg.Inferentiable pygx.symbolic Interface for values that could be dynamically inferred upon read.
pg.InferredValue pygx.symbolic Base class for inferred values.
pg.Ref pygx.symbolic Symbolic reference.
pg.maybe_clone pygx.symbolic Returns a clone if a symbolic value already has a parent.
pg.maybe_ref pygx.symbolic Returns value as-is if it is free to adopt, else a pg.Ref to it.
pg.ErrorInfo pygx.error_handling Structured, JSON-serializable view of an exception chain.
pg.members pygx.symbolic Function/Decorator for declaring symbolic fields for pg.Object.
pg.field pygx.symbolic Field descriptor for pg.Object dataclass-like fields.
pg.symbolize pygx.symbolic Make a symbolic class/function out of a regular Python class/function.
pg.functor pygx.symbolic Function/Decorator for creating a symbolic function from a function.
pg.functor_class pygx.symbolic Returns a functor class from a function.
pg.wrap pygx.symbolic Makes a symbolic class wrapper from a regular Python class.
pg.wrap_module pygx.symbolic Wraps classes from a module.
pg.compound pygx.symbolic Function decorator to create a compound class.
pg.compound_class pygx.symbolic Creates a compound class from a factory function.
pg.boilerplate_class pygx.symbolic Create a boilerplate class using a symbolic object.
pg.ContextualObject pygx.symbolic Base class for contextual objects.
pg.apply_wrappers pygx.symbolic Context manager for swapping user classes with their class wrappers.
pg.eq pygx.symbolic Compares two values for equality, using symbolic equality if possible.
pg.ne pygx.symbolic Compares two values for inequality, using symbolic equality if possible.
pg.lt pygx.symbolic Returns True if a value is symbolically less than the other value.
pg.gt pygx.symbolic Returns True if a value is symbolically greater than the other value.
pg.hash pygx.symbolic Returns the hash of a value, using symbolic hashing if possible.
pg.clone pygx.symbolic Clones a value, using symbolic clone if possible.
pg.TraverseAction pygx.symbolic Enum for the next action after a symbolic node is visited.
pg.traverse pygx.symbolic Traverse a (maybe) symbolic value using visitor functions.
pg.query pygx.symbolic Queries a (maybe) symbolic value.
pg.contains pygx.symbolic Returns if a value contains values of specific type.
pg.is_abstract pygx.symbolic Returns if the input value is abstract.
pg.is_pure_symbolic pygx.symbolic Returns if the input value is pure symbolic.
pg.is_deterministic pygx.symbolic Returns if the input value is deterministic.
pg.Diff pygx.symbolic A value diff between two objects: a 'left' object and a 'right' object.
pg.diff pygx.symbolic Inspect the symbolic diff between two objects.
pg.from_json pygx.symbolic Deserializes a (maybe) symbolic value from JSON value.
pg.from_json_str pygx.symbolic Deserialize (maybe) symbolic object from JSON string.
pg.to_json pygx.symbolic Serializes a (maybe) symbolic value into a plain Python object.
pg.to_json_str pygx.symbolic Serializes a (maybe) symbolic value into a wire-format string.
pg.serialize pygx.wire Serializes a value to a wire format (JSON by default).
pg.deserialize pygx.wire Deserializes a value from a wire format (JSON by default).
pg.save pygx.symbolic Save a symbolic value using the global save handler.
pg.load pygx.symbolic Load a symbolic value using the global load handler.
pg.open_jsonl pygx.symbolic Open a JSONL file for reading or writing.
pg.get_load_handler pygx.symbolic Returns global load handler.
pg.set_load_handler pygx.symbolic Sets global load handler.
pg.get_save_handler pygx.symbolic Returns global save handler.
pg.set_save_handler pygx.symbolic Sets global save handler.
pg.Origin pygx.symbolic Class that represents the origin of a symbolic value.
pg.FieldUpdate pygx.symbolic Describes one committed update to a field in an object tree.
pg.Insertion pygx.symbolic Marks a value to be inserted into a list.
pg.WritePermissionError pygx.symbolic Raised when write access to object fields is not allowed.
pg.SharedHoldError pygx.symbolic Raised when an already-held topo=True value is held a second time.
pg.TopoNotEnabled pygx.symbolic Raised when a tree-dependent operation is used on a topo=False object.
pg.KeySpec pygx.typing Interface for key specifications.
pg.ValueSpec pygx.typing Interface for value specifications.
pg.Field pygx.typing Class that represents the definition of one or a group of attributes.
pg.Schema pygx.typing Class that represents a schema.
pg.CustomTyping pygx.typing Interface for values that take over a field's validation.
pg.validate pygx.typing Validates a bare value against a type annotation, in one line.
pg.signature pygx.typing Gets the signature from a Python callable.
pg.schema pygx.typing Returns the schema from the signature of a class or a function.
pg.DNA pygx.geno The genome of a symbolic object relative to its search space.
pg.DNASpec pygx.geno Base class for DNA specifications (genotypes).
pg.DNAGenerator pygx.geno Base class for DNA generator.
pg.random_dna pygx.geno Generates a random DNA from a DNASpec.
pg.template pygx.hyper Creates an object template from the input.
pg.oneof pygx.hyper N choose 1.
pg.manyof pygx.hyper N choose K.
pg.permutate pygx.hyper Permutation of candidates.
pg.floatv pygx.hyper A continuous value within a range.
pg.evolve pygx.hyper An evolvable symbolic value.
pg.one_of pygx.hyper N choose 1.
pg.sublist_of pygx.hyper N choose K.
pg.float_value pygx.hyper A continuous value within a range.
pg.search_space pygx.hyper Returns the DNASpec from a (maybe) hyper value.
pg.dna_spec pygx.hyper Returns the DNASpec from a (maybe) hyper value.
pg.materialize pygx.hyper Materialize a (maybe) hyper value using a DNA or parameter dict.
pg.iter pygx.hyper Iterate a hyper value based on an algorithm.
pg.random_sample pygx.hyper Returns an iterator of random sampled examples.
pg.sample pygx.tuning Yields an example and its feedback sampled from a hyper value.
pg.poll_result pygx.tuning Gets the result of a sampling loop by its unique name.
pg.detour pygx.detouring Context manager for detouring object creation.
pg.patch pygx.patching Apply patches to a symbolic value.
pg.patcher pygx.patching Decorate a function into a Patcher and register it.
pg.patch_on_key pygx.patching Recursively patch values whose keys match a regular expression.
pg.patch_on_path pygx.patching Recursively patch values on matched paths.
pg.patch_on_value pygx.patching Recursively patch values on matched values.
pg.patch_on_type pygx.patching Recursively patch values on matched types.
pg.patch_on_member pygx.patching Recursively patch values that are the requested member of classes.
pg.ObjectFactory pygx.patching A factory to create a symbolic object from a base value and patches.
pg.from_uri pygx.symbolic Build a symbolic object from a URI-like string.
pg.KeyPath pygx.topology Represents a path of keys from the root to a node in a tree.
pg.KeyPathSet pygx.topology A set of KeyPath values based on a trie-like data structure.
pg.MissingValue pygx.typing Value placeholder for an unassigned attribute.
pg.Formattable pygx.formatting Interface for classes whose instances can be pretty-formatted.
pg.repr_format pygx.formatting Context manager overriding the format kwargs used by __repr__.
pg.str_format pygx.formatting Context manager overriding the format kwargs used by __str__.
pg.MaybePartial pygx.topology Interface for classes whose instances can be partially constructed.
pg.CopyIfDefault pygx.topology Opt-in marker: copy instances of this type when used as a static default.
pg.WireConvertible pygx.wire Interface for objects convertible to/from the wire representation.
pg.WireFormat pygx.wire Base class for a wire format: a codec over the canonical representation.
pg.JsonFormat pygx.wire The built-in JSON wire format (the default).
pg.YamlFormat pygx.wire A YAML wire format -- a worked example of a second format.
pg.register_format pygx.wire Registers a wire format under its name for lookup by format=.
pg.get_format pygx.wire Resolves a format name or instance to a WireFormat.
pg.DocStr pygx.typing A docstring parsed into its structured parts.
pg.registered_types pygx.wire Returns an iterator of registered (serialization key, class) tuples.
pg.is_partial pygx.topology Returns True if a value is partially bound.
pg.format pygx.formatting Formats a (maybe) hierarchical value with flags.
pg.print pygx.formatting Prints values formatted with pg.format (exposed as pg.print).
pg.docstr pygx.typing Gets the structured docstring of a Python symbol, or None if absent.
pg.catch_errors pygx.error_handling Context manager for catching user-specified exceptions.
pg.match_error pygx.error_handling Returns True if the error matches the specification.
pg.timeit pygx.instrument Context manager to time a block of code.
pg.colored pygx.formatting Returns the colored text with ANSI color characters.
pg.decolor pygx.formatting Removes ANSI color characters from a string.
pg.view pygx.views Renders a value into a Content object using a specific view.
pg.view_options pygx.views Context manager to inject default rendering args for views.
pg.View pygx.views Base class for views.
pg.Html pygx.views HTML with consolidated CSS and Scripts.
pg.to_html pygx.views Returns the HTML representation of a value.
pg.to_html_str pygx.views Returns an HTML str for a value.

Other symbols

Values and aliases without a rendered documentation entry of their own.

Symbol Summary
pg.active_core Returns the active core from $PYGX_CORE, or the resolved default.
pg.MISSING_VALUE Value placeholder for an unassigned attribute.
pg.WireValue Represent a PEP 604 union type
pg.reload Reloads a module along with its transitively-imported sub-modules.

Subpackages

Alias Summary
pg.symbolic Symbolic classes, containers and functions, plus the operations on them.
pg.typing Runtime typing for symbolic objects: schemas, fields, and value specs.
pg.geno Program genome and genotypes.
pg.hyper Hyper objects: representing template-based object space.
pg.tuning Distributed tuning with pluggable backends.
pg.detouring Redirecting class instantiation to other classes or functions in a scope.
pg.patching Systematic patching on symbolic values.
pg.formatting String formatting primitives shared across PyGX.
pg.topology Tree topology primitives: paths, missing-value sentinels, and traversal.
pg.wire Wire formats for serializing PyGX values.
pg.contextual Context-scoped value override for PyGX.
pg.error_handling Exception classification and contextual error capture for PyGX.
pg.views Pluggable rendering of symbolic objects and other Python values.
pg.controls Common HTML controls.
pg.io Pluggable IO with unified interfaces.
pg.coding Runtime compilation, execution and sandboxing of Python source code.
pg.instrument PyGX's instrumentation sub-packages.
pg.logging Logging for PyGX.
pg.monitoring Pluggable metric systems for monitoring.
pg.importing Utilities for inspecting, loading, and reloading imported modules.
pg.concurrent Concurrent execution under PyGX's contextual overrides.
pg.algo PyGX's algorithm sub-packages.