Skip to main content

Define fields simply

Project description

pyfieldlib

pyfieldlib library is used to define fields in a simple way.

Install

pip install pyfieldlib

Examples

from pyfieldlib import *


class Human(metaclass=FieldMeta):
    _age = 19
    
    @fields
    def is_mammal(self):
        return True
    
    @fields
    def age(self):
        return Human._age

    @age.setter
    def age(self, value):
        Human._age = value


# get
print(Human.age)  # 19
print(Human.is_mammal)  # True

# set
Human.age = 20
print(Human.age)  # 20
Human.is_mammal = False  # Error

Copyright

Copyright 2023. DuelitDev all rights reserved.

License

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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

pyfieldlib-1.0.1-py3-none-any.whl (2.8 kB view details)

Uploaded Python 3

File details

Details for the file pyfieldlib-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyfieldlib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for pyfieldlib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fd8fe274e15ed19f92bd2b372f5e54c0a1e918e1930787e4c00379913ccdc4e9
MD5 7c8445b6630fa5466dea115718a7b103
BLAKE2b-256 b40428b8b5e002ecb2b4a90cf1bb2d33fe212abe840ca1d240b952ff939d22d6

See more details on using hashes here.

Supported by

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