Repository: pypa/pipenv

Issue:
Cannot do: pipenv uninstall --skip-lock despite documentation
##### Issue description
Using the `--skip-lock` flag with `pipenv uninstall` results in :

```
Error: no such option: --skip-lock
```

Although the documentation [states](https://pipenv.readthedocs.io/en/latest/basics/#pipenv-uninstall) that:

> $ pipenv uninstall supports all of the parameters in pipenv install, [...] 

(therefore including --skip-lock)

Obviously, this can be a simple documentation fix, but it would be more interesting to add the `skip-lock` flag to `pipenv uninstall`. This is interesting for CI environments, where you might want to drop a package temporarily and don't care about locking the dependencies (that takes a significant amount of times, > 7 mins in my env). In one word: speedup.









Discussion:
Hmmm that is an interesting suggestion. It seems straightforward — if it’s present in your pipfile, we can remove it, if not, it will just be removed from the lockfile.

This makes sense to me simply as an interface over your pipfile from a UX standpoint. However locking should also benefit from speedups we added a long time ago related to caching, so there may be more going on here 
As of 2018.10.13, `pipenv uninstall` accepts `--skip-lock` but does not honor it:

```
$ pipenv uninstall csvkit --skip-lock
Un-installing csvkit…
Uninstalling csvkit-1.0.3:
  Successfully uninstalled csvkit-1.0.3

Removing csvkit from Pipfile…
Locking [dev-packages] dependencies…
Locking [packages] dependencies…
Updated Pipfile.lock (4c3760)!
```



Resolving patch:
diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py
--- a/pipenv/cli/command.py
+++ b/pipenv/cli/command.py
@@ -253,7 +253,7 @@ def install(
 
 
 @cli.command(short_help="Un-installs a provided package and removes it from Pipfile.")
-@option("--lock", is_flag=True, default=True, help="Lock afterwards.")
+@option("--skip-lock/--lock", is_flag=True, default=False, help="Lock afterwards.")
 @option(
     "--all-dev",
     is_flag=True,
@@ -272,7 +272,7 @@ def install(
 def uninstall(
     ctx,
     state,
-    lock=False,
+    skip_lock=False,
     all_dev=False,
     all=False,
     **kwargs
@@ -286,7 +286,7 @@ def uninstall(
         three=state.three,
         python=state.python,
         system=state.system,
-        lock=lock,
+        lock=not skip_lock,
         all_dev=all_dev,
         all=all,
         keep_outdated=state.installstate.keep_outdated,
diff --git a/pipenv/cli/options.py b/pipenv/cli/options.py
--- a/pipenv/cli/options.py
+++ b/pipenv/cli/options.py
@@ -353,6 +353,7 @@ def uninstall_options(f):
 def lock_options(f):
     f = install_base_options(f)
     f = requirements_flag(f)
+    f = skip_lock_option(f)
     f = pre_option(f)
     return f
 
diff --git a/pipenv/core.py b/pipenv/core.py
--- a/pipenv/core.py
+++ b/pipenv/core.py
@@ -920,7 +920,7 @@ def do_create_virtualenv(python=None, site_packages=False, pypi_mirror=None):
         pip_config = {}
 
     # Actually create the virtualenv.
-    nospin = os.environ.get("PIPENV_ACTIVE", environments.PIPENV_NOSPIN)
+    nospin = environments.PIPENV_NOSPIN
     c = vistir.misc.run(cmd, verbose=False, return_object=True,
                 spinner_name=environments.PIPENV_SPINNER, combine_stderr=False,
                 block=False, nospin=nospin, env=pip_config)
@@ -935,7 +935,7 @@ def do_create_virtualenv(python=None, site_packages=False, pypi_mirror=None):
     project_file_name = os.path.join(project.virtualenv_location, ".project")
     with open(project_file_name, "w") as f:
         f.write(vistir.misc.fs_str(project.project_directory))
-
+    fix_venv_site(project.env_paths["lib"])
     # Say where the virtualenv is.
     do_where(virtualenv=True, bare=False)
 
@@ -2040,6 +2040,7 @@ def do_uninstall(
 ):
     from .environments import PIPENV_USE_SYSTEM
     from .vendor.requirementslib.models.requirements import Requirement
+    from .vendor.requirementslib.models.lockfile import Lockfile
     from .vendor.packaging.utils import canonicalize_name
 
     # Automatically use an activated virtualenv.
@@ -2118,9 +2119,17 @@ def do_uninstall(
         )
         do_purge(allow_global=system)
         removed = package_names - bad_pkgs
-        project.remove_packages_from_pipfile(removed)
-        if lock:
-            do_lock(system=system, keep_outdated=keep_outdated, pypi_mirror=pypi_mirror)
+        if pipfile_remove:
+            project.remove_packages_from_pipfile(removed)
+            if lock:
+                do_lock(system=system, keep_outdated=keep_outdated, pypi_mirror=pypi_mirror)
+            else:
+                lockfile = project.get_or_create_lockfile()
+                for key in lockfile.default.keys():
+                    del lockfile.default[key]
+                for key in lockfile.develop.keys():
+                    del lockfile.develop[key]
+                lockfile.write()
         return
     if all_dev:
         package_names = develop
@@ -2142,7 +2151,7 @@ def do_uninstall(
         # Uninstall the package.
         if package_name in packages_to_remove:
             cmd = "{0} uninstall {1} -y".format(
-                        escape_grouped_arguments(which_pip()), package_name
+                        escape_grouped_arguments(which_pip(allow_global=system)), package_name
                     )
             if environments.is_verbose():
                 click.echo("$ {0}".format(cmd))
@@ -2155,6 +2164,19 @@ def do_uninstall(
             in_dev_packages = project.get_package_name_in_pipfile(
                 package_name, dev=True
             )
+            if normalized in lockfile_packages:
+                click.echo("{0} {1} {2} {3}".format(
+                    crayons.blue("Removing"),
+                    crayons.green(package_name),
+                    crayons.blue("from"),
+                    crayons.white(fix_utf8("Pipfile.lock…")))
+                )
+                lockfile = project.get_or_create_lockfile()
+                if normalized in lockfile.default:
+                    del lockfile.default[normalized]
+                if normalized in lockfile.develop:
+                    del lockfile.develop[normalized]
+                lockfile.write()
             if not (in_dev_packages or in_packages):
                 if normalized in lockfile_packages:
                     continue


Test patch: