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()
Release files for mlsploit-py 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mlsploit-py-0.1.3.tar.gz | 13.6 kB | Details |
Release files / mlsploit-py-0.1.3.tar.gz
| Download URL | mlsploit-py-0.1.3.tar.gz |
|---|---|
| Size | 13.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5a386f7f4983d7a19bf4f62751bfa381f99949685108ede47bc00b738679b3e5
|
|
BLAKE2b-256 checksum How to use checksums |
f052c0ffe0a470fa4be377ad52ddd7d41e057a108053e563f9ab116acacc2c09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is 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
|