Skip to content

Commit

Permalink
Add add dependency operations
Browse files Browse the repository at this point in the history
  • Loading branch information
cnpryer committed Mar 23, 2023
1 parent 5bccecf commit fb8912b
Show file tree
Hide file tree
Showing 3 changed files with 192 additions and 82 deletions.
2 changes: 2 additions & 0 deletions src/huak/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ pub enum Error {
PythonModuleMissingError(String),
#[error("a python interpreter could not be found")]
PythonNotFoundError,
#[error("a feature is unimplemented: {0}")]
UnimplementedError(String),
#[error(
"a problem occurred parsing the virtual environment's config file: {0}"
)]
Expand Down
9 changes: 5 additions & 4 deletions src/huak/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use pyproject_toml::PyProjectToml as ProjectToml;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{
collections::{hash_map::RandomState},
collections::hash_map::RandomState,
fs::File,
path::{Path, PathBuf},
process::Command,
Expand Down Expand Up @@ -535,7 +535,7 @@ impl VirtualEnvironment {

/// Install Python packages to the environment.
pub fn install_packages(
&mut self,
&self,
packages: &[Package],
terminal: &mut Terminal,
) -> HuakResult<()> {
Expand All @@ -547,7 +547,7 @@ impl VirtualEnvironment {

/// Uninstall many Python packages from the environment.
pub fn uninstall_packages(
&mut self,
&self,
package_names: &[&str],
terminal: &mut Terminal,
) -> HuakResult<()> {
Expand Down Expand Up @@ -789,9 +789,10 @@ impl Default for VirtualEnvironmentConfig {
/// # Examples
/// ```
/// use huak::Package;
/// use std::str::FromStr;
///
/// let python_pkg = Package::from_str("request>=2.28.1").unwrap();
/// println!("I've got 99 {} but huak ain't one", python_pkg);
/// println!("I've got 99 {} but huak ain't one", python_pkg.name());
/// ```
#[derive(Clone, Default, Debug)]
pub struct Package {
Expand Down
Loading

0 comments on commit fb8912b

Please sign in to comment.