Skip to content

Better error message when no branch is supplied #5857

@Kobu

Description

@Kobu

Is your feature request related to a problem? Please describe.

When an user tries to install a dependency from vsc and the doesnt provide any branch name in the URL, the following error message is displayed

Traceback (most recent call last):
  File "/home/kobu/.local/bin/pipenv", line 8, in <module>
    sys.exit(cli())
             ^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/cli/options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/vendor/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/vendor/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/cli/command.py", line 209, in install
    do_install(
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/routines/install.py", line 255, in do_install
    added, cat, normalized_name = project.add_package_to_pipfile(
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/project.py", line 1160, in add_package_to_pipfile
    name, normalized_name, entry = self.generate_package_pipfile_entry(
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/kobu/.local/lib/python3.11/site-packages/pipenv/project.py", line 1144, in generate_package_pipfile_entry
    entry["ref"] = vcs_parts[1].split("#", 1)[0].strip()
                   ~~~~~~~~~^^^
IndexError: list index out of range

This message provides no helpful information at all.

Describe the solution you'd like

Maybe we could inform the user that they need to supply a branch name when trying to install from vsc. The current approach is rather misleading


$ pipenv --support

Pipenv version: '2023.8.22'

Pipenv location: '/home/kobu/.local/lib/python3.11/site-packages/pipenv'

Python location: '/usr/bin/python'

OS Name: 'posix'

User pip version: '23.2.1'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.11.3',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.3.9-arch1-1',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT_DYNAMIC Wed, 21 Jun 2023 20:46:20 +0000',
 'python_full_version': '3.11.3',
 'python_version': '3.11',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • WINDOWID
  • LESSHISTFILE
  • COLORTERM
  • CABAL_DIR
  • PSQL_HISTORY
  • GHCUP_USE_XDG_DIRS
  • DOTNET_ROOT
  • XDG_DATA_HOME
  • XDG_CONFIG_HOME
  • GNUPGHOME
  • GPG_TTY
  • EDITOR
  • GTK_MODULES
  • XDG_SEAT
  • PWD
  • LOGNAME
  • XDG_SESSION_TYPE
  • SYSTEMD_EXEC_PID
  • XAUTHORITY
  • WINDOWPATH
  • MOTD_SHOWN
  • GTK2_RC_FILES
  • HOME
  • LANG
  • HISTFILE
  • CARGO_HOME
  • MUNI
  • INVOCATION_ID
  • CURENT_SEMESTER
  • DOTNET_BUNDLE_EXTRACT_BASE_DIR
  • XDG_CACHE_HOME
  • CABAL_CONFIG
  • ALACRITTY_SOCKET
  • XDG_SESSION_CLASS
  • TERM
  • RUSTUP_HOME
  • USER
  • NPM_CONFIG_USERCONFIG
  • XINITRC
  • DISPLAY
  • SHLVL
  • XDG_VTNR
  • XDG_SESSION_ID
  • NUGET_PACKAGES
  • XDG_STATE_HOME
  • XDG_RUNTIME_DIR
  • DEBUGINFOD_URLS
  • NODE_REPL_HISTORY
  • GTK3_MODULES
  • XDG_DATA_DIRS
  • PATH
  • ALACRITTY_LOG
  • DBUS_SESSION_BUS_ADDRESS
  • MAIL
  • _JAVA_OPTIONS
  • ALACRITTY_WINDOW_ID
  • MYPY_CACHE_DIR
  • OLDPWD
  • _
  • LC_CTYPE
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/kobu/.cabal/bin:/home/kobu/.ghcup/bin:/home/kobu/.cabal/bin:/home/kobu/.ghcup/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/home/kobu/.dotnet/tools:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/kobu/.local/bin:/home/kobu/.local/bin
  • SHELL: /bin/bash
  • EDITOR: nvim
  • LANG: C
  • PWD: /home/kobu/coding/git-timewarp

Contents of Pipfile ('/home/kobu/coding/git-timewarp/Pipfile'):

[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"

[packages]
typer = "*"
gitpython = "*"
result = {editable = true, ref = "master", git = "git+https://github.com/rustedpy/result.git"}

[dev-packages]
black = "*"
isort = "*"
mypy = "*"

[requires]
python_version = "3.11"

Contents of Pipfile.lock ('/home/kobu/coding/git-timewarp/Pipfile.lock'):

{
    "_meta": {
        "hash": {
            "sha256": "cedba3589eebceef8c2e1538f0154f6694c90bb07cdeb409d7257e35a5dbdc7f"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.11"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "click": {
            "hashes": [
                "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28",
                "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==8.1.7"
        },
        "gitdb": {
            "hashes": [
                "sha256:6eb990b69df4e15bad899ea868dc46572c3f75339735663b81de79b06f17eb9a",
                "sha256:c286cf298426064079ed96a9e4a9d39e7f3e9bf15ba60701e95f5492f28415c7"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==4.0.10"
        },
        "gitpython": {
            "hashes": [
                "sha256:8d9b8cb1e80b9735e8717c9362079d3ce4c6e5ddeebedd0361b228c3a67a62f6",
                "sha256:e3d59b1c2c6ebb9dfa7a184daf3b6dd4914237e7488a1730a6d8f6f5d0b4187f"
            ],
            "index": "pypi",
            "markers": "python_version >= '3.7'",
            "version": "==3.1.32"
        },
        "result": {
            "editable": true,
            "git": "git+https://github.com/rustedpy/result.git",
            "markers": "python_version >= '3.8'",
            "ref": "28e27cf37603b6bf786b9e93ca163490844df74e"
        },
        "smmap": {
            "hashes": [
                "sha256:2aba19d6a040e78d8b09de5c57e96207b09ed71d8e55ce0959eeee6c8e190d94",
                "sha256:c840e62059cd3be204b0c9c9f74be2c09d5648eddd4580d9314c3ecde0b30936"
            ],
            "markers": "python_version >= '3.6'",
            "version": "==5.0.0"
        },
        "typer": {
            "hashes": [
                "sha256:50922fd79aea2f4751a8e0408ff10d2662bd0c8bbfa84755a699f3bada2978b2",
                "sha256:5d96d986a21493606a358cae4461bd8cdf83cbf33a5aa950ae629ca3b51467ee"
            ],
            "index": "pypi",
            "markers": "python_version >= '3.6'",
            "version": "==0.9.0"
        },
        "typing-extensions": {
            "hashes": [
                "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36",
                "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==4.7.1"
        }
    },
    "develop": {
        "black": {
            "hashes": [
                "sha256:01ede61aac8c154b55f35301fac3e730baf0c9cf8120f65a9cd61a81cfb4a0c3",
                "sha256:022a582720b0d9480ed82576c920a8c1dde97cc38ff11d8d8859b3bd6ca9eedb",
                "sha256:25cc308838fe71f7065df53aedd20327969d05671bac95b38fdf37ebe70ac087",
                "sha256:27eb7a0c71604d5de083757fbdb245b1a4fae60e9596514c6ec497eb63f95320",
                "sha256:327a8c2550ddc573b51e2c352adb88143464bb9d92c10416feb86b0f5aee5ff6",
                "sha256:47e56d83aad53ca140da0af87678fb38e44fd6bc0af71eebab2d1f59b1acf1d3",
                "sha256:501387a9edcb75d7ae8a4412bb8749900386eaef258f1aefab18adddea1936bc",
                "sha256:552513d5cd5694590d7ef6f46e1767a4df9af168d449ff767b13b084c020e63f",
                "sha256:5c4bc552ab52f6c1c506ccae05681fab58c3f72d59ae6e6639e8885e94fe2587",
                "sha256:642496b675095d423f9b8448243336f8ec71c9d4d57ec17bf795b67f08132a91",
                "sha256:6d1c6022b86f83b632d06f2b02774134def5d4d4f1dac8bef16d90cda18ba28a",
                "sha256:7f3bf2dec7d541b4619b8ce526bda74a6b0bffc480a163fed32eb8b3c9aed8ad",
                "sha256:831d8f54c3a8c8cf55f64d0422ee875eecac26f5f649fb6c1df65316b67c8926",
                "sha256:8417dbd2f57b5701492cd46edcecc4f9208dc75529bcf76c514864e48da867d9",
                "sha256:86cee259349b4448adb4ef9b204bb4467aae74a386bce85d56ba4f5dc0da27be",
                "sha256:893695a76b140881531062d48476ebe4a48f5d1e9388177e175d76234ca247cd",
                "sha256:9fd59d418c60c0348505f2ddf9609c1e1de8e7493eab96198fc89d9f865e7a96",
                "sha256:ad0014efc7acf0bd745792bd0d8857413652979200ab924fbf239062adc12491",
                "sha256:b5b0ee6d96b345a8b420100b7d71ebfdd19fab5e8301aff48ec270042cd40ac2",
                "sha256:c333286dc3ddca6fdff74670b911cccedacb4ef0a60b34e491b8a67c833b343a",
                "sha256:f9062af71c59c004cd519e2fb8f5d25d39e46d3af011b41ab43b9c74e27e236f",
                "sha256:fb074d8b213749fa1d077d630db0d5f8cc3b2ae63587ad4116e8a436e9bbe995"
            ],
            "index": "pypi",
            "markers": "python_version >= '3.8'",
            "version": "==23.7.0"
        },
        "click": {
            "hashes": [
                "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28",
                "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==8.1.7"
        },
        "isort": {
            "hashes": [
                "sha256:8bef7dde241278824a6d83f44a544709b065191b95b6e50894bdc722fcba0504",
                "sha256:f84c2818376e66cf843d497486ea8fed8700b340f308f076c6fb1229dff318b6"
            ],
            "index": "pypi",
            "markers": "python_full_version >= '3.8.0'",
            "version": "==5.12.0"
        },
        "mypy": {
            "hashes": [
                "sha256:159aa9acb16086b79bbb0016145034a1a05360626046a929f84579ce1666b315",
                "sha256:258b22210a4a258ccd077426c7a181d789d1121aca6db73a83f79372f5569ae0",
                "sha256:26f71b535dfc158a71264e6dc805a9f8d2e60b67215ca0bfa26e2e1aa4d4d373",
                "sha256:26fb32e4d4afa205b24bf645eddfbb36a1e17e995c5c99d6d00edb24b693406a",
                "sha256:2fc3a600f749b1008cc75e02b6fb3d4db8dbcca2d733030fe7a3b3502902f161",
                "sha256:32cb59609b0534f0bd67faebb6e022fe534bdb0e2ecab4290d683d248be1b275",
                "sha256:330857f9507c24de5c5724235e66858f8364a0693894342485e543f5b07c8693",
                "sha256:361da43c4f5a96173220eb53340ace68cda81845cd88218f8862dfb0adc8cddb",
                "sha256:4a465ea2ca12804d5b34bb056be3a29dc47aea5973b892d0417c6a10a40b2d65",
                "sha256:51cb1323064b1099e177098cb939eab2da42fea5d818d40113957ec954fc85f4",
                "sha256:57b10c56016adce71fba6bc6e9fd45d8083f74361f629390c556738565af8eeb",
                "sha256:596fae69f2bfcb7305808c75c00f81fe2829b6236eadda536f00610ac5ec2243",
                "sha256:5d627124700b92b6bbaa99f27cbe615c8ea7b3402960f6372ea7d65faf376c14",
                "sha256:6ac9c21bfe7bc9f7f1b6fae441746e6a106e48fc9de530dea29e8cd37a2c0cc4",
                "sha256:82cb6193de9bbb3844bab4c7cf80e6227d5225cc7625b068a06d005d861ad5f1",
                "sha256:8f772942d372c8cbac575be99f9cc9d9fb3bd95c8bc2de6c01411e2c84ebca8a",
                "sha256:9fece120dbb041771a63eb95e4896791386fe287fefb2837258925b8326d6160",
                "sha256:a156e6390944c265eb56afa67c74c0636f10283429171018446b732f1a05af25",
                "sha256:a9ec1f695f0c25986e6f7f8778e5ce61659063268836a38c951200c57479cc12",
                "sha256:abed92d9c8f08643c7d831300b739562b0a6c9fcb028d211134fc9ab20ccad5d",
                "sha256:b031b9601f1060bf1281feab89697324726ba0c0bae9d7cd7ab4b690940f0b92",
                "sha256:c543214ffdd422623e9fedd0869166c2f16affe4ba37463975043ef7d2ea8770",
                "sha256:d28ddc3e3dfeab553e743e532fb95b4e6afad51d4706dd22f28e1e5e664828d2",
                "sha256:f33592ddf9655a4894aef22d134de7393e95fcbdc2d15c1ab65828eee5c66c70",
                "sha256:f6b0e77db9ff4fda74de7df13f30016a0a663928d669c9f2c057048ba44f09bb",
                "sha256:f757063a83970d67c444f6e01d9550a7402322af3557ce7630d3c957386fa8f5",
                "sha256:ff0cedc84184115202475bbb46dd99f8dcb87fe24d5d0ddfc0fe6b8575c88d2f"
            ],
            "index": "pypi",
            "markers": "python_version >= '3.8'",
            "version": "==1.5.1"
        },
        "mypy-extensions": {
            "hashes": [
                "sha256:4392f6c0eb8a5668a69e23d168ffa70f0be9ccfd32b5cc2d26a34ae5b844552d",
                "sha256:75dbf8955dc00442a438fc4d0666508a9a97b6bd41aa2f0ffe9d2f2725af0782"
            ],
            "markers": "python_version >= '3.5'",
            "version": "==1.0.0"
        },
        "packaging": {
            "hashes": [
                "sha256:994793af429502c4ea2ebf6bf664629d07c1a9fe974af92966e4b8d2df7edc61",
                "sha256:a392980d2b6cffa644431898be54b0045151319d1e7ec34f0cfed48767dd334f"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==23.1"
        },
        "pathspec": {
            "hashes": [
                "sha256:1d6ed233af05e679efb96b1851550ea95bbb64b7c490b0f5aa52996c11e92a20",
                "sha256:e0d8d0ac2f12da61956eb2306b69f9469b42f4deb0f3cb6ed47b9cce9996ced3"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==0.11.2"
        },
        "platformdirs": {
            "hashes": [
                "sha256:b45696dab2d7cc691a3226759c0d3b00c47c8b6e293d96f6436f733303f77f6d",
                "sha256:d7c24979f292f916dc9cbf8648319032f551ea8c49a4c9bf2fb556a02070ec1d"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==3.10.0"
        },
        "typing-extensions": {
            "hashes": [
                "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36",
                "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"
            ],
            "markers": "python_version >= '3.7'",
            "version": "==4.7.1"
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: Awaiting Update ⏳This issue requires more information before assistance can be provided.triage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions