huak icon indicating copy to clipboard operation
huak copied to clipboard

huak panicked at git package with @ specifier

Open narma opened this issue 1 year ago • 9 comments

command huak add --group dev black

Actually it failed in parse_version_specifiers_str with following input dsproto @ git+ssh://[email protected]/dataspike-io/proto.git@a4d900ee9b9084d54d7a895b8aa1b9e366043211

Crash report:

name = "huak"
operating_system = "Ubuntu 22.04 (jammy) [64-bit]"
crate_version = "0.0.19"
explanation = """
Panic occurred in file 'src/huak/package.rs' at line 95
"""
cause = "package version specifier(s)"
method = "Panic"
backtrace = """

   0: 0x563f27d08851 - core::panicking::panic_display::ha103dd28e5023b08
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:147
   1: 0x563f27d087fb - core::panicking::panic_str::h940bf021f492dc8c
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/panicking.rs:131
   2: 0x563f2788c246 - core::option::expect_failed::h09b982639336e7ea
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/option.rs:2045
   3: 0x563f2791edc6 - <huak::package::Package as core::str::traits::FromStr>::from_str::h2ddcf3820a1b6fe6
   4: 0x563f278f3527 - huak::python_environment::PythonEnvironment::installed_packages::h2da3e714ed8c231b
   5: 0x563f279377f8 - huak::ops::add::add_project_optional_dependencies::h1f5112ea26d4ecf0
   6: 0x563f278910f3 - huak::cli::Cli::run::h3b2926740f9fb80d
   7: 0x563f278a617b - huak::main::hf6e7d75493193a6d
   8: 0x563f278a9143 - std::sys_common::backtrace::__rust_begin_short_backtrace::hcbd7532e3ac9aab6
   9: 0x563f278a9159 - std::rt::lang_start::{{closure}}::hb810a0c820204af6
  10: 0x563f27cdb1dc - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hd6efcd3bec896f2c
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/core/src/ops/function.rs:287
                 - std::panicking::try::do_call::hce04e543bb1f4cbb
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487
                 - std::panicking::try::h3342dd4e1f680968
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451
                 - std::panic::catch_unwind::h148ce1e59ac0cee7
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140
                 - std::rt::lang_start_internal::{{closure}}::h25f9dda2057a67fe
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:148
                 - std::panicking::try::do_call::h7caaaeaf9401650b
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:487
                 - std::panicking::try::he7d15285746cbbc2
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panicking.rs:451
                 - std::panic::catch_unwind::h89fb4f50c0301fe0
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/panic.rs:140
                 - std::rt::lang_start_internal::h078acd489417d3c1
                at /rustc/84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc/library/std/src/rt.rs:148
  11: 0x563f278a67c5 - main
  12: 0x7f78dc93fd90 - <unresolved>
  13: 0x7f78dc93fe40 - __libc_start_main
  14: 0x563f2788c8c2 - <unresolved>
  15:        0x0 - <unresolved>"""

narma avatar Aug 10 '23 13:08 narma

Actually it failed in parse_version_specifiers_str with following input dsproto @ git+ssh://[email protected]/dataspike-io/proto.git@a4d900ee9b9084d54d7a895b8aa1b9e366043211

It's my dependency from pyproject.toml

narma avatar Aug 10 '23 14:08 narma

Rust backtrace on latest master

thread 'main' panicked at 'package version specifier(s)', crates/huak_ops/src/package.rs:96:14
stack backtrace:
   0: rust_begin_unwind
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:67:14
   2: core::panicking::panic_display
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:150:5
   3: core::panicking::panic_str
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/panicking.rs:134:5
   4: core::option::expect_failed
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/option.rs:1932:5
   5: core::option::Option<T>::expect
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/option.rs:898:21
   6: <huak_ops::package::Package as core::str::traits::FromStr>::from_str
             at /home/alzo/s/huak/crates/huak_ops/src/package.rs:95:24
   7: huak_ops::python_environment::PythonEnvironment::installed_packages
             at /home/alzo/s/huak/crates/huak_ops/src/python_environment.rs:211:31
   8: huak_ops::ops::add::add_project_optional_dependencies
             at /home/alzo/s/huak/crates/huak_ops/src/ops/add.rs:97:20
   9: huak::cli::add
             at /home/alzo/s/huak/crates/huak_cli/src/cli.rs:366:13
  10: huak::cli::Cli::run
             at /home/alzo/s/huak/crates/huak_cli/src/cli.rs:217:17
  11: huak::main
             at /home/alzo/s/huak/crates/huak_cli/src/main.rs:17:11
  12: core::ops::function::FnOnce::call_once
             at /rustc/eb26296b556cef10fb713a38f3d16b9886080f26/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

narma avatar Aug 10 '23 14:08 narma

Hi, thanks for the report! What does the version spec look like for the dsproto project?

cnpryer avatar Aug 10 '23 14:08 cnpryer

dependency for dsproto declared as "dsproto @ git+ssh://[email protected]/dataspike-io/[email protected]" in my pyproject.toml

narma avatar Aug 10 '23 15:08 narma

What happens if you change to a pep440-compliant version https://peps.python.org/pep-0440/#pre-releases

cnpryer avatar Aug 10 '23 15:08 cnpryer

I have #714 which should at least prevent panics in the future.

cnpryer avatar Aug 10 '23 16:08 cnpryer

What happens if you change to a pep440-compliant version https://peps.python.org/pep-0440/#pre-releases

But it actually it's not a version, it's a git tag, it could be also a branch or commit. And it works with pdm.

I have https://github.com/cnpryer/huak/pull/714 which should at least prevent panics in the future.

Yes, now it prints follwing and exit error: a version number could not be parsed: dsproto @ git+ssh://[email protected]/dataspike-io/proto.git@a4d900ee9b9084d54d7a895b8aa1b9e366043211

narma avatar Aug 11 '23 06:08 narma

Thanks! It's been a bit, so this is helpful to see. I'll think about a possible temporary solution.

cnpryer avatar Aug 11 '23 09:08 cnpryer

cc #890

cnpryer avatar Feb 17 '24 17:02 cnpryer