Decorators#

API reference for every code-generating decorator. For usage, options, and examples, see the corresponding User Guide page linked from each section.

@Data / data#

inito.Data#

Generate a constructor, __repr__, __eq__, __hash__, and get_/set_ accessors for every declared field. Accepts DataOptions (frozen, include_getters, include_setters).

Parameters:
Return type:

Any

class inito.DataOptions(frozen=False, include_getters=True, include_setters=True)[source]#

Configuration surface for the @Data decorator.

frozen=True skips setter generation and makes every field genuinely immutable: attribute assignment/deletion always raise dataclasses.FrozenInstanceError after construction, no @dataclass(frozen=True) stacking required.

Parameters:
  • frozen (bool)

  • include_getters (bool)

  • include_setters (bool)

Also exported as inito.data. Guide: @Data.

@Value / value#

inito.Value#

constructor, __repr__, __eq__, __hash__, and get_ accessors for every declared field - never setters. Attribute assignment and deletion always raise dataclasses.FrozenInstanceError after construction, unconditionally - no @dataclass(frozen=True) stacking required.

Type:

Generate a genuinely immutable data class

Parameters:
Return type:

Any

class inito.ValueOptions(include_getters=True)[source]#

Configuration surface for the @Value decorator.

Parameters:

include_getters (bool)

Also exported as inito.value. Generates a constructor, __repr__, __eq__, __hash__, and get_ accessors — never setters, and genuinely immutable (assignment/deletion raise dataclasses.FrozenInstanceError), with no @dataclass(frozen=True) stacking. Guide: @Value.

@Getter / getter#

inito.Getter#

Generate a get_<field>() accessor method for every declared field.

Parameters:
Return type:

Any

class inito.GetterOptions[source]#

Configuration surface for the @Getter decorator (no options yet).

Also exported as inito.getter. Guide: Accessors.

@Setter / setter#

inito.Setter#

Generate a set_<field>(value) mutator method for every declared field.

Parameters:
Return type:

Any

class inito.SetterOptions[source]#

Configuration surface for the @Setter decorator (no options yet).

Also exported as inito.setter. Guide: Accessors.

@ToString / to_string#

inito.ToString#

Generate a __repr__ listing every declared field.

Parameters:
Return type:

Any

class inito.ToStringOptions[source]#

Configuration surface for the @ToString decorator (no options yet).

Also exported as inito.to_string. Guide: @ToString.

@EqualsAndHashCode / equals_and_hash_code#

inito.EqualsAndHashCode#

Generate __eq__ and __hash__ over every declared field.

Parameters:
Return type:

Any

class inito.EqualsAndHashCodeOptions[source]#

Configuration surface for the @EqualsAndHashCode decorator (no options yet).

Also exported as inito.equals_and_hash_code. Guide: @EqualsAndHashCode.

@NoArgsConstructor / no_args_constructor#

inito.NoArgsConstructor#

Generate a no-argument __init__ that assigns every field its default. Every field must have a default or default_factory, or decoration raises InvalidFieldDefinitionError.

Parameters:
Return type:

Any

class inito.NoArgsConstructorOptions[source]#

Configuration surface for the @NoArgsConstructor decorator (no options yet).

Also exported as inito.no_args_constructor. Guide: Constructors.

@AllArgsConstructor / all_args_constructor#

inito.AllArgsConstructor#

Generate a constructor accepting every declared field.

Parameters:
Return type:

Any

class inito.AllArgsConstructorOptions[source]#

Configuration surface for the @AllArgsConstructor decorator (no options yet).

Also exported as inito.all_args_constructor. Guide: Constructors.

@RequiredArgsConstructor / required_args_constructor#

inito.RequiredArgsConstructor#

Generate a constructor accepting only fields without a default; defaulted fields still get their default value assigned.

Parameters:
Return type:

Any

class inito.RequiredArgsConstructorOptions[source]#

Configuration surface for the @RequiredArgsConstructor decorator (no options yet).

Also exported as inito.required_args_constructor. Guide: Constructors.

@Builder / builder#

inito.Builder#

Generate a nested fluent Builder class, a builder() classmethod, and (with to_builder=True) a to_builder() instance method. Accepts BuilderOptions (to_builder, setter_prefix, build_method_name, use_init). By default build() assigns fields directly, bypassing __init__ for speed; pass use_init=True to construct through the class’s own __init__ so a framework or hand-written constructor’s validation runs (e.g. Pydantic, SQLAlchemy, Django models).

Parameters:
Return type:

Any

class inito.BuilderOptions(to_builder=False, setter_prefix='', build_method_name='build', use_init=False)[source]#

Configuration surface for the @Builder decorator.

Parameters:
  • to_builder (bool)

  • setter_prefix (str)

  • build_method_name (str)

  • use_init (bool)

Also exported as inito.builder. Guide: @Builder.