Skip to content

Commit ec35f7f

Browse files
matteiusoz123
authored andcommitted
Remove --skip-lock flag
1 parent 8e6da34 commit ec35f7f

File tree

7 files changed

+15
-128
lines changed

7 files changed

+15
-128
lines changed

news/5805.removal.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The ``--skip-lock`` flag which was deprecated, has now been removed to unblock modernizing the pipenv resolver code.

pipenv/cli/command.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
pypi_mirror_option,
1616
python_option,
1717
site_packages_option,
18-
skip_lock_option,
1918
sync_options,
2019
system_option,
2120
uninstall_options,
@@ -223,7 +222,6 @@ def cli(
223222
@system_option
224223
@deploy_option
225224
@site_packages_option
226-
@skip_lock_option
227225
@install_options
228226
@pass_state
229227
def install(state, **kwargs):
@@ -237,7 +235,6 @@ def install(state, **kwargs):
237235
pypi_mirror=state.pypi_mirror,
238236
system=state.system,
239237
ignore_pipfile=state.installstate.ignore_pipfile,
240-
skip_lock=state.installstate.skip_lock,
241238
requirementstxt=state.installstate.requirementstxt,
242239
pre=state.installstate.pre,
243240
deploy=state.installstate.deploy,
@@ -314,7 +311,7 @@ def uninstall(ctx, state, all_dev=False, all=False, **kwargs):
314311
editable_packages=state.installstate.editables,
315312
python=state.python,
316313
system=state.system,
317-
lock=not state.installstate.skip_lock,
314+
lock=True,
318315
all_dev=all_dev,
319316
all=all,
320317
pypi_mirror=state.pypi_mirror,

pipenv/cli/options.py

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
from pipenv.project import Project
55
from pipenv.utils.internet import is_valid_url
6-
from pipenv.vendor import click
76
from pipenv.vendor.click import (
87
BadArgumentUsage,
98
BadParameter,
@@ -77,7 +76,6 @@ class InstallState:
7776
def __init__(self):
7877
self.dev = False
7978
self.pre = False
80-
self.skip_lock = False
8179
self.ignore_pipfile = False
8280
self.code = False
8381
self.requirementstxt = None
@@ -130,34 +128,6 @@ def callback(ctx, param, value):
130128
)(f)
131129

132130

133-
def skip_lock_option(f):
134-
def callback(ctx, param, value):
135-
state = ctx.ensure_object(State)
136-
state.installstate.skip_lock = value
137-
if value:
138-
click.secho(
139-
"The flag --skip-lock has been deprecated for removal. "
140-
"Without running the lock resolver it is not possible to manage multiple package indexes. "
141-
"Additionally it bypasses the build consistency guarantees provided by maintaining a lock file.",
142-
fg="yellow",
143-
bold=True,
144-
err=True,
145-
)
146-
return value
147-
148-
return option(
149-
"--skip-lock",
150-
is_flag=True,
151-
default=False,
152-
expose_value=False,
153-
help="Skip locking mechanisms and use the Pipfile instead during operation.",
154-
envvar="PIPENV_SKIP_LOCK",
155-
callback=callback,
156-
type=click_types.BOOL,
157-
show_envvar=True,
158-
)(f)
159-
160-
161131
def ignore_pipfile_option(f):
162132
def callback(ctx, param, value):
163133
state = ctx.ensure_object(State)
@@ -533,7 +503,6 @@ def uninstall_options(f):
533503
f = install_base_options(f)
534504
f = categories_option(f)
535505
f = uninstall_dev_option(f)
536-
f = skip_lock_option(f)
537506
f = editable_option(f)
538507
f = package_arg(f)
539508
return f

pipenv/routines/install.py

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ def do_install(
3838
pypi_mirror=None,
3939
system=False,
4040
ignore_pipfile=False,
41-
skip_lock=False,
4241
requirementstxt=False,
4342
pre=False,
4443
deploy=False,
@@ -72,7 +71,7 @@ def do_install(
7271
if not project.pipfile_exists and not (package_args or dev):
7372
if not (ignore_pipfile or deploy):
7473
raise exceptions.PipfileNotFound(project.path_to("Pipfile"))
75-
elif ((skip_lock and deploy) or ignore_pipfile) and not project.lockfile_exists:
74+
elif ignore_pipfile and not project.lockfile_exists:
7675
raise exceptions.LockfileNotFound(project.path_to("Pipfile.lock"))
7776
# Load the --pre settings from the Pipfile.
7877
if not pre:
@@ -173,7 +172,6 @@ def do_install(
173172
allow_global=system,
174173
ignore_pipfile=ignore_pipfile,
175174
system=system,
176-
skip_lock=skip_lock,
177175
deploy=deploy,
178176
pre=pre,
179177
requirements_dir=requirements_directory,
@@ -197,7 +195,6 @@ def do_install(
197195
requirements_dir=requirements_directory,
198196
deploy=deploy,
199197
pypi_mirror=pypi_mirror,
200-
skip_lock=skip_lock,
201198
extra_pip_args=extra_pip_args,
202199
categories=categories,
203200
)
@@ -300,7 +297,6 @@ def do_install(
300297
requirements_dir=requirements_directory,
301298
deploy=deploy,
302299
pypi_mirror=pypi_mirror,
303-
skip_lock=skip_lock,
304300
extra_pip_args=extra_pip_args,
305301
categories=categories,
306302
)
@@ -373,7 +369,6 @@ def do_install_dependencies(
373369
bare=False,
374370
allow_global=False,
375371
ignore_hashes=False,
376-
skip_lock=False,
377372
requirements_dir=None,
378373
pypi_mirror=None,
379374
extra_pip_args=None,
@@ -395,20 +390,14 @@ def do_install_dependencies(
395390
lockfile = None
396391
pipfile = None
397392
for category in categories:
398-
# Load the lockfile if it exists, or if dev_only is being used.
399-
if skip_lock:
400-
if not bare:
401-
click.secho("Installing dependencies from Pipfile...", bold=True)
402-
pipfile = project.get_pipfile_section(category)
403-
else:
404-
lockfile = project.get_or_create_lockfile(categories=categories)
405-
if not bare:
406-
click.secho(
407-
"Installing dependencies from Pipfile.lock ({})...".format(
408-
lockfile["_meta"].get("hash", {}).get("sha256")[-6:]
409-
),
410-
bold=True,
411-
)
393+
lockfile = project.get_or_create_lockfile(categories=categories)
394+
if not bare:
395+
click.secho(
396+
"Installing dependencies from Pipfile.lock ({})...".format(
397+
lockfile["_meta"].get("hash", {}).get("sha256")[-6:]
398+
),
399+
bold=True,
400+
)
412401
dev = dev or dev_only
413402
if lockfile:
414403
deps_list = list(
@@ -419,12 +408,11 @@ def do_install_dependencies(
419408
for req_name, specifier in pipfile.items():
420409
deps_list.append(Requirement.from_pipfile(req_name, specifier))
421410
failed_deps_queue = queue.Queue()
422-
if skip_lock:
423-
ignore_hashes = True
411+
424412
editable_or_vcs_deps = [dep for dep in deps_list if (dep.editable or dep.vcs)]
425413
normal_deps = [dep for dep in deps_list if not (dep.editable or dep.vcs)]
426414
install_kwargs = {
427-
"no_deps": not skip_lock,
415+
"no_deps": True,
428416
"ignore_hashes": ignore_hashes,
429417
"allow_global": allow_global,
430418
"pypi_mirror": pypi_mirror,
@@ -676,7 +664,6 @@ def do_init(
676664
dev_only=False,
677665
allow_global=False,
678666
ignore_pipfile=False,
679-
skip_lock=False,
680667
system=False,
681668
deploy=False,
682669
pre=False,
@@ -709,7 +696,7 @@ def do_init(
709696
suffix="-requirements", prefix="pipenv-"
710697
)
711698
# Write out the lockfile if it doesn't exist, but not if the Pipfile is being ignored
712-
if (project.lockfile_exists and not ignore_pipfile) and not skip_lock:
699+
if project.lockfile_exists and not ignore_pipfile:
713700
old_hash = project.get_lockfile_hash()
714701
new_hash = project.calculate_pipfile_hash()
715702
if new_hash != old_hash:
@@ -749,7 +736,7 @@ def do_init(
749736
categories=categories,
750737
)
751738
# Write out the lockfile if it doesn't exist.
752-
if not project.lockfile_exists and not skip_lock:
739+
if not project.lockfile_exists:
753740
# Unless we're in a virtualenv not managed by pipenv, abort if we're
754741
# using the system's python.
755742
if (system or allow_global) and not (project.s.PIPENV_VIRTUALENV):
@@ -778,7 +765,6 @@ def do_init(
778765
dev=dev,
779766
dev_only=dev_only,
780767
allow_global=allow_global,
781-
skip_lock=skip_lock,
782768
requirements_dir=requirements_dir,
783769
pypi_mirror=pypi_mirror,
784770
extra_pip_args=extra_pip_args,

tests/integration/test_install_twists.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -275,25 +275,3 @@ def test_outdated_should_compare_postreleases_without_failing(pipenv_instance_pr
275275
c = p.pipenv("update --outdated")
276276
assert c.returncode != 0
277277
assert "out-of-date" in c.stdout
278-
279-
280-
@pytest.mark.install
281-
@pytest.mark.skip_lock
282-
@pytest.mark.needs_internet
283-
def test_install_skip_lock(pipenv_instance_private_pypi):
284-
with pipenv_instance_private_pypi() as p:
285-
with open(p.pipfile_path, 'w') as f:
286-
contents = """
287-
[[source]]
288-
url = "{}"
289-
verify_ssl = true
290-
name = "pypi"
291-
292-
[packages]
293-
six = {}
294-
""".format(p.index_url, '{version = "*", index = "pypi"}').strip()
295-
f.write(contents)
296-
c = p.pipenv('install --skip-lock')
297-
assert c.returncode == 0
298-
c = p.pipenv('run python -c "import six"')
299-
assert c.returncode == 0

tests/integration/test_lock.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -262,36 +262,6 @@ def test_lock_extras_without_install(pipenv_instance_private_pypi):
262262
assert "extra == 'socks'" not in c.stdout.strip()
263263

264264

265-
@pytest.mark.skip(reason="Skip lock does not support multiple indexes sources; flag is considered for deprecation.")
266-
@pytest.mark.index
267-
@pytest.mark.install # private indexes need to be uncached for resolution
268-
@pytest.mark.skip_lock
269-
@pytest.mark.needs_internet
270-
def test_private_index_skip_lock(pipenv_instance_private_pypi):
271-
with pipenv_instance_private_pypi() as p:
272-
with open(p.pipfile_path, 'w') as f:
273-
contents = """
274-
[[source]]
275-
url = "https://pypi.org/simple"
276-
verify_ssl = true
277-
name = "pypi"
278-
279-
[[source]]
280-
url = "https://test.pypi.org/simple"
281-
verify_ssl = true
282-
name = "testpypi"
283-
284-
[packages]
285-
pipenv-test-private-package = {version = "*", index = "testpypi"}
286-
287-
[pipenv]
288-
install_search_all_sources = true
289-
""".strip()
290-
f.write(contents)
291-
c = p.pipenv('install --skip-lock')
292-
assert c.returncode == 0
293-
294-
295265
@pytest.mark.lock
296266
@pytest.mark.index
297267
@pytest.mark.install # private indexes need to be uncached for resolution

tests/integration/test_project.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -162,17 +162,3 @@ def test_run_in_virtualenv(pipenv_instance_pypi):
162162
c = p.pipenv("clean --dry-run")
163163
assert c.returncode == 0
164164
assert "click" in c.stdout
165-
166-
167-
@pytest.mark.project
168-
@pytest.mark.sources
169-
def test_no_sources_in_pipfile(pipenv_instance_pypi):
170-
with pipenv_instance_pypi() as p:
171-
with open(p.pipfile_path, 'w') as f:
172-
contents = """
173-
[packages]
174-
pytest = "*"
175-
""".strip()
176-
f.write(contents)
177-
c = p.pipenv('install --skip-lock')
178-
assert c.returncode == 0

0 commit comments

Comments
 (0)