Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix issue with skip-lock #5653

Merged
merged 3 commits into from
Apr 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions news/5653.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix regression with ``--skip-lock`` option with ``install`` command.
23 changes: 14 additions & 9 deletions pipenv/routines/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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)
Expand Down Expand Up @@ -375,7 +376,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(
Expand Down Expand Up @@ -473,15 +474,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:
Expand All @@ -492,9 +492,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
Expand Down