#kernel #protocols #file-path

jupyter

Rust 中 Jupyter 内核协议

16 个版本

0.2.1 2023年12月4日
0.2.0 2023年9月11日
0.1.12 2023年9月9日
0.1.9 2023年6月5日
0.0.1 2023年5月24日

#149科学

Download history 73/week @ 2024-03-31

115 每月下载量

MIT/Apache

125KB
2.5K SLoC

Rust 2.5K SLoC // 0.0% comments JavaScript 265 SLoC // 0.1% comments

为您的语言提供简单的 Jupyter 客户端

use clap::Parser;
use clap_derive::{Parser, Subcommand};
use jupyter::{InstallAction, JupyterResult, OpenAction, StartAction, UninstallAction};
use std::path::PathBuf;

#[derive(Parser)]
#[command(author, version, about, long_about = None)]
pub struct JupyterApplication {
    /// Sets a custom config file
    #[arg(short, long, value_name = "FILE")]
    config: Option<PathBuf>,
    /// Turn debugging information on
    #[arg(short, long, action = clap::ArgAction::Count)]
    debug: u8,
    #[command(subcommand)]
    command: JupyterCommands,
}

#[derive(Subcommand)]
enum JupyterCommands {
    Open(Box<OpenAction>),
    Start(Box<StartAction>),
    Install(Box<InstallAction>),
    Uninstall(Box<UninstallAction>),
}

impl JupyterApplication {
    pub fn run(&self) -> JupyterResult<()> {
        match &self.command {
            JupyterCommands::Open(v) => v.run(),
            JupyterCommands::Start(v) => v.run(),
            JupyterCommands::Install(v) => v.run(),
            JupyterCommands::Uninstall(v) => v.run(),
        }
    }
}

fn main() -> JupyterResult<()> {
    let app = JupyterApplication::parse();
    app.run()
}

依赖项

~12–29MB
~346K SLoC