Metadata-Version: 2.1
Name: ipc-purepy
Version: 0.1.0
Summary: Allow sent core Python objects between two likely independent Python processes using UNIX sockets.
Author-email: Michel Novus <michelnovus@gmail.com>
License: MIT License
        
        Copyright (c) 2023 Michel Novus
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Repository, https://github.com/michelnovus/ipc-purepy
Keywords: unix socket,ipc,process communication,simple,python primitives
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Operating System :: POSIX :: Linux
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE

# IPC PurePy

The package allow sent core Python objects between two likely independent 
Python processes using UNIX sockets.

It provides a Server class (`Server`), a Client function 
(`communicate`), and a `PyCoreObject` type alias.

### PyCoreObject alias:
It's a type alias defined as the union of the basic types of Python language
(`str`, `int`, `float`, `bool`, `None`) and common collections
(`list[PyCoreObject]` and `dict[str, PyCoreObject]`).  
The dict type key must be are str type and value are PyCoreObject.

### function is_pycoreobject(object: Any) -> bool:
This recursive function allows to check if the object passed to it 
is a valid PyCoreObject.

### class Server(socket_path: str):
The class defines the server socket as a context handler. Through the 
wait_connection() method it waits for some external connection and returns 
the PyCoreObject sent to it.  
The connection to the client is expected to be closed with the 
close_connection() method.  
Server class implements the reply() method that allows to send a 
PyCoreObject to the client if the connection is alive.

### function communicate(socket_path: str, data: PyCoreObject) -> PyCoreObject:
Client endpoint to communicate with the server socket, send data to 
server socket and expect receive a response from it.
