Skip to main content

Parent Aware

Build Status

A decorator to make objects aware of their parent objects. Particularly useful with dataclasses!

Example

import dataclasses
from parent_aware import parent_aware

@parent_aware
@dataclasses.dataclass
class Child:
    num: int

@parent_aware
@dataclasses.dataclass
class Parent:
    child: Child

c = Child(2)
p = Parent(child=c)

# Automatically a .parents was added on the child!
assert c.parents == [p]

# If you didn't want .parents, use @parent_aware(parents_name='give_a_name_here')

Installation

pip install parent_aware

Metadata

Release files for parent-aware 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for parent-aware 0.0.1
File Size Uploaded
parent_aware-0.0.1.tar.gz 3.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for parent-aware 0.0.1
File Interpreter ABI Platform
parent_aware-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 8.3 kB

Release files / parent_aware-0.0.1.tar.gz

Download URL parent_aware-0.0.1.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
8de0087c563e6f3c76db195c31c508f2e1ba807b918f14671e6aa45090c14f6c
BLAKE2b-256 checksum
How to use checksums
37d19734f94373727677050c07fb8f36f3206d6a96e428b0d07dc141eb6781e4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release files / parent_aware-0.0.1-py3-none-any.whl

Download URL parent_aware-0.0.1-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9b7263be816ec10deed2bb46f9e9ed4a898a7e54270715ae7cfd349bc14f670d
BLAKE2b-256 checksum
How to use checksums
d8b96f79ed56d6766988f5fd91090b80351b88c690e0835a2145046db0d46fa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page