Skip to content

Commit 98182a6

Browse files
committed
feat: remove tauri cli support for running python interpreter
This also updates the tauri cli to rename runr -> run (run previously invoked the python interpreter). And adds stub support for --data, --data-file, --trace command line options (not implemented yet). Signed-off-by: Nick Mitchell <[email protected]>
1 parent 5de9648 commit 98182a6

File tree

8 files changed

+27
-93
lines changed

8 files changed

+27
-93
lines changed

.github/workflows/tauri-cli.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ jobs:
6969
# demo5,demo6 each depend on an external file, and the interpreter does not currently capture this in the trace
7070
# demo8 currently requires building a model which the interpreter does not directly support
7171
# demo9 takes forever, so... for now skip it
72-
for i in ./src/demos/*.json
73-
do if [[ $(basename $i) != "demo4.json" ]] && [[ $(basename $i) != "demo5.json" ]] && [[ $(basename $i) != "demo6.json" ]] && [[ $(basename $i) != "demo8.json" ]] && [[ $(basename $i) != "demo9.json" ]]; then pdl run $i; fi
74-
done
72+
#for i in ./src/demos/*.json
73+
#do if [[ $(basename $i) != "demo4.json" ]] && [[ $(basename $i) != "demo5.json" ]] && [[ $(basename $i) != "demo6.json" ]] && [[ $(basename $i) != "demo8.json" ]] && [[ $(basename $i) != "demo9.json" ]]; then pdl run $i; fi
74+
#done
7575
7676
- name: Tear down xvfb
7777
run: killall Xvfb || true

pdl-live-react/src-tauri/src/cli.rs

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use urlencoding::encode;
55

66
use crate::compile;
77
use crate::gui::new_window;
8-
use crate::pdl::interpreter::run_file_sync as runr;
9-
use crate::pdl::run::run_pdl_program;
8+
use crate::pdl::interpreter::run_file_sync as run;
109

1110
#[cfg(desktop)]
1211
pub fn setup(app: &mut tauri::App) -> Result<bool, Box<dyn ::std::error::Error>> {
@@ -50,11 +49,16 @@ pub fn setup(app: &mut tauri::App) -> Result<bool, Box<dyn ::std::error::Error>>
5049
_ => Err(Box::from("Unsupported compile command")),
5150
}
5251
}
53-
"runr" => runr(
52+
"run" => run(
5453
subcommand_args
5554
.get("source")
5655
.and_then(|a| a.value.as_str())
5756
.expect("valid positional source arg"),
57+
subcommand_args.get("trace").and_then(|a| a.value.as_str()),
58+
subcommand_args.get("data").and_then(|a| a.value.as_str()),
59+
subcommand_args
60+
.get("data-file")
61+
.and_then(|a| a.value.as_str()),
5862
subcommand_args
5963
.get("debug")
6064
.and_then(|a| a.value.as_bool())
@@ -67,16 +71,6 @@ pub fn setup(app: &mut tauri::App) -> Result<bool, Box<dyn ::std::error::Error>>
6771
== Some(false),
6872
)
6973
.and_then(|_trace| Ok(true)),
70-
"run" => run_pdl_program(
71-
subcommand_args
72-
.get("source")
73-
.and_then(|a| a.value.as_str())
74-
.expect("valid positional source arg"),
75-
subcommand_args.get("trace").and_then(|a| a.value.as_str()),
76-
subcommand_args.get("data").and_then(|a| a.value.as_str()),
77-
subcommand_args.get("stream").and_then(|a| a.value.as_str()),
78-
)
79-
.and_then(|()| Ok(true)),
8074
"view" => new_window(
8175
app.handle().clone(),
8276
subcommand_args.get("trace").and_then(|a| {

pdl-live-react/src-tauri/src/pdl/interpreter.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,14 @@ pub async fn run_file(source_file_path: &str, debug: bool, stream: bool) -> Inte
10541054
run(&program, cwd, debug, stream).await
10551055
}
10561056

1057-
pub fn run_file_sync(source_file_path: &str, debug: bool, stream: bool) -> InterpretationSync {
1057+
pub fn run_file_sync(
1058+
source_file_path: &str,
1059+
_trace: Option<&str>,
1060+
_data: Option<&str>,
1061+
_data_file: Option<&str>,
1062+
debug: bool,
1063+
stream: bool,
1064+
) -> InterpretationSync {
10581065
tauri::async_runtime::block_on(run_file(source_file_path, debug, stream))
10591066
.map_err(|err| Box::<dyn Error>::from(err.to_string()))
10601067
}

pdl-live-react/src-tauri/src/pdl/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,3 @@ mod interpreter_tests;
55
pub mod pip;
66
pub mod pull;
77
pub mod requirements;
8-
pub mod run;

pdl-live-react/src-tauri/src/pdl/pull.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,15 @@ use rayon::prelude::*;
66

77
use crate::pdl::ast::PdlBlock;
88
use crate::pdl::extract;
9-
use crate::pdl::interpreter::parse_file;
109

11-
pub async fn pull_if_needed_from_path(
10+
/* pub async fn pull_if_needed_from_path(
1211
source_file_path: &str,
1312
) -> Result<(), Box<dyn ::std::error::Error + Send + Sync>> {
1413
let program = parse_file(&::std::path::PathBuf::from(source_file_path))?;
1514
pull_if_needed(&program)
1615
.await
1716
.map_err(|e| Box::from(e.to_string()))
18-
}
17+
} */
1918

2019
/// Pull models (in parallel) from the PDL program in the given filepath.
2120
pub async fn pull_if_needed(program: &PdlBlock) -> Result<(), Error> {
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,2 @@
1-
//pub const PDL_INTERPRETER: &str = "-e ../";
2-
pub const PDL_INTERPRETER: &str = "prompt-declaration-language==0.6.0";
3-
41
pub const BEEAI_FRAMEWORK: &str = "-e git+https://github.com/starpit/bee-agent-framework.git@nick-meta-combo#egg=beeai_framework&subdirectory=python";
52
//pub const BEEAI_FRAMEWORK: &str = "beeai_framework==0.1";

pdl-live-react/src-tauri/src/pdl/run.rs

Lines changed: 0 additions & 52 deletions
This file was deleted.

pdl-live-react/src-tauri/tauri.conf.json

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@
4747
}
4848
}
4949
},
50-
"runr": {
50+
"run": {
51+
"description": "Run a PDL program",
5152
"args": [
5253
{
5354
"name": "source",
@@ -59,31 +60,20 @@
5960
"name": "no-stream"
6061
},
6162
{
62-
"name": "debug",
63-
"short": "g"
64-
}
65-
]
66-
},
67-
"run": {
68-
"description": "Run a PDL program",
69-
"args": [
70-
{
71-
"name": "source",
72-
"index": 1,
73-
"required": true,
63+
"name": "data",
7464
"takesValue": true
7565
},
7666
{
77-
"name": "stream",
67+
"name": "data-file",
7868
"takesValue": true
7969
},
8070
{
81-
"name": "data",
71+
"name": "trace",
8272
"takesValue": true
8373
},
8474
{
85-
"name": "trace",
86-
"takesValue": true
75+
"name": "debug",
76+
"short": "g"
8777
}
8878
]
8979
},

0 commit comments

Comments
 (0)