16 releases

0.2.1 Dec 4, 2023
0.2.0 Sep 11, 2023
0.1.12 Sep 9, 2023
0.1.9 Jun 5, 2023
0.0.1 May 24, 2023

#197 in Science

Download history 26/week @ 2024-07-04 121/week @ 2024-07-25 18/week @ 2024-08-01

115 downloads per month

MIT/Apache

125KB
2.5K SLoC

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

Easy Jupyter Client for your Language

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()
}

Dependencies

~11–24MB
~327K SLoC