Collection of frequently used utility functions
Project description
LibInfilect
Utility library for internal usage @ Infilect
Installation
Use pip install --upgrade libinfilect
to install the latest version.
Contribution
Feel free to add your modules to this library so that it can be used by all team members and maximise code reusability. Make sure to follow these guidelines while contributing.
- Document your code. Try to follow standard documentation practices mentioned here.
- Test your code thoroughly.
- Provide sample usage examples/quickstart guide in documentation. I have provided an example below for the interface module.
Interface
Interface repo that contains all the helper functions for creating interfaces between
backend servers and frontend clients. This contains creation and maintenance of TCP sockets.
If you are writing a server side module, you will use the Server class as follows.
from libinfilect import interface
import json
server_socket = interface.Server(ip='0.0.0.0',port=4242)
server_socket.create_socket()
while True:
query = server_socket.start_listening()
query = json.loads(query.decode('utf-8'))
result = do_your_machine_learning_thing_and_produce_results(query)
server_socket.respond(json.dumps(result))
The server socket will be automatically closed once server_socket object goes out of context
If you are witing client side module, you will use the Client class as follows.
from libinfilect import interface
import json
client_socket = interface.Client(ip='127.0.0.1',port=4242)
results = client_socket.send_query_and_await_results(json.dumps({"query_key":"query_value"}))
This will take care of adding newline character for socket delimiter so no need to add extra newlines.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for libinfilect-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6bc6b75fd383f0b73919ad683b1c2c94564a00f0cf73d1abbf7db68ad08f74a3 |
|
MD5 | c4746a96ab152de90a2d4e7eff970dea |
|
BLAKE2b-256 | ad06ec29730153a5d73347aeec32ea132c0ad912215490c03f55813b6a0548c4 |