MyCode Project

Overview

  • Minimal starter template you can copy to bootstrap a new AGILab application.

  • Demonstrates the project layout expected by the platform (manager package, worker package, app_args definitions, Analysis configuration) with minimal business logic so you can focus on custom code.

  • Ships with blank web forms and prompt files to illustrate where to plug in UI customisation and Pipeline prompts.

Scientific placeholders

The template is intentionally lightweight, but many AGILab workflows ultimately fit the pattern of learning or calibrating a function \(f_\theta\):

\[\theta^* = \arg\min_{\theta} \; \frac{1}{N} \sum_{i=1}^{N} \ell\left(f_{\theta}(x_i), y_i\right)\]

where \(\ell\) is a task-dependent loss (regression, classification, imitation learning, etc.). You can use the MyCode skeleton to prototype the data loading, feature extraction, and artifact export around this core loop.

Manager (mycode.mycode)

  • Lightweight subclass of BaseWorker that shows how to wire argument handling, logging and dataframe export without heavy dependencies.

  • Provides the same from_toml / to_toml helpers as production projects so you can reuse the Orchestrate page snippets verbatim.

Args (mycode.app_args)

  • Simple Pydantic model that mirrors the keys present in app_settings.toml.

  • Ideal starting point for capturing new configuration options; extend the model and the web form generated on the Orchestrate page will pick them up.

Worker (mycode_worker.mycode_worker)

  • Skeleton worker that demonstrates the lifecycle hooks (start, work_init, run) required by the distributor.

  • Includes placeholder logic for dataset loading and result persistence—replace with your domain-specific processing steps.

Assets & Tests

  • app_test.py ensures the installer and worker skeleton keep working as the template evolves.

  • test/_test_* modules show how to unit-test managers and workers in isolation.

  • app_args_form.py provides the optional web form that mirrors the generated UI; tailor it when you need additional validation or widgets.

API Reference

mycode package diagram

Minimal manager implementation for the mycode sample project.

class mycode.mycode.Mycode(env, args=None, **kwargs)[source]

Bases: BaseWorker

Lightweight orchestration surface for the mycode example.

__init__(env, args=None, **kwargs)[source]
as_dict()[source]
Return type:

dict[str, Any]

build_distribution(_workers=None)[source]
Return type:

Tuple[List[List], List[List[Tuple[int, int]]], str, str, str]

classmethod from_toml(env, settings_path='app_settings.toml', section='args', **overrides)[source]
Return type:

Mycode

static pool_init(vars)[source]
Return type:

None

stop()[source]

Returns:

Return type:

None

to_toml(settings_path='app_settings.toml', section='args', create_missing=True)[source]
Return type:

None

work_done(_)[source]
Return type:

None

work_pool(_=None)[source]
Return type:

None

worker_vars = {}
class mycode.mycode.MycodeApp(env, args=None, **kwargs)[source]

Bases: Mycode

Alias retaining the historical suffix for compatibility.

mycode class diagram

Argument management helpers for the mycode sample project.

mycode.app_args.ArgsModel

alias of MycodeArgs

mycode.app_args.ArgsOverrides

alias of MycodeArgsTD

class mycode.app_args.MycodeArgs(**data)[source]

Bases: BaseModel

Runtime parameters for the mycode application.

data_in
data_out
files
model_config = {'extra': 'forbid'}

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

nfile
nread
nskip
reset_target
class mycode.app_args.MycodeArgsTD[source]

Bases: TypedDict

data_in
data_out
files
nfile
nread
nskip
reset_target
mycode.app_args.dump_args(args, settings_path, *, section='args', create_missing=True)[source]
Return type:

None

mycode.app_args.ensure_defaults(args, **_)[source]
Return type:

MycodeArgs

mycode.app_args.load_args(settings_path, *, section='args')[source]
Return type:

MycodeArgs

mycode.app_args.merge_args(base, overrides=None)[source]
Return type:

MycodeArgs

mycode args class diagram
mycode worker package diagram

Default worker implementation for the mycode project.

This worker simply inherits the PolarsWorker so that projects with minimal requirements still provide a concrete worker class. Downstream installers rely on the class name MycodeWorker to determine the runtime bundle to ship.

class mycode_worker.mycode_worker.MycodeWorker[source]

Bases: PolarsWorker

Polars worker used by the mycode sample application.

mycode worker class diagram