From fef23366c0d11a5660464d00d2d83b9949c50d09 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 16 Apr 2023 20:11:33 -0400 Subject: [PATCH 1/3] Fix issue with skip-lock --- pipenv/routines/install.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/pipenv/routines/install.py b/pipenv/routines/install.py index 44bba7d3b8..d0e83e24db 100644 --- a/pipenv/routines/install.py +++ b/pipenv/routines/install.py @@ -23,6 +23,8 @@ from pipenv.utils.requirements import import_requirements from pipenv.utils.virtualenv import cleanup_virtualenv, do_create_virtualenv from pipenv.vendor import click, vistir +from pipenv.vendor.requirementslib.models.requirements import Requirement + console = rich.console.Console() err = rich.console.Console(stderr=True) @@ -375,7 +377,7 @@ def do_install( st.console.print( environments.PIPENV_SPINNER_OK_TEXT.format("Installation Succeeded") ) - # Update project settings with pre preference. + # Update project settings with pre-release preference. if pre: project.update_settings({"allow_prereleases": pre}) do_init( @@ -473,15 +475,14 @@ def do_install_dependencies( else: categories = ["packages"] + lockfile = None + pipfile = None for category in categories: # Load the lockfile if it exists, or if dev_only is being used. - if skip_lock or not project.lockfile_exists: + if skip_lock: if not bare: click.secho("Installing dependencies from Pipfile...", bold=True) - # skip_lock should completely bypass the lockfile (broken in 4dac1676) - lockfile = project.get_or_create_lockfile( - categories=categories, from_pipfile=True - ) + pipfile = project.get_pipfile_section(category) else: lockfile = project.get_or_create_lockfile(categories=categories) if not bare: @@ -492,9 +493,14 @@ def do_install_dependencies( bold=True, ) dev = dev or dev_only - deps_list = list( - lockfile.get_requirements(dev=dev, only=dev_only, categories=[category]) - ) + if lockfile: + deps_list = list( + lockfile.get_requirements(dev=dev, only=dev_only, categories=[category]) + ) + else: + deps_list = [] + for req_name, specifier in pipfile.items(): + deps_list.append(Requirement.from_pipfile(req_name, specifier)) failed_deps_queue = queue.Queue() if skip_lock: ignore_hashes = True From 959c2025fd56af69dc767ab607299d15184ab090 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 16 Apr 2023 20:21:21 -0400 Subject: [PATCH 2/3] fix lint --- .pre-commit-config.yaml | 2 +- pipenv/routines/install.py | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 04da519173..9cc703c702 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -21,7 +21,7 @@ repos: rev: v0.0.259 hooks: - id: ruff - # args: [--fix, --exit-non-zero-on-fix] + args: [--fix, --exit-non-zero-on-fix] - repo: https://github.com/psf/black rev: 23.1.0 diff --git a/pipenv/routines/install.py b/pipenv/routines/install.py index d0e83e24db..90fdddc1f8 100644 --- a/pipenv/routines/install.py +++ b/pipenv/routines/install.py @@ -25,7 +25,6 @@ from pipenv.vendor import click, vistir from pipenv.vendor.requirementslib.models.requirements import Requirement - console = rich.console.Console() err = rich.console.Console(stderr=True) From 3c60f657bc6e54a1ced9662c226920536df232d8 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 18 Apr 2023 06:43:43 -0400 Subject: [PATCH 3/3] add news fragment. --- news/5653.bugfix.rst | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/5653.bugfix.rst diff --git a/news/5653.bugfix.rst b/news/5653.bugfix.rst new file mode 100644 index 0000000000..558e6965b1 --- /dev/null +++ b/news/5653.bugfix.rst @@ -0,0 +1 @@ +Fix regression with ``--skip-lock`` option with ``install`` command.