Skip to main content

Python Dictionary Transfer Protocol

pydtp is a package defining a protocol for transparently accessing a remote server with function calls passing lightweight arguments.

pydtp defines three classes:

  • a Server class based on socketserver.TCPServer
  • an abstract Handler class to implement to define the Server-responses
  • an abstract Client class to implement to define the Client interface

The functions implemented on the Client class are redirected to the server class encoding the arguments and the return value in the most transparent way.

Dependencies

The package is developed for Python3.

The package requires numpy plus the standard python libraries for both the client and server sides.

Example

Define the client implementing two functions, that just redirect the functions to the query:

import pydtp 

class SimpleClient (pydtp.Client) :
  def add_one ( self, num ):
    return self.query ( 'add_one', [num] ) 

  def capitalize ( self, *strings):
    return self.query ( 'capitalize', [strings] ) 

The query function hides the complexity and allow to call functions implemented in a Handler:

import pydtp 

class SimpleHandler (pydtp.Handler):
  def add_one ( self, num ):
    return num + 1 

  def capitalize ( self, strings ):
    return {k: k.capitalize() for k in strings} 

The server is then instantiated and started on localhost and on a port.

server = pydtp.Server ( ('localhost', 12345), SimpleHandler )
server.start() 

The client class is instantiated indicating the address and the port

client = SimpleClient ( ('localhost', 12345) ) 
client.add_one ( 3 ) ## == 4
client.capitalize ( 'test' ) ## == "Test"

Metadata

Release files for pydtp 0.1.1

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

Built distribution (wheel)

Table of built distributions (wheels) for pydtp 0.1.1
File Interpreter ABI Platform
pydtp-0.1.1-py3-none-any.whl Python 3 none any Details

Release files / pydtp-0.1.1-py3-none-any.whl

Download URL pydtp-0.1.1-py3-none-any.whl
Size 5.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
75a5b0a3dd1c52bca27040ceed8e279294194ef0ef13a2bb0064f071818b344b
BLAKE2b-256 checksum
How to use checksums
3fa5e94d7ac0239266e8c04ef8fb2e55dda3212089e2257e5cc802e62669f3d3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.3

Security for pydtp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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