Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- feature: added python runner #76

Merged
merged 2 commits into from
Dec 6, 2024
Merged

Conversation

agallardol
Copy link
Contributor

Added PythonRunner, it shares the same rules as DenoRunner

    let code_files = CodeFiles {
        files: HashMap::from([(
            "main.py".to_string(),
            r#"
import requests
def run(configurations, parameters):
    response = requests.get('https://httpbin.org/get')
    return response.json()['url']
                "#
            .to_string(),
        )]),
        entrypoint: "main.py".to_string(),
    };

    let python_runner = PythonRunner::new(
        code_files,
        Value::Null,
        Some(PythonRunnerOptions {
            ..Default::default()
        }),
    );

    let result = python_runner
        .run(None, Value::Null, None)
        .await
        .unwrap();

    assert_eq!(result.data.as_str().unwrap(), "https://httpbin.org/get");

@agallardol agallardol merged commit 32055cd into main Dec 6, 2024
1 check failed
@agallardol agallardol deleted the agallardol/feature-add-python branch December 6, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant