Skip to main content

No project description provided

Project description

ipcq

A simple inter-process communication (IPC) Queue built on top of the built-in library multiprocessing.

Quick Start

Server

import ipcq


with ipcq.QueueManagerServer(address=ipcq.Address.DEFAULT, authkey=ipcq.AuthKey.DEFAULT) as server:
    server.get_queue().get()

Client

import ipcq


client = ipcq.QueueManagerClient(address=ipcq.Address.DEFAULT, authkey=ipcq.AuthKey.DEFAULT)
client.get_queue().put('a message')

Please checkout out the examples folder for more examples.

API

class ipcq.QueueManagerServer(address: Optional[str], authkey: Optional[bytes])

This class inherits multiprocessing.managers.BaseManager.

address can be ipcq.Address.AUTO, ipcq.Address.CWD or any other path described in str. When it's given ipcq.Address.AUTO, a random address will be chosen. ipcq.Address.CWD means using a file that lives in the current working directory.

authkey is just like the password for authentication. It can be ipcq.AuthKey.AUTO, ipcq.AuthKey.DEFAULT, ipcq.AuthKey.EMPTY or any other arbitrary bytes.

def get_queue(ident: Union[AnyStr, int, type(None)] = None) -> queue.Queue

The method returns a queue.Queue corresponding with ident. The returned queue is shared between the server and the client. So both the server and the client access to the same queue.

ident is the identity, it can be any string-like object, int or None. The default is None. It is used for differetiate the obtained queues. Different idents refer to different queues.

class ipcq.QueueManagerClient(address: Optional[str], authkey: Optional[bytes])

This class inherits multiprocessing.managers.BaseManager.

address can be ipcq.Address.CWD or any other path described in str. When the server is set with ipcq.Address.CWD and the client is running in the same CWD that the server runs, the client can be set with ipcq.Address.CWD as well. Otherwise, it should be the same with the address field in the server instance.

authkey is just like the password for authentication. It has to be the same with what's set on the server . If the server was set with ipcq.AuthKey.DEFAULT or ipcq.AuthKey.EMPTY, the client can just be set with the same.

def get_queue(ident: Union[AnyStr, int, type(None)] = None) -> queue.Queue

The method returns a queue.Queue corresponding with ident. The returned queue is shared between the server and the client. So both the server and the client access to the same queue.

ident is the identity, it can be any string-like object, int or None. The default is None. It is used for differetiate the obtained queues. Different idents refer to different queues.

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

ipcq-1.1.3.tar.gz (8.3 kB view details)

Uploaded Source

File details

Details for the file ipcq-1.1.3.tar.gz.

File metadata

  • Download URL: ipcq-1.1.3.tar.gz
  • Upload date:
  • Size: 8.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Windows/10

File hashes

Hashes for ipcq-1.1.3.tar.gz
Algorithm Hash digest
SHA256 87a6c391359437d54a34c39be13f94c9152bf4e82396c17f0d85bca74fa75827
MD5 0da66f41b91d1ea8d70c247a5d369280
BLAKE2b-256 579613efe5d9e8f1ad50f3e9ffd733d1a58ff094048f604ed2388705306dc715

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