Skip to content

OpenHCSDev/uneval

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

62 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

uneval

Python source code as a serialization format with automatic import resolution.

Quick Start

from uneval import Assignment, generate_python_source
from dataclasses import dataclass

@dataclass
class Config:
    name: str = "default"
    value: int = 42

config = Config(name="production", value=100)
code = generate_python_source(Assignment("config", config), clean_mode=True)
print(code)
# Output:
# from __main__ import Config
# config = Config(name='production', value=100)

Why Python Source?

Format Diffable Inspectable Editable Type-preserving Cross-version
pickle
JSON/YAML
Python source

Binary formats like pickle cannot be diffed, inspected, or edited. Text formats like JSON lose type information. Python source code has all desired properties: it is diffable, inspectable, editable, type-preserving, and cross-version stable.

Features

  • Complete Executable Source: Generates imports + code, not just expressions
  • Type-Preserving: Enums, Paths, callables serialize as themselves
  • Collision Handling: Automatic aliasing for name collisions across modules
  • Clean Mode: Omit fields matching defaults for concise output
  • Extensible: Register custom formatters for domain-specific types

Documentation

Full documentation available at uneval.readthedocs.io

Installation

pip install uneval

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •