use serde::{Deserialize, Serialize};
use std::collections::HashMap;
use std::fs;
use std::path::Path;
#[derive(Serialize, Deserialize, Debug)]
pub struct Config {
pub name: String,
pub version: String,
pub python_version: String,
pub dependencies: HashMap<String, String>,
#[serde(rename = "virtualEnvironment")]
pub virtual_environment: String,
}
pub fn read_config<P: AsRef<Path>>(path: P) -> Result<Config, Box<dyn std::error::Error>> {
let content = fs::read_to_string(path)?;
let config: Config = serde_json::from_str(&content)?;
Ok(config)
}