Repository: pypa/pipenv

Issue:
--skip-lock throws validation error
### Issue description

`--skip-lock` flag throws a validation error

### Expected result

That I get the same successful behaviour as in 2018.11.26 .

### Actual result

Throws a validation error due to the `--skip-lock` flag.

```
Installing dependencies from Pipfile…
Traceback (most recent call last):
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/pipenv", line 11, in <module>
    load_entry_point('pipenv==2018.11.26', 'console_scripts', 'pipenv')()
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/cli/command.py", line 254, in install
    editable_packages=state.installstate.editables,
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1874, in do_install
    keep_outdated=keep_outdated
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 1253, in do_init
    pypi_mirror=pypi_mirror,
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/core.py", line 795, in do_install_dependencies
    lockfile = project.get_or_create_lockfile(from_pipfile=True)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/project.py", line 756, in get_or_create_lockfile
    path=self.lockfile_location, data=lockfile_dict, meta_from_project=False
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/lockfile.py", line 209, in from_data
    lockfile = plette.lockfiles.Lockfile(data)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/plette/models/base.py", line 37, in __init__
    self.validate(data)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/plette/lockfiles.py", line 80, in validate
    klass.validate(data[key])
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/plette/models/sections.py", line 70, in validate
    klass.validate(data[key])
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/plette/models/base.py", line 132, in validate
    cls.item_class.validate(d)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/plette/models/base.py", line 67, in validate
    return validate(cls, data)
  File "/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv/vendor/requirementslib/models/pipfile.py", line 59, in validate
    raise plette.models.base.ValidationError(data, v)
plette.models.base.ValidationError: {'url': 'https://pypi.python.org/simple', 'verify_ssl': True}
```

### Steps to replicate

I have a simple Pipfile like

```
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true

[requires]
python_version = "3.7"

[dev-packages]
"boto3" = "*"
"flake8" = "*"

[packages]
requests = "*"
```

and run `pipenv install --skip-lock --dev`.

-------------------------------------------------------------------------------

<details><summary>$ pipenv --support</summary>

Pipenv version: `'2018.11.26'`

Pipenv location: `'/usr/local/Cellar/pipenv/2018.11.26/libexec/lib/python3.7/site-packages/pipenv'`

Python location: `'/usr/local/Cellar/pipenv/2018.11.26/libexec/bin/python3.7'`

Python installations found:

  - `3.7.2`: `/usr/local/bin/python3`
  - `3.7.2`: `/usr/local/bin/python3.7m`
  - `3.7.1`: `/Users/andrei/.pyenv/versions/3.7.1/bin/python3`
  - `3.7.1`: `/Users/andrei/.pyenv/versions/3.7.1/bin/python3.7m`
  - `3.7.0`: `/Users/andrei/.pyenv/versions/3.7.0/bin/python3`
  - `3.7.0`: `/Users/andrei/.pyenv/versions/3.7.0/bin/python3.7m`
  - `2.7.15`: `/usr/local/bin/python`
  - `2.7.15`: `/usr/local/bin/pythonw`
  - `2.7.10`: `/usr/bin/python`
  - `2.7.10`: `/usr/bin/pythonw`
  - `2.7.10`: `/usr/bin/python2.7`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '3.7.2',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '18.2.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 18.2.0: Fri Dec 14 18:43:36 PST '
                     '2018; root:xnu-4903.240.10~4/RELEASE_X86_64',
 'python_full_version': '3.7.2',
 'python_version': '3.7',
 'sys_platform': 'darwin'}
```

System environment variables:

  - `PATH`
  - `GIT_PS1_SHOWDIRTYSTATE`
  - `MANPATH`
  - `rvm_use_flag`
  - `LESS_TERMCAP_mb`
  - `rvm_bin_path`
  - `TERM_PROGRAM`
  - `LESS_TERMCAP_md`
  - `rvm_quiet_flag`
  - `GEM_HOME`
  - `LESS_TERMCAP_me`
  - `rvm_gemstone_url`
  - `TERM`
  - `SHELL`
  - `CLICOLOR`
  - `HISTSIZE`
  - `rvm_docs_type`
  - `PIPENV_VENV_IN_PROJECT`
  - `ITERM_SHELL_INTEGRATION_INSTALLED`
  - `IRBRC`
  - `TMPDIR`
  - `Apple_PubSub_Socket_Render`
  - `AUTOJUMP_KEEP_SYMLINKS`
  - `TERM_PROGRAM_VERSION`
  - `TRAVIS_API_TOKEN`
  - `GIT_PS1_STATESEPARATOR`
  - `rvm_hook`
  - `MY_RUBY_HOME`
  - `LESS_TERMCAP_ue`
  - `AUTOJUMP_IGNORE_CASE`
  - `TIME_STYLE`
  - `TERM_SESSION_ID`
  - `GIT_PS1_SHOWCOLORHINTS`
  - `FLAGS_GETOPT_CMD`
  - `LC_ALL`
  - `GIT_EDITOR`
  - `GIT_TERMINAL_PROMPT`
  - `NVM_DIR`
  - `HISTFILESIZE`
  - `USER`
  - `rvm_gemstone_package_file`
  - `PROMPT_ANDREI_ONLINE`
  - `_system_type`
  - `HOMEBREW_NO_ANALYTICS`
  - `rvm_path`
  - `ENV`
  - `SSH_AUTH_SOCK`
  - `HOMEBREW_NO_AUTO_UPDATE`
  - `__CF_USER_TEXT_ENCODING`
  - `rvm_proxy`
  - `rvm_ruby_file`
  - `PAGER`
  - `ERL_LIBS`
  - `LC_TYPE`
  - `LSCOLORS`
  - `LESS_TERMCAP_us`
  - `rvm_silent_flag`
  - `rvm_prefix`
  - `rvm_ruby_make`
  - `_`
  - `WORDCHARS`
  - `PWD`
  - `HOMEBREW_GITHUB_API_TOKEN`
  - `EDITOR`
  - `rvm_sdk`
  - `LANG`
  - `BRCD_RANONCE`
  - `ITERM_PROFILE`
  - `_system_arch`
  - `XPC_FLAGS`
  - `_system_version`
  - `GIT_MERGE_AUTOEDIT`
  - `GIT_PS1_HIDE_IF_PWD_IGNORED`
  - `GIT_PS1_SHOWUNTRACKEDFILES`
  - `HISTIGNORE`
  - `HISTCONTROL`
  - `XPC_SERVICE_NAME`
  - `rvm_version`
  - `rvm_script_name`
  - `rvm_pretty_print_flag`
  - `PYENV_SHELL`
  - `T_AWS_IAM_INC_SH_DIR`
  - `SHLVL`
  - `HOME`
  - `COLORFGBG`
  - `rvm_ruby_mode`
  - `LC_TERMINAL_VERSION`
  - `LS_OPTIONS`
  - `GIT_PS1_SHOWSTASHSTATE`
  - `BASH_ENV`
  - `ITERM_SESSION_ID`
  - `LESS`
  - `LOGNAME`
  - `rvm_alias_expanded`
  - `GIT_PS1_SHOWUPSTREAM`
  - `VISUAL`
  - `GEM_PATH`
  - `LESS_TERMCAP_so`
  - `LC_CTYPE`
  - `PROMPT_ANDREI_BATTERY`
  - `LESSOPEN`
  - `GOPATH`
  - `rvm_nightly_flag`
  - `BROWSER`
  - `rvm_ruby_make_install`
  - `PROMPT_EOL_MARK`
  - `rvm_niceness`
  - `LC_TERMINAL`
  - `rvm_ruby_bits`
  - `rvm_bin_flag`
  - `rvm_only_path_flag`
  - `RUBY_VERSION`
  - `SQLITE_EXEMPT_PATH_FROM_VNODE_GUARDS`
  - `_system_name`
  - `HISTFILE`
  - `LESS_TERMCAP_se`
  - `COLORTERM`
  - `PIP_DISABLE_PIP_VERSION_CHECK`
  - `PYTHONDONTWRITEBYTECODE`
  - `PIP_SHIMS_BASE_MODULE`
  - `PIP_PYTHON_PATH`
  - `PYTHONFINDER_IGNORE_UNSUPPORTED`

Pipenv–specific environment variables:

 - `PIPENV_VENV_IN_PROJECT`: `1`

Debug–specific environment variables:

  - `PATH`: `/usr/local/Cellar/pipenv/2018.11.26/libexec/tools:/Users/andrei/.pyenv/shims:/Users/andrei/.rvm/gems/ruby-2.0.0-p648/bin:/Users/andrei/.rvm/gems/ruby-2.0.0-p648@global/bin:/Users/andrei/.rvm/rubies/ruby-2.0.0-p648/bin:/usr/local/bin:/usr/local/sbin:/Users/andrei/bin:/usr/local/MacGPG2/bin:/usr/local/opt/go/libexec/bin:/Users/andrei/.yarn/bin:/usr/local/opt/perl/bin:/usr/local/opt/unzip/bin:/usr/local/opt/curl/bin:/usr/local/opt/make/libexec/gnubin:/usr/local/opt/gzip/libexec/gnubin:/usr/local/opt/grep/libexec/gnubin:/usr/local/opt/gnu-which/libexec/gnubin:/usr/local/opt/gnu-time/libexec/gnubin:/usr/local/opt/gnu-tar/libexec/gnubin:/usr/local/opt/gnu-sed/libexec/gnubin:/usr/local/opt/findutils/libexec/gnubin:/usr/local/opt/coreutils/libexec/gnubin:/usr/texbin:/usr/bin:/bin:/usr/sbin:/sbin:./node_modules/.bin:/Users/andrei/node_modules/.bin:/Users/andrei/bin/git:/Users/andrei/bin/ansiweather.git:/Users/andrei/bin/git-extra.git:/Users/andrei/bin/git-fiddle.git:/Users/andrei/bin/git-guilt.git:/Users/andrei/bin/git-number.git:/Users/andrei/bin/git-ssdiff.git:/Users/andrei/bin/git-timeofday.git:/Users/andrei/bin/qc.git:/Users/andrei/bin/showlinenum.git:/Users/andrei/bin/skel-complete.git:/Users/andrei/bin/qc.git/qc:/Users/andrei/bin/git-guilt.git/bin:/usr/local/opt/git/share/git-core/contrib/workdir:/Users/andrei/.rvm/bin:/Users/andrei/.rvm/bin:/Users/andrei/git/firecloud/support-firecloud/bin`
  - `SHELL`: `/usr/local/bin/zsh`
  - `EDITOR`: `/usr/local/bin/emacs`
  - `LANG`: `en_US.UTF-8`
  - `PWD`: `/Users/andrei/git/firecloud/atex-platform/apex/functions/python`


---------------------------

Contents of `Pipfile` ('/Users/andrei/git/firecloud/atex-platform/apex/functions/python/Pipfile'):

```toml
[[source]]
url = "https://pypi.python.org/simple"
verify_ssl = true

[requires]
python_version = "3.7"

[dev-packages]
"boto3" = "*"
"flake8" = "*"

[packages]
requests = "*"

```

</details>



Discussion:

Resolving patch:
diff --git a/pipenv/project.py b/pipenv/project.py
--- a/pipenv/project.py
+++ b/pipenv/project.py
@@ -780,7 +780,7 @@ def get_lockfile_meta(self):
         return {
             "hash": {"sha256": self.calculate_pipfile_hash()},
             "pipfile-spec": PIPFILE_SPEC_CURRENT,
-            "sources": sources,
+            "sources": [self.populate_source(s) for s in sources],
             "requires": self.parsed_pipfile.get("requires", {})
         }
 


Test patch:
diff --git a/tests/integration/test_lock.py b/tests/integration/test_lock.py
--- a/tests/integration/test_lock.py
+++ b/tests/integration/test_lock.py
@@ -491,6 +491,7 @@ def test_lockfile_with_empty_dict(PipenvInstance):
 
 
 @pytest.mark.lock
+@pytest.mark.skip_lock
 @pytest.mark.install
 def test_lock_with_incomplete_source(PipenvInstance, pypi):
     with PipenvInstance(pypi=pypi, chdir=True) as p:
@@ -502,6 +503,8 @@ def test_lock_with_incomplete_source(PipenvInstance, pypi):
 [packages]
 requests = "*"
             """)
+        c = p.pipenv('install --skip-lock')
+        assert c.return_code == 0
         c = p.pipenv('install')
         assert c.return_code == 0
         assert p.lockfile['_meta']['sources']