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

Add Python bindings generation command #1761

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions FULL_HELP_DOCS.md
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ Generate code client bindings for a contract
* `json` — Generate Json Bindings
* `rust` — Generate Rust bindings
* `typescript` — Generate a TypeScript / JavaScript package
* `python` — Generate Python bindings



Expand Down Expand Up @@ -306,6 +307,14 @@ Generate a TypeScript / JavaScript package



## `stellar contract bindings python`

Generate Python bindings

**Usage:** `stellar contract bindings python`



## `stellar contract build`

Build a contract from source
Expand Down
8 changes: 8 additions & 0 deletions cmd/soroban-cli/src/commands/contract/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod json;
pub mod python;
pub mod rust;
pub mod typescript;

Expand All @@ -12,6 +13,9 @@ pub enum Cmd {

/// Generate a TypeScript / JavaScript package
Typescript(typescript::Cmd),

/// Generate Python bindings
Python(python::Cmd),
}

#[derive(thiserror::Error, Debug)]
Expand All @@ -24,6 +28,9 @@ pub enum Error {

#[error(transparent)]
Typescript(#[from] typescript::Error),

#[error(transparent)]
Python(#[from] python::Error),
}

impl Cmd {
Expand All @@ -32,6 +39,7 @@ impl Cmd {
Cmd::Json(json) => json.run()?,
Cmd::Rust(rust) => rust.run()?,
Cmd::Typescript(ts) => ts.run().await?,
Cmd::Python(python) => python.run()?,
}
Ok(())
}
Expand Down
19 changes: 19 additions & 0 deletions cmd/soroban-cli/src/commands/contract/bindings/python.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
use std::fmt::Debug;

use clap::Parser;

#[derive(Parser, Debug, Clone)]
#[group(skip)]
pub struct Cmd {}

#[derive(thiserror::Error, Debug)]
pub enum Error {
#[error("python binding generation is not implemented in the stellar-cli, but is available via the tool located here: https://github.com/lightsail-network/stellar-contract-bindings")]
NotImplemented,
}

impl Cmd {
pub fn run(&self) -> Result<(), Error> {
Err(Error::NotImplemented)
}
}