InitO#
Boilerplate elimination for Python — Lombok-inspired, zero-dependency.
InitO generates constructors, repr, equality/hashing, accessors, and fluent
builders once at class-decoration time — never at instance construction or
attribute-access time — so the generated classes perform like handwritten
ones.
from inito import Data
@Data
class User:
name: str
age: int = 0
# @Data wrote __init__, __repr__, __eq__, __hash__, get_name/set_name, ...
user = User("Ada", age=30)
print(user) # User(name='Ada', age=30)
print(user.get_name()) # Ada
Install InitO and tour every decorator in a few minutes.
Task-oriented docs: a dedicated page per decorator, plus DI, recipes, and migration.
Every decorator, option, and exception, generated from the source.
The boilerplate problem InitO solves — and how it stays fast.
Wire object graphs with @Service/@Singleton/@Inject and a Container.
Real-world, copy-pasteable patterns combining several decorators.
Why InitO#
Real methods, generated once. Each decorator builds true Python functions from source at decoration time and attaches them to the class — no
__getattr__, proxies, or descriptors. At runtime your objects are ordinary instances, so construction, attribute access,==, andhash()run at handwritten speed.Pick exactly what you need.
@Datais the all-in-one, but every capability is also a standalone decorator (@Getter,@ToString,@EqualsAndHashCode, …), matching Lombok’s à-la-carte style.Composes with the standard library. Stack any decorator with
@dataclass;@Builderand the accessors work on plain classes too.Typed. A bundled mypy plugin makes
mypy --strictsee every generated member;@Data/@Value/@AllArgsConstructoralso type-check under pyright via adataclass_transformstub.Batteries for services. A small dependency-injection layer (
@Service/@Singleton/@Inject+ aContainer) wires constructors together lazily and thread-safely.
Decorators at a glance#
Decorator |
Generates |
|---|---|
|
constructor, |
|
like |
|
|
|
|
|
|
|
zero-argument constructor using each field’s default |
|
constructor taking every field |
|
constructor taking only fields without a default |
|
fluent |
|
dependency injection via a |
Every PascalCase decorator has a lowercase alias (data, builder, …)
bound to the same object.