Skip to content

Commit

Permalink
new: Add Python support. (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj authored Sep 10, 2023
1 parent c9d75f2 commit 35be6cb
Show file tree
Hide file tree
Showing 17 changed files with 119 additions and 120 deletions.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ body:
- [Deno](https://github.com/moonrepo/deno-plugin)
- [Go](https://github.com/moonrepo/go-plugin)
- [Node](https://github.com/moonrepo/node-plugin)
- [Python](https://github.com/moonrepo/python-plugin)
- [Rust](https://github.com/moonrepo/rust-plugin)
- [Schema](https://github.com/moonrepo/schema-plugin)
- type: input
Expand Down
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
# Changelog

## Plugin changelogs

- [Bun](https://github.com/moonrepo/bun-plugin/blob/master/CHANGELOG.md)
- [Deno](https://github.com/moonrepo/deno-plugin/blob/master/CHANGELOG.md)
- [Go](https://github.com/moonrepo/go-plugin/blob/master/CHANGELOG.md)
- [Node](https://github.com/moonrepo/node-plugin/blob/master/CHANGELOG.md)
- [Python](https://github.com/moonrepo/python-plugin/blob/master/CHANGELOG.md)
- [Rust](https://github.com/moonrepo/rust-plugin/blob/master/CHANGELOG.md)
- [Schema](https://github.com/moonrepo/schema-plugin/blob/master/CHANGELOG.md)

## Unreleased

#### 💥 Breaking

- WASM API
- Updated `exec_command!` to no longer throw on non-zero exit codes. You'll now need to handle failure states manually.

#### 🚀 Updates

- Added Python language support via the `python` identifier.
- Added colors to command line `--help` menus.
- Added canary support to all applicable tools.
- New `--canary` flag for `proto install`.
Expand Down
77 changes: 27 additions & 50 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ members = ["crates/*"]
default-members = ["crates/cli"]

[workspace.dependencies]
cached = "0.44.0"
clap = "4.4.1"
clap_complete = "4.4.0"
cached = "0.45.1"
clap = "4.4.2"
clap_complete = "4.4.1"
convert_case = "0.6.0"
extism = "0.5.0"
extism-pdk = "0.3.4"
human-sort = "0.2.2"
miette = "5.10.0"
once_cell = "1.18.0"
once_map = "0.4.8"
regex = "1.9.4"
regex = "1.9.5"
reqwest = { version = "0.11.20", default-features = false, features = [
"rustls-tls",
] }
Expand All @@ -35,7 +35,7 @@ starbase_utils = { version = "0.3.1", default-features = false, features = [
"json",
"toml",
] }
thiserror = "1.0.47"
thiserror = "1.0.48"
tokio = { version = "1.32.0", features = ["full", "tracing"] }
tracing = "0.1.37"

Expand Down
10 changes: 5 additions & 5 deletions crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,23 @@ name = "proto"
path = "src/main.rs"

[dependencies]
proto_core = { version = "0.17.1", path = "../core" }
proto_pdk_api = { version = "0.7.0", path = "../pdk-api" }
proto_core = { version = "0.17.2", path = "../core" }
proto_pdk_api = { version = "0.7.1", path = "../pdk-api" }
proto_schema_plugin = { version = "0.11.4", path = "../schema-plugin" }
proto_wasm_plugin = { version = "0.6.4", path = "../wasm-plugin" }
proto_wasm_plugin = { version = "0.6.5", path = "../wasm-plugin" }
clap = { workspace = true, features = ["derive", "env"] }
clap_complete = { workspace = true }
convert_case = { workspace = true }
dialoguer = "0.10.4"
dirs = "5.0.1"
futures = "0.3.28"
human-sort = { workspace = true }
indicatif = "0.17.5"
indicatif = "0.17.6"
miette = { workspace = true }
reqwest = { workspace = true, features = ["stream"] }
semver = { workspace = true }
serde = { workspace = true }
starbase = "0.2.5"
starbase = "0.2.6"
starbase_archive = { workspace = true }
starbase_styles = { workspace = true }
starbase_utils = { workspace = true }
Expand Down
10 changes: 10 additions & 0 deletions crates/cli/tests/plugins_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,16 @@ mod builtins {
assert.success();
}

#[test]
fn supports_python() {
let temp = create_empty_sandbox();

let mut cmd = create_proto_command(temp.path());
let assert = cmd.arg("install").arg("python").assert();

assert.success();
}

#[test]
fn supports_rust() {
let temp = create_empty_sandbox();
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn create_proto_command<T: AsRef<Path>>(path: T) -> assert_cmd::Command {
let mut cmd = create_command_with_name(path, "proto");
cmd.timeout(std::time::Duration::from_secs(180));
cmd.env("PROTO_HOME", path.as_os_str());
cmd.env("PROTO_LOG", "debug");
cmd.env("PROTO_LOG", "trace");
// cmd.env("PROTO_TEST", "true");
cmd
}
6 changes: 3 additions & 3 deletions crates/core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "proto_core"
version = "0.17.1"
version = "0.17.2"
edition = "2021"
license = "MIT"
description = "Core proto APIs."
homepage = "https://moonrepo.dev/proto"
repository = "https://github.com/moonrepo/proto"

[dependencies]
proto_pdk_api = { version = "0.7.0", path = "../pdk-api" }
proto_wasm_plugin = { version = "0.6.4", path = "../wasm-plugin" }
proto_pdk_api = { version = "0.7.1", path = "../pdk-api" }
proto_wasm_plugin = { version = "0.6.5", path = "../wasm-plugin" }
warpgate = { version = "0.5.4", path = "../warpgate" }
cached = { workspace = true }
extism = { workspace = true }
Expand Down
9 changes: 9 additions & 0 deletions crates/core/src/tools_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,15 @@ impl ToolsConfig {
}
}

if !self.plugins.contains_key("python") {
self.plugins.insert(
Id::raw("python"),
PluginLocator::SourceUrl {
url: "https://github.com/moonrepo/python-plugin/releases/latest/download/python_plugin.wasm".into()
}
);
}

if !self.plugins.contains_key("rust") {
self.plugins.insert(
Id::raw("rust"),
Expand Down
2 changes: 1 addition & 1 deletion crates/pdk-api/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "proto_pdk_api"
version = "0.7.0"
version = "0.7.1"
edition = "2021"
license = "MIT"
description = "Core APIs for creating proto WASM plugins."
Expand Down
1 change: 1 addition & 0 deletions crates/pdk-api/src/host_funcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ impl ExecCommandInput {
json_struct!(
/// Output returned from the `exec_command` host function.
pub struct ExecCommandOutput {
pub command: String,
pub exit_code: i32,
pub stderr: String,
pub stdout: String,
Expand Down
Loading

0 comments on commit 35be6cb

Please sign in to comment.