๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
Book a DemoInstallSign in
Socket

rdetoolkit

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rdetoolkit

A module that supports the workflow of the RDE dataset construction program

1.2.0
PyPI
Maintainers
1

GitHub Release python.org MIT License Issue workflow coverage

ๆ—ฅๆœฌ่ชžใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆ

RDEToolKit

RDEToolKit is a fundamental Python package for creating workflows of RDE-structured programs. By utilizing various modules provided by RDEToolKit, you can easily build processes for registering research and experimental data into RDE. Additionally, by combining RDEToolKit with Python modules used in your research or experiments, you can achieve a wide range of tasks, from data registration to processing and visualization.

Documents

See the documentation for more details.

Contributing

If you wish to make changes, please read the following document first:

  • CONTRIBUTING.md

Install

To install, run the following command:

pip install rdetoolkit

Usage

Below is an example of building an RDE-structured program.

Create a Project

First, prepare the necessary files for the RDE-structured program. Run the following command in your terminal or shell:

python3 -m rdetoolkit init

If the command runs successfully, the following files and directories will be generated.

In this example, development proceeds within a directory named container.

  • requirements.txt
    • Add any Python packages you wish to use for building the structured program. Run pip install as needed.
  • modules
    • Store programs you want to use for structured processing here. Details are explained in a later section.
  • main.py
    • Defines the entry point for the structured program.
  • data/inputdata
    • Place data files to be processed here.
  • data/invoice
    • Required even as an empty file for local execution.
  • data/tasksupport
    • Place supporting files for structured processing here.
container
โ”œโ”€โ”€ data
โ”‚   โ”œโ”€โ”€ inputdata
โ”‚   โ”œโ”€โ”€ invoice
โ”‚   โ”‚   โ””โ”€โ”€ invoice.json
โ”‚   โ””โ”€โ”€ tasksupport
โ”‚       โ”œโ”€โ”€ invoice.schema.json
โ”‚       โ””โ”€โ”€ metadata-def.json
โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ modules
โ””โ”€โ”€ requirements.txt

Implementing Structured Processing

You can process input data (e.g., data transformation, visualization, creation of CSV files for machine learning) and register the results into RDE. By following the format below, you can incorporate your own processing into the RDE structured workflow.

The dataset() function should accept the following two arguments:

  • srcpaths (RdeInputDirPaths): Paths to input resources for processing
  • resource_paths (RdeOutputResourcePath): Paths to output resources for saving results
def dataset(srcpaths: RdeInputDirPaths, resource_paths: RdeOutputResourcePath):
    ...

In this example, we define a dummy function display_messsage() under modules to demonstrate how to implement custom structured processing. Create a file named modules/modules.py as follows:

# modules/modules.py
def display_messsage(path_list):
    print(f"Test Message!: {path_list}")

def dataset(srcpaths, resource_paths):
    display_messsage(srcpaths)
    display_messsage(resource_paths)

About the Entry Point

Next, use rdetoolkit.workflow.run() to define the entry point. The main tasks performed in the entry point are:

  • Checking input files
  • Obtaining various directory paths as specified by RDE structure
  • Executing user-defined structured processing
import rdetoolkit
from modules.modules import dataset  # User-defined structured processing function

# Pass the user-defined structured processing function as an argument
rdetoolkit.workflows.run(custom_dataset_function=dataset)

If you do not wish to pass a custom structured processing function, define as follows:

import rdetoolkit

rdetoolkit.workflows.run()

Running in a Local Environment

To debug or test the RDE structured process in your local environment, simply add the necessary input data to the data directory. As long as the data directory is placed at the same level as main.py, it will work as shown below:

container/
โ”œโ”€โ”€ main.py
โ”œโ”€โ”€ requirements.txt
โ”œโ”€โ”€ modules/
โ”‚   โ””โ”€โ”€ modules.py
โ””โ”€โ”€ data/
    โ”œโ”€โ”€ inputdata/
    โ”‚   โ””โ”€โ”€ <experimental data to process>
    โ”œโ”€โ”€ invoice/
    โ”‚   โ””โ”€โ”€ invoice.json
    โ””โ”€โ”€ tasksupport/
        โ”œโ”€โ”€ metadata-def.json
        โ””โ”€โ”€ invoice.schema.json

Keywords

rdetoolkit

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts