Utilities for developing an MLsploit python module.
Project description
This package contains utilities for developing an MLsploit python module.
Setup
To install this package on your system using pip, run the following command:
$ pip install mlsploit-py
Usage
This package supports automatic loading of MLsploit jobs inside your module.
# your_mlsploit_module.py
from mlsploit import Job
# load input files and user defined options
Job.initialize()
function_name = Job.function_name # the function name the user wants to run
input_file_items = Job.input_file_items # you can load input_file_items[i].path
options = Job.options # can access options.option1, option.option2 for function_name
# ...
# do stuff based on the information above ...
# ...
# when you're done, you can reserve output files
# that will be uploaded to MLsploit
output_file_item = Job.reserve_output_file_item(
output_file_name='output_file.txt', is_new_file=True)
with open(output_file_item.path, 'w') as f:
pass # ... write data to your output file here
# you can also add tags to your output file
# as defined in your module schema
output_file_item.add_tag(name='tagname', value='tagvalue')
# you can add several output files in the above manner
# when you're done done, don't forget to commit the output!
Job.commit_output() # mlsploit-py will take care of the rest
You can also use this package to programmatically create your MLsploit module configuration file (mlsploit_module.yaml
)
instead of editing it manually. This will also validate your MLsploit module for errors.
For more information on the configuration file schema,
see here.
# make_dummy_module.py
from mlsploit import Module
module = Module.build(
display_name='Dummy Module',
tagline='This is a dummy module!',
doctxt="""Long documentation for this module will go here...""",
icon_url='https://somedomain.org/icon.jpg')
function = module.build_function(
name='Test Function',
doctxt="""Some long ducumentation of Test Function...""",
creates_new_files=True,
modifies_input_files=False,
expected_filetype='txt',
optional_filetypes=['rtf', 'ans'])
function.add_option(
name='option1',
type='str',
doctxt="""Some long ducumentation of option1...""",
required=True)
function.add_output_tag(name='tag1', type='str')
function.add_output_tag(name='tag2', type='int')
# you can add several functions and function options in the above manner
# once you're done, the following command will save the mlsploit_module.yaml
# in the same directory as this file
module.save()
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
mlsploit-py-0.1.3.tar.gz
(13.6 kB
view details)
File details
Details for the file mlsploit-py-0.1.3.tar.gz
.
File metadata
- Download URL: mlsploit-py-0.1.3.tar.gz
- Upload date:
- Size: 13.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a386f7f4983d7a19bf4f62751bfa381f99949685108ede47bc00b738679b3e5 |
|
MD5 | e93c3e748356530f30a68307186be661 |
|
BLAKE2b-256 | f052c0ffe0a470fa4be377ad52ddd7d41e057a108053e563f9ab116acacc2c09 |