oxigdal_jupyter/lib.rs
1//! Jupyter integration for OxiGDAL
2//!
3//! This crate provides Jupyter kernel implementation with rich display capabilities,
4//! interactive widgets, and magic commands for geospatial data analysis.
5//!
6//! # Features
7//!
8//! - Custom Jupyter kernel for OxiGDAL
9//! - Rich display (images, maps, tables)
10//! - Interactive widgets
11//! - Magic commands (%load_raster, %plot, etc.)
12//! - Integration with plotters for visualization
13//!
14//! # Example
15//!
16//! ```rust,no_run
17//! use oxigdal_jupyter::kernel::OxiGdalKernel;
18//!
19//! # fn main() -> Result<(), Box<dyn std::error::Error>> {
20//! // Create and start kernel
21//! let kernel = OxiGdalKernel::new()?;
22//! // kernel.run()?;
23//! # Ok(())
24//! # }
25//! ```
26
27#![warn(missing_docs)]
28#![warn(clippy::unwrap_used)]
29#![warn(clippy::panic)]
30
31pub mod display;
32pub mod kernel;
33pub mod magic;
34pub mod plotting;
35pub mod widgets;
36
37pub use display::{DisplayData, RichDisplay};
38pub use kernel::OxiGdalKernel;
39pub use magic::MagicCommand;
40pub use widgets::{MapWidget, Widget};
41
42use thiserror::Error;
43
44/// Result type for Jupyter operations
45pub type Result<T> = std::result::Result<T, JupyterError>;
46
47/// Error types for Jupyter integration
48#[derive(Error, Debug)]
49pub enum JupyterError {
50 /// IO error
51 #[error("IO error: {0}")]
52 Io(#[from] std::io::Error),
53
54 /// Kernel error
55 #[error("Kernel error: {0}")]
56 Kernel(String),
57
58 /// Display error
59 #[error("Display error: {0}")]
60 Display(String),
61
62 /// Widget error
63 #[error("Widget error: {0}")]
64 Widget(String),
65
66 /// Magic command error
67 #[error("Magic command error: {0}")]
68 Magic(String),
69
70 /// Plotting error
71 #[error("Plotting error: {0}")]
72 Plotting(String),
73
74 /// Serialization error
75 #[error("Serialization error: {0}")]
76 Serialization(#[from] serde_json::Error),
77
78 /// OxiGDAL core error
79 #[error("OxiGDAL error: {0}")]
80 OxiGdal(#[from] oxigdal_core::error::OxiGdalError),
81}