🍰 ConnectMP - An easy and efficient way to share data between Processes in Python.

Overview

ConnectMP - Taking Multi-Process Data Sharing to the moon 🚀

Contribute · Community · Documentation


🎫 Introduction :

🍤 ConnectMP is the easiest and efficient way to share data between Processes. It's superfast, can handle big datas, can create multiple data connection and really simple to get started. 🍰

🥐 ConnectMP is created out of pure Frustration of not being able to find a good solution to comminucate between Processes 🥨

🥗 Installation :

via pip (recommended) :

pip install connectmp

🧇 Quickstart : (Docs)

Please read till the end to find what you're looking for!

🍤 connectmp.Process :

from connectmp import Process

This Process class is same as multiprocessing.Process, it's just modified. So, just use connectmp.Process where you would use multiprocessing.Process

import time
from connectmp import Process


def do_something(connection):
    connection.data = "Sending Some Data."


def track_data(connection):
    time.sleep(1)
    print(f"Track i: {connection.data}")


if __name__ == '__main__':
    p1 = Process(target=do_something, connection=True)
    p2 = Process(target=track_data, args=(p1.connection,))

    p1.start()
    p2.start()

Just let me explain what's happening here. we have 2 functions, one is do_something which just sends data and track_data which recieves the data and print's it. You can see in p1 we are not pasing any argument but our function do_something requires a connection argument.

When you enable Process(connection=True) Your target function will recieve a keyword-argument value named connection which's value will contain the Connection object. This Connection object is an individual connection. But You can of course share this connection with other process.

in p2 we shared the connection of our p1 by p1.connection which returns the connection object of p1. In track_data function we just recieve the data from p1.connection. You can send and recieve data from and to each other.

And yeah to send data all you do is assign the data to connection.data and also to get data you have to do it with connection.data

HOLD ON! You might also be looking for something like this down below!

So, if you're wondering if we can create Conenction seperately without creting Process object? 🎉 YES! YES YOU CAN! with:

🥨 connectmp.Connection

from connectmp import Connection

You can create your own Connection with this. Let me show you how:

from connectmp import Connection

connection = Connection()

that's it! 🎉 You can create multiple Connection! To use it just do it like how we did before, pass it as an argument and use it anywhere you want 🥂

NOTE: Make sure Process(connection=True) is not enabled, or it will conflict with your function params. turn Process(connection=True) when you want to create another Connection and get it in the function as an argument('connection').

🌮 Example:

import time
from connectmp import Process, Connection


def do_something(connection):
    connection.data = "Sending Some Data."


def track_data(connection):
    time.sleep(1)
    print(f"Track i: {connection.data}")


if __name__ == '__main__':
    conn = Connection()  # Creating connection
    
    p1 = Process(target=do_something, args=(conn,))
    p2 = Process(target=track_data, args=(conn,))

    p1.start()
    p2.start()

Now each Process can communicate with each other! That's all you need to know about ConnectMP. Hope this helped you 🎉

🌟 Back to Top

You might also like...
Application for easy configuration of swap file and swappiness priority in slackware and others linux distributions.

Swap File Program created with the objective of assisting in the configuration of swap file in Distributions such as Slackware. Required packages: pyt

Stubmaker is an easy-to-use tool for generating python stubs.

Stubmaker is an easy-to-use tool for generating python stubs. Requirements Stubmaker is to be run under Python 3.7.4+ No side effects during

VerSign: Easy Signature Verification in Python

VerSign: Easy Signature Verification in Python versign is a small Python package which can be used to perform verification of offline signatures. It a

A utility that makes it easy to work with Python projects containing lots of packages, of which you only want to develop some.

Mixed development source packages on top of stable constraints using pip mxdev [mɪks dɛv] is a utility that makes it easy to work with Python projects

Shypan, a simple, easy to use, full-featured library written in Python.

Shypan, a simple, easy to use, full-featured library written in Python.

Easy compression and extraction for any compression or archival format.
Easy compression and extraction for any compression or archival format.

Tzar: Tar, Zip, Anything Really Easy compression and extraction for any compression or archival format. Usage/Examples tzar compress large-dir compres

A collection of common regular expressions bundled with an easy to use interface.

CommonRegex Find all times, dates, links, phone numbers, emails, ip addresses, prices, hex colors, and credit card numbers in a string. We did the har

Regression Metrics Calculation Made easy

Regression Metrics Mean Absolute Error Mean Square Error Root Mean Square Error Root Mean Square Logarithmic Error Root Mean Square Logarithmic Error

A library for interacting with Path of Exile game and economy data, and a unique loot filter generation framework.

wraeblast A library for interfacing with Path of Exile game and economy data, and a set of item filters geared towards trade league players. Filter Ge

Releases(v1.1.0)
  • v1.1.0(Dec 24, 2021)

  • v1.0.0(Dec 24, 2021)

  • v0.1.1(Dec 22, 2021)

    🍩 What's new in ConnectMP v0.1.1 :

    • Now defaultly supports multithreaded Connection
    • Fixed some bugs
    • Added support for command 'connectmp'
    • Can change config with command
    Source code(tar.gz)
    Source code(zip)
  • v0.1.0(Dec 21, 2021)

    🧇 Official First Release Of ConnectMP

    • ConnectMP.Process
    • ConnectMP.Connection

    Share data between Processes.Share big data.Low latency.Ability to create Connection separately.Works in all System

    Source code(tar.gz)
    Source code(zip)
Owner
Aiden Ellis
Kon'nichiwa, you got my blessings 🥳
Aiden Ellis
Extract the download URL from OneDrive or SharePoint share link and push it to aria2

OneDriveShareLinkPushAria2 Extract the download URL from OneDrive or SharePoint share link and push it to aria2 从OneDrive或SharePoint共享链接提取下载URL并将其推送到a

高玩梁 262 Jan 8, 2023
A simple tool to move and rename Nvidia Share recordings to a more sensible format.

A simple tool to move and rename Nvidia Share recordings to a more sensible format.

Jasper Rebane 8 Dec 23, 2022
Library for processing molecules and reactions in python way

Chython [ˈkʌɪθ(ə)n] Library for processing molecules and reactions in python way. Features: Read/write/convert formats: MDL .RDF (.RXN) and .SDF (.MOL

null 16 Dec 1, 2022
NFT-Generator is the best way to generate thousands of NFTs quick and easily with Python.

NFT-Generator is the best way to generate thousands of NFTs quick and easily with Python. Just add your files, set your configuration and run the scri

null 78 Dec 27, 2022
A library to easily convert climbing route grades between different grading systems.

pyclimb A library to easily convert climbing route grades between different grading systems. In rock climbing, mountaineering, and other climbing disc

Ilias Antonopoulos 4 Jan 26, 2022
A way to write regex with objects instead of strings.

Py Idiomatic Regex (AKA iregex) Documentation Available Here An easier way to write regex in Python using OOP instead of strings. Makes the code much

Ryan Peach 18 Nov 15, 2021
A Python utility belt containing simple tools, a stdlib like feel, and extra batteries. Hashing, Caching, Timing, Progress, and more made easy!

Ubelt is a small library of robust, tested, documented, and simple functions that extend the Python standard library. It has a flat API that all behav

Jon Crall 638 Dec 13, 2022
A simple and easy to use Spam Bot made in Python!

This is a simple spam bot made in python. You can use to to spam anyone with anything on any platform.

null 7 Sep 8, 2022
A simple and easy to use collection of random python functions.

A simple and easy to use collection of random python functions.

Diwan Mohamed Faheer 1 Nov 17, 2021
Local backup made easy, with Python and shutil

KTBackup BETA Local backup made easy, with Python and shutil Features One-command backup and restore Minimalistic (only using stdlib) Convenient direc

kelptaken 1 Dec 27, 2021