Skip to main content

Dynamic python object access & manipulation across threads/processes.

Project description

shareable

alt text alt text

Dynamic python object access & manipulation across threads/processes

Installation: requires python3.8+

pip install shareable

Example:

# make a test class:
class Test:
    def __init__(self, name, age):
        self.name = name
        self.age = age
        
    def get_details(self):
        return self.name, self.age

# in terminal 1
>>> from shareable import Shareable
>>> test = Test('DB Cooper', 50)
>>> s = Shareable(test)
>>> s
'Shareable(DB Cooper, 50)'

# in terminal 2: 
>>> from shareable import Shareable
>>> s = Shareable()
'Connection established'
>>> print(s['name'])
'DB Cooper'
>>> s['name'] = 'new name'

# back in terminal 1:
'Connection established'
>>> print(s['name'])
'new name'
>>> print(s.methods())
'["age", "get_details", "name"]'

Support for complex objects:

>>> import pandas as pd
>>> import numpy as np
>>> df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
>>> s = Sharedable(df)
>>> s['info']()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 100 entries, 0 to 99
Data columns (total 4 columns):
 #   Column  Non-Null Count  Dtype
---  ------  --------------  -----
 0   A       100 non-null    int64
 1   B       100 non-null    int64
 2   C       100 non-null    int64
 3   D       100 non-null    int64
dtypes: int64(4)
memory usage: 3.2 KB

# terminal 2:
>>> s = Shareable()
'Connection established'
>>> s['columns']
Index(['A', 'B', 'C', 'D'], dtype='object')

Gracefully handles resources on keyboard or explicit exit:

>>> s = Shareable()
>>> exit()
'Destroyed shared resources'
'Killed all child processes'

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

shareable-0.6a0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

shareable-0.6a0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file shareable-0.6a0.tar.gz.

File metadata

  • Download URL: shareable-0.6a0.tar.gz
  • Upload date:
  • Size: 7.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.1

File hashes

Hashes for shareable-0.6a0.tar.gz
Algorithm Hash digest
SHA256 683ed99fe88c81f94f681bdc6d1ee3afa44d8ca48add30356ba879af12b12249
MD5 7a04712d57340b7f2bf2cafe5d45a1dd
BLAKE2b-256 39a11166a6bc27f02d5495760808b695b361fdafefcd85788927e091e85657b4

See more details on using hashes here.

File details

Details for the file shareable-0.6a0-py3-none-any.whl.

File metadata

  • Download URL: shareable-0.6a0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.1

File hashes

Hashes for shareable-0.6a0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f6e4d974e14daf015938a69dc64a9c385cb0bde39c94fbc44cc402d26658b40
MD5 23e2c68cb260cf312379afd26f7a399a
BLAKE2b-256 45865b7f961bf0107988af2edb776a843130fa168db6b2f77619e67076f68f30

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