Skip to main content

Instance builder library for Python inspired by Lombok

Project description

Instance-Builder - Instance builder library for Python inspired by Lombok

Python Versions PyPI version CI

Installation

pip install instance-builder

Usage

Builder

@builder("id", "name", "age", "email")
class User:
    def __init__(self, id: int, name: str, age: int, email: str) -> None:
        self.id = id
        self.name = name
        self.age = age
        self.email = email

user = User.Builder().id(0).name("Shuntaro Shimizu").age(99).email("ut.s.shimizu@gmail.com").build()

Getter

@getter
class User:
    __id: int = 0
    __name: str = "Shuntaro Shimizu"

user = User()
user.get_id()  # 0
user.get_name()  # "Shuntaro Shimizu"

Setter

@setter
class User:
    __id: int = 0
    __name: str = "Shuntaro Shimizu"

user = User()
user.set_id(1)  # user._User__id == 1
user.set_name("New Name")  # user._User__name == "New Name"

© Copyright 2021 to Shuntaro Shimizu, under the MIT license

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instance-builder-0.1.8.tar.gz (3.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

instance_builder-0.1.8-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file instance-builder-0.1.8.tar.gz.

File metadata

  • Download URL: instance-builder-0.1.8.tar.gz
  • Upload date:
  • Size: 3.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.4 Darwin/20.5.0

File hashes

Hashes for instance-builder-0.1.8.tar.gz
Algorithm Hash digest
SHA256 3f3ad2b176c28d83f841d07b142d7b24d8543c0a2166196d5fc3596ee0006f33
MD5 83900f10f45cbddefbb141fdea7b3edd
BLAKE2b-256 034619c3cac56c33c580065ac4b56bd3dc61b90543c58881b9f3438d5c81edf7

See more details on using hashes here.

File details

Details for the file instance_builder-0.1.8-py3-none-any.whl.

File metadata

  • Download URL: instance_builder-0.1.8-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.9.4 Darwin/20.5.0

File hashes

Hashes for instance_builder-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 dcf9da9228ec7b6bea2b2d0e278b723111edf31fcb4cb58e9d284055c3b6e036
MD5 a969309d448dd4036b64b2a7bfaf7b27
BLAKE2b-256 d6bfd1e13cd5b9d02023b505c7015684e2d02ce17b8d1cfee7656d217d8f5c09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page