diff --git a/README.md b/README.md index ca19070a..35f84bab 100644 --- a/README.md +++ b/README.md @@ -34,10 +34,10 @@ The goal is to create an opinionated tool to support a reliably inviting onboard ## Installation ``` -❯ pip install huak +pip install huak ``` -To install Huak from source use `Cargo`: +To install Huak from source using Cargo: ``` cargo install --git https://github.com/cnpryer/huak.git huak diff --git a/crates/huak-cli/src/cli.rs b/crates/huak-cli/src/cli.rs index c6ae2c79..8e8dd975 100644 --- a/crates/huak-cli/src/cli.rs +++ b/crates/huak-cli/src/cli.rs @@ -512,6 +512,8 @@ fn fmt(config: &Config, options: &FormatOptions) -> HuakResult<()> { ops::format_project(config, options) } +#[allow(clippy::too_many_arguments)] +#[allow(clippy::fn_params_excessive_bools)] fn init( app: bool, _lib: bool, diff --git a/crates/huak-cli/tests/mod.rs b/crates/huak-cli/tests/mod.rs index b6bbe091..06af1ea0 100644 --- a/crates/huak-cli/tests/mod.rs +++ b/crates/huak-cli/tests/mod.rs @@ -49,10 +49,10 @@ mod tests { assert_cmd_snapshot!(Command::new("huak").arg("init").arg("--help")); } - #[test] - fn test_install_help() { - assert_cmd_snapshot!(Command::new("huak").arg("install").arg("--help")); - } + // #[test] + // fn test_install_help() { + // assert_cmd_snapshot!(Command::new("huak").arg("install").arg("--help")); + // } #[test] fn test_lint_help() { diff --git a/crates/huak-cli/tests/snapshots/r#mod__tests__help-2.snap b/crates/huak-cli/tests/snapshots/r#mod__tests__help-2.snap index 314c23fc..341bfd52 100644 --- a/crates/huak-cli/tests/snapshots/r#mod__tests__help-2.snap +++ b/crates/huak-cli/tests/snapshots/r#mod__tests__help-2.snap @@ -20,8 +20,7 @@ Commands: completion Generates a shell completion script for supported shells fix Auto-fix fixable lint conflicts fmt Format the project's Python code - init Initialize the existing project - install Install the dependencies of an existing project + init Initialize the current project lint Lint the project's Python code new Create a new project at publish Builds and uploads current project to a registry diff --git a/crates/huak-cli/tests/snapshots/r#mod__tests__help.snap b/crates/huak-cli/tests/snapshots/r#mod__tests__help.snap index 3cf11eb4..32a5db5a 100644 --- a/crates/huak-cli/tests/snapshots/r#mod__tests__help.snap +++ b/crates/huak-cli/tests/snapshots/r#mod__tests__help.snap @@ -20,8 +20,7 @@ Commands: completion Generates a shell completion script for supported shells fix Auto-fix fixable lint conflicts fmt Format the project's Python code - init Initialize the existing project - install Install the dependencies of an existing project + init Initialize the current project lint Lint the project's Python code new Create a new project at publish Builds and uploads current project to a registry diff --git a/crates/huak-cli/tests/snapshots/r#mod__tests__init_help.snap b/crates/huak-cli/tests/snapshots/r#mod__tests__init_help.snap index 4ecfad43..4e80b3af 100644 --- a/crates/huak-cli/tests/snapshots/r#mod__tests__init_help.snap +++ b/crates/huak-cli/tests/snapshots/r#mod__tests__init_help.snap @@ -1,5 +1,5 @@ --- -source: crates/huak_cli/tests/mod.rs +source: crates/huak-cli/tests/mod.rs info: program: huak args: @@ -9,14 +9,21 @@ info: success: true exit_code: 0 ----- stdout ----- -Initialize the existing project +Initialize the current project -Usage: huak init [OPTIONS] +Usage: huak init [OPTIONS] [MANIFEST] [NO_ENV] [OPTIONAL_DEPENDENCIES]... [-- ...] + +Arguments: + [MANIFEST] Initialize with a project manifest + [NO_ENV] Initialize without setting up a Python environment + [OPTIONAL_DEPENDENCIES]... Optional dependency groups to install + [TRAILING]... Pass trailing arguments with `--` Options: --app Use an application template --lib Use a library template [default] --no-vcs Don't initialize VCS in the project + -f, --force Force the initialization -q, --quiet --no-color -h, --help Print help diff --git a/crates/huak-cli/tests/snapshots/r#mod__tests__install_help.snap b/crates/huak-cli/tests/snapshots/r#mod__tests__install_help.snap deleted file mode 100644 index 5436fb3a..00000000 --- a/crates/huak-cli/tests/snapshots/r#mod__tests__install_help.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: crates/huak_cli/tests/mod.rs -info: - program: huak - args: - - install - - "--help" ---- -success: true -exit_code: 0 ------ stdout ----- -Install the dependencies of an existing project - -Usage: huak install [OPTIONS] [-- ...] - -Arguments: - [TRAILING]... Pass trailing arguments with `--` - -Options: - --groups ... Install optional dependency groups - -q, --quiet - --no-color - -h, --help Print help - ------ stderr ----- - diff --git a/crates/huak-package-manager/src/ops/init.rs b/crates/huak-package-manager/src/ops/init.rs index 890d00b2..debbd4fa 100644 --- a/crates/huak-package-manager/src/ops/init.rs +++ b/crates/huak-package-manager/src/ops/init.rs @@ -64,16 +64,15 @@ pub fn init_python_env( // TODO(cnpryer): Can't remember if clap parses "." as curr dir let mut manifest_path = manifest.unwrap_or(ws.root().join("pyproject.toml")); - if manifest_path .file_name() .is_some_and(|it| !it.eq_ignore_ascii_case("pyproject.toml")) { return Err(Error::ManifestFileNotSupported(manifest_path)); - } else { - manifest_path.set_file_name("pyproject.toml"); } + manifest_path.set_file_name("pyproject.toml"); + let Ok(manifest) = LocalManifest::new(manifest_path) else { return config .terminal() @@ -131,6 +130,7 @@ pub fn init_python_env( return Ok(()); } + // TODO(cnpryer): Relax this by attempting to use existing environments if force { // Remove the current Python virtual environment if one exists. match ws.current_python_environment() {