Skip to main content

General Subprocess Proxy Object

Project description

Subproxy

General Subprocess Proxy Object.

Installation

Mostly targetting pip for package management for now:

pip3 install subproxy

Usage

Simplest example:

from subproxy import subproxy

class MyClass:
    pass

MyClassProxy = subproxy(MyClass)

# now MyClassProxy may be treated like `MyClass`,
# except when it doesn't work.

Also see the test file for a quick reference.

Limitations

While the proxy generally works, we do have to draw the line somewhere in transitioning between native objects and proxy objects.

Therefore, the below code would work:

MyClassProxy = subproxy(MyClass)
p = MyClassProxy()
p.a = 'b'
print(p.a) # 'b'

But the below code would not work:

MyClassProxy = subproxy(MyClass)
p = MyClassProxy()
p.a = {'a':0, 'b':1}
p.a['a'] = 1
print(p.a['a']) # still 0

This is because p.a would return a dict rather than a subproxy(dict).

Packaging

# opti
python3 setup.py sdist bdist_wheel
twine upload dist/*

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

subproxy-0.0.4.tar.gz (3.6 kB view hashes)

Uploaded Source

Built Distribution

subproxy-0.0.4-py3-none-any.whl (4.7 kB view hashes)

Uploaded Python 3

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