Memory efficient Python objects
Project description
Atom is a framework for creating memory efficient Python objects with enhanced features such as dynamic initialization, validation, and change notification for object attributes. It provides the default model binding behavior for the Enaml UI framework.
Examples:
from atom.api import Atom, Str, Range, Bool, observe
class Person(Atom):
""" A simple class representing a person object.
"""
last_name = Str()
first_name = Str()
age = Range(low=0)
debug = Bool(False)
@observe('age')
def debug_print(self, change):
""" Prints out a debug message whenever the person's age changes.
"""
if self.debug:
templ = "{first} {last} is {age} years old."
s = templ.format(
first=self.first_name, last=self.last_name, age=self.age,
)
print(s)
def _default_first_name(self):
return 'John'
john = Person(last_name='Doe', age=42)
john.debug = True
john.age = 43 # prints message
john.age = 'forty three' # raises TypeError
Starting with atom 0.8.0 atom object can also be defined using type annotations.
from atom.api import Atom, observe
class InventoryItem(Atom):
"""Class for keeping track of an item in inventory."""
name: str
unit_price: float
quantity_on_hand: int = 0
def total_cost(self) -> float:
return self.unit_price * self.quantity_on_hand
@observe("unit_price")
def check_for_price_reduction(self, change):
savings = change.get("oldvalue", 0) - change.get("value")
if savings > 0:
print(f"Save ${savings} now on {self.name}s!")
>>> w = InventoryItem(name="widget", unit_price=1.99, quantity_on_hand=10)
>>> w.unit_price = 1.00
Save $0.99 now on widgets!
For version information, see the Revision History.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
atom-0.9.0.tar.gz
(161.0 kB
view hashes)
Built Distributions
atom-0.9.0-cp311-cp311-win_amd64.whl
(127.6 kB
view hashes)
atom-0.9.0-cp311-cp311-win32.whl
(114.5 kB
view hashes)
atom-0.9.0-cp310-cp310-win_amd64.whl
(127.6 kB
view hashes)
atom-0.9.0-cp310-cp310-win32.whl
(114.5 kB
view hashes)
atom-0.9.0-cp39-cp39-win_amd64.whl
(127.8 kB
view hashes)
atom-0.9.0-cp39-cp39-win32.whl
(114.7 kB
view hashes)
atom-0.9.0-cp38-cp38-win_amd64.whl
(127.7 kB
view hashes)
atom-0.9.0-cp38-cp38-win32.whl
(114.6 kB
view hashes)
Close
Hashes for atom-0.9.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86354fc6c5e65e8093fe5cafd0687f75cd4998eb4657f7805179703824607b82 |
|
MD5 | 0a785fe424b724bad2225583f117731e |
|
BLAKE2b-256 | 41d41f7d9ccf998f4e83ae2910b226c6cbdfa3f541356e4951cb5eb241fe1f40 |
Close
Hashes for atom-0.9.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4a95a694059d41e7492a99d3d88c289e7f95a14a84c0dd6b9d51773112af0fa8 |
|
MD5 | 46667d8d4a2b75d0675f171f7babf41e |
|
BLAKE2b-256 | 984b4146e3a2784aa58d0d3ee262c0f8d7bfeea41af82ec4fcdd1a5a6bf3d0ba |
Close
Hashes for atom-0.9.0-cp311-cp311-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bc7c14a1a94e8d2d315d0062f11bcb25aecbde78d48f26ac24daafadfff1bd25 |
|
MD5 | e7190b259e6af8f4c9bd42137b721f6a |
|
BLAKE2b-256 | 429a20621409d0d9baac935c5753c73c56c3dc1f40ede3d95fa73500cf061bec |
Close
Hashes for atom-0.9.0-cp311-cp311-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 722732a7d03617fa670d8feb3f0f3c22955ad88000d76ce67acd6da022268155 |
|
MD5 | f2b6db3af19a325bb425ab76275cae8d |
|
BLAKE2b-256 | 60758d6c46331421b8c6cbe755aa5f7a99ca982d54b3260fb72549cf03b2739e |
Close
Hashes for atom-0.9.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e6e8955c0d8e6ab6be9e5868c44380df39d4597fe88de24c4471e4853f22cfa |
|
MD5 | 60cc29aa2b3bc6fc007cf7fd9060727a |
|
BLAKE2b-256 | 2a30e0a682ad56a5b27c4ae12d9e711cd3a15497bf2c4590e0fe802a6289859d |
Close
Hashes for atom-0.9.0-cp311-cp311-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c588017a8665ec04bdaaaf559285acc144d5eb08b1e23ec2ee8e4ad74a8260aa |
|
MD5 | bf6c8923af95f8b60f64da751bc03201 |
|
BLAKE2b-256 | cac5069c706e2335c7ba7d96e4c2a755d52230d283639792633077538fa5424b |
Close
Hashes for atom-0.9.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d95f9c14a578bd8c081a8146b935ca31ed9aff534ef842c72d375e7f2c358011 |
|
MD5 | b1b7a0ee1a49e3b12d58973bb192ec94 |
|
BLAKE2b-256 | 627e05109b3354758184ad94f2c399bfa1a799d3a7ea8a883cab8900055b6b73 |
Close
Hashes for atom-0.9.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4ab209dc414ecfcc70bc78f3ef38df5d21cef610b60a7c86d62a66873627adf0 |
|
MD5 | 83fee098b04f0ac0faab05902945f4c4 |
|
BLAKE2b-256 | 90ceace47b0a4f69d95f4402c909bee153104870bc74c25ae5bf81d2658839e6 |
Close
Hashes for atom-0.9.0-cp311-cp311-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d380a5fd39f3bba7d9f1ed6d060848d0c6b513300dac3171f7c5a90ba1b77547 |
|
MD5 | f22495059ac3ab9d1fcaa9cfc541df15 |
|
BLAKE2b-256 | ac507e93adb58f2696e5e9b398ae4fdbaa9f0a00f9a2564e4aa40e943272d629 |
Close
Hashes for atom-0.9.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2935d68703aa63e14948beb84e1e6ed2cde734bf25ebca7ad21d8a758a2a86c6 |
|
MD5 | f46c7841842d21a0719c78e1fae6429c |
|
BLAKE2b-256 | 6343548b3be320bd2679c50b0acd14846ccc195b46a560d4848a526f4092e47f |
Close
Hashes for atom-0.9.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9461d3d0974c216df03936b5b32566d275f0387db4500a8214fb8ce36358c0ed |
|
MD5 | 376d1e588ce27175d47a23c8cc5b954e |
|
BLAKE2b-256 | ebb82767c89fd561353b07350f8f50bc146d9ce0264b3a73f5c0c287724319fe |
Close
Hashes for atom-0.9.0-cp310-cp310-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04ee6af0fbda17e61b54e079319b40854777c33baf0131b44e836ca436f95dde |
|
MD5 | 59bebe9b53f89f8975aeced4e38a17ad |
|
BLAKE2b-256 | e988e33ce7178e4f5a4c31030700b207b17a5a478eccd03e8cc10474ff37b057 |
Close
Hashes for atom-0.9.0-cp310-cp310-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 29be699710169d7cd435f799e025004e1c7a3714a26cea26e94c361c62d084f9 |
|
MD5 | 98191b1d4d67543c78dc47874f4d1802 |
|
BLAKE2b-256 | ad003843bbdd526778be3b8a7b8c5b7a56f6ed487eb937ba999680cf86fffe5b |
Close
Hashes for atom-0.9.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cc4c22e54ef61eb3fb807a9b6ed7296eaf99ef382bce17ef32508e6312ea7657 |
|
MD5 | eb56785475bfc921d8db70bca4a92a67 |
|
BLAKE2b-256 | 4e9ce03a576630579798611a7e43ef417662420bb862493166fbb8b933c6b244 |
Close
Hashes for atom-0.9.0-cp310-cp310-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81294e11b8a37ab88d397a605361915c8e5fe9c51fc039754203816f3f3e3ef9 |
|
MD5 | a1860ee1af13e407da397b96b4036c9c |
|
BLAKE2b-256 | bf34b90204b9d10f3ae62213f0132e09152715f0737eee610f12fff757478b93 |
Close
Hashes for atom-0.9.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1486ad46e8556b76a8e7e8cbd07b16561b5061acb9c57f528c31d7d419940a25 |
|
MD5 | 2aea2a61c8dd0dc72748ada0eb7635b8 |
|
BLAKE2b-256 | 240f38719cd7f084ffad2f65efc923962ae17b5d591e74db8b662d27dc81673f |
Close
Hashes for atom-0.9.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 884725b994148b222a8c36348cf578bf52d51d55a564ca86fe7a2a10f63d6f41 |
|
MD5 | 3a8abc2dd17427c951bcecfe1a467ef2 |
|
BLAKE2b-256 | e705f805531b761d9aceb24477180157f6374f4b15dfe28adc45adcf7d3217a2 |
Close
Hashes for atom-0.9.0-cp310-cp310-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7cc258be2fc375f41b497629c740af1910d8a932533fc4abcc61b62891674acb |
|
MD5 | e41bffb20fe6e9a57a5031307eefdbfb |
|
BLAKE2b-256 | 7858ff8f9e201cf4c200ebc68b35e252232410227fb68597bd934dba167e62f2 |
Close
Hashes for atom-0.9.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 74ac899d097231de2d79b83d246ada11eff4c1a9f1bd9dfb3d389ba5abfc34ab |
|
MD5 | ac0e8d3b6fa3640664f416085987a111 |
|
BLAKE2b-256 | 140ae5c24ba22986edcdcfb9b14b87aea7260a8d6f535b8cca6e2610c18c610a |
Close
Hashes for atom-0.9.0-cp39-cp39-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d4a7ee9ac08ced190ebee2586d58df0307f32490bf2260d6fe118a704e9dc7c6 |
|
MD5 | 83b2f3fcef1ba354b81bc4988f3f9804 |
|
BLAKE2b-256 | 31f72cea55579e020b47a21a90a01ca75b84694742589b9e76824cdc1400af48 |
Close
Hashes for atom-0.9.0-cp39-cp39-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e4be0b10038d5f4b0c53375f95f85421f520afcb98cf023d8910c1bd8ce18e9 |
|
MD5 | f86da9383c3b1dc7cf9dfd2861919f4f |
|
BLAKE2b-256 | 28d65977e446e13d6630501a8b5f26950a0e2f9fc539b877ef639d61e88945b4 |
Close
Hashes for atom-0.9.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e70c357087c1033374ad5f46c720bbf30cc31a20da2fe0df83ea2c27c718e118 |
|
MD5 | 521c8095366fcf25250032559e468f5a |
|
BLAKE2b-256 | 7ec1922f8fb176924962366945945899686c6b2baf1e67c6faf4e04c7224ed99 |
Close
Hashes for atom-0.9.0-cp39-cp39-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58368093a862bbc18d926d4efff986d2b955c798c04691e0c5a6ce992515c325 |
|
MD5 | 824f0127a578a2624600dfe5f08f388c |
|
BLAKE2b-256 | c2ff27e69a21ab12a4680abb22b4e3cd932de961c4ad90c5b12bbfcd78490a09 |
Close
Hashes for atom-0.9.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 345639dd9f727dbbd4372ffa706c6d59ddadd111592f1a129581a63510b5b805 |
|
MD5 | 84f16da3fbd02f21524fab2dfc11c32f |
|
BLAKE2b-256 | bca77aae731130f525015446f8c4d424351e868145ede9a620fd3f132d2dea6a |
Close
Hashes for atom-0.9.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 45c032c2c4e5bd0b78abe6738a2adf8f6c2f0c60cbe7af4b8d3045d014948e63 |
|
MD5 | 48640aa2f5f55bf5b189a87fb13f121f |
|
BLAKE2b-256 | e0a820be467e103489946b921824290649524c4a2051ab464d489169da1f6d62 |
Close
Hashes for atom-0.9.0-cp39-cp39-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa42af0793a18796fb6328893491cb25e9f4ecb96bb41e6abb6a8efc48fcab6b |
|
MD5 | 2673aa08af82a5e26170347bc03e73a4 |
|
BLAKE2b-256 | fccf46ca4c499fb49f5711b3c59ca5474bb8142186b9b0f009827c0db8258a35 |
Close
Hashes for atom-0.9.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81b0bd8077c36aa54e9df1bae8647d100983e7cf762b9f0eba15c1d8ce990dcc |
|
MD5 | 013afc0e2fd412f85ca06dce3cb4ec9c |
|
BLAKE2b-256 | 6c5c7470a1ce3249399f7841fbfe7d165b319057ffd35e4ab2691d3ec4457e4d |
Close
Hashes for atom-0.9.0-cp38-cp38-musllinux_1_1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | de0687e394eb65ab9501d17595e2a6b9c23ff0f862682752148bae9b1eb33931 |
|
MD5 | 8e3fd5e52b05c838041e21c79d1ed8cb |
|
BLAKE2b-256 | f78bd46e79c639835191faa1633e48d6d1c9379a841a76f02ff5d7e8d99d2405 |
Close
Hashes for atom-0.9.0-cp38-cp38-musllinux_1_1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0a3a40579949eeb06594723802f024ad6c140dd2848114f27e3929a8c5fcdf3 |
|
MD5 | 34978e9eb22ee2cd201e15a13093ec21 |
|
BLAKE2b-256 | 432894fe0d3f20341dec2f5bee06d65b5e5b05af4757a69a5538a09a0e186ef9 |
Close
Hashes for atom-0.9.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 068aa8953b06752aec24c3a9bf6afe84e659868ae7b5579f00931cde332548b0 |
|
MD5 | d4afc55db12ba188cd9a43d70099c5c7 |
|
BLAKE2b-256 | 2ffea8ace635bbd835e60ecadd2ce918e769b19a8501e0bea3161a4c6e82b4e3 |
Close
Hashes for atom-0.9.0-cp38-cp38-manylinux_2_12_i686.manylinux2010_i686.manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 85da3901f1acbe8c4e2d5427b74be3b9dd3139566aa9c5f6f90f4e548df72832 |
|
MD5 | 4c28d5a4bfde565cf816f818e0258cf9 |
|
BLAKE2b-256 | e04afc9ab63fdeebab425c2fe02372a23d49fb4c703888f0d1cad1ca4512d3ca |
Close
Hashes for atom-0.9.0-cp38-cp38-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f9becf5d0cae7d24a57316d8d44e8a4180919144b4fc8e80cf4a2f3c0309da1 |
|
MD5 | 336198068e5eaac0baa14aed8ebdcab4 |
|
BLAKE2b-256 | d157a96d5f1d01a9ce8f46afee2871da9e5db35bb5a4291a7162a788970324df |
Close
Hashes for atom-0.9.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 02fd70ea339916f5d8557db41d94b42be21a2446d064c1865ebbfd21ae9f5802 |
|
MD5 | 1e1463e5630f6d70c3c97f2e8d25ccf0 |
|
BLAKE2b-256 | 2c259259e94fbc3e9a74259a121fd0ba3dfd3cd153368d1337db72124dae0707 |
Close
Hashes for atom-0.9.0-cp38-cp38-macosx_10_9_universal2.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | baa9b4541eed0b4b1bb6c31c62c54cae8c3fca8ccce021e495c16fe495a458fe |
|
MD5 | 1232c520c797d8efe2f2247bd31d82c2 |
|
BLAKE2b-256 | a589421d1ddaaf92775e29deaa9b874966b717fa786c71302e0f4a28d133904a |