Repository: pypa/pipenv

Issue:
in version 9.0.0 pypenv install always installs dev-packages (regression ?)
Pipenv 9.0.0 always install dev packages, instead of just installing packages from `[packages]` section.

Pipenv 8.3.2 works as expected.

##### Describe your environment

1. Docker image : python:3.6.3-alpine
1. Python version: 3.6.3
1. Pipenv version: 9.0.0

##### Expected result

`pipenv install` should only install packages from `[packages]` section

##### Actual result

`pipenv install` actually installs all packages, both from `[packages]` and `[dev-packages]` section

##### Steps to replicate

```
[[source]]

url = "https://pypi.python.org/simple"
verify_ssl = true
name = "pypi"


[packages]

django = "*"


[dev-packages]

ipython = "*"
```

```
$ pipenv install
$ pipenv graph
Django==2.0
  - pytz [required: Any, installed: 2017.3]
ipython==6.2.1
  - decorator [required: Any, installed: 4.1.2]
  - jedi [required: >=0.10, installed: 0.11.0]
    - parso [required: ==0.1.0, installed: 0.1.0]
  - pexpect [required: Any, installed: 4.3.0]
    - ptyprocess [required: >=0.5, installed: 0.5.2]
  - pickleshare [required: Any, installed: 0.7.4]
  - prompt-toolkit [required: >=1.0.4,<2.0.0, installed: 1.0.15]
    - six [required: >=1.9.0, installed: 1.11.0]
    - wcwidth [required: Any, installed: 0.1.7]
  - pygments [required: Any, installed: 2.2.0]
  - setuptools [required: >=18.5, installed: 38.2.4]
  - simplegeneric [required: >0.8, installed: 0.8.1]
  - traitlets [required: >=4.2, installed: 4.3.2]
    - decorator [required: Any, installed: 4.1.2]
    - ipython-genutils [required: Any, installed: 0.2.0]
    - six [required: Any, installed: 1.11.0]
```



Discussion:
@jlirochon thanks for the report, I can reproduce this using the provided pipfile.  This is definitely a regression and I will look at addressing it asap

Resolving patch:
diff --git a/pipenv/utils.py b/pipenv/utils.py
--- a/pipenv/utils.py
+++ b/pipenv/utils.py
@@ -998,6 +998,8 @@ def merge_deps(file_dict, project, dev=False, requirements=False, ignore_hashes=
         if not file_dict[section] or section_name not in ('dev-packages', 'packages', 'default', 'develop'):
             continue
         is_dev = section_name in ('dev-packages', 'develop')
+        if is_dev and not dev:
+            continue
 
         if ignore_hashes:
             for k, v in file_dict[section]:


Test patch:
diff --git a/tests/test_pipenv.py b/tests/test_pipenv.py
--- a/tests/test_pipenv.py
+++ b/tests/test_pipenv.py
@@ -243,6 +243,32 @@ def test_basic_dev_install(self):
             c = p.pipenv('run python -m requests.help')
             assert c.return_code == 0
 
+    @pytest.mark.dev
+    @pytest.mark.install
+    def test_install_without_dev(self):
+        """Ensure that running `pipenv install` doesn't install dev packages"""
+        with PipenvInstance() as p:
+            with open(p.pipfile_path, 'w') as f:
+                contents = """
+[packages]
+tablib = "*"
+
+[dev-packages]
+records = "*"
+                """.strip()
+                f.write(contents)
+            c = p.pipenv('install')
+            assert c.return_code == 0
+            assert 'tablib' in p.pipfile['packages']
+            assert 'records' in p.pipfile['dev-packages']
+            assert 'tablib' in p.lockfile['default']
+            assert 'records' in p.lockfile['develop']
+            c = p.pipenv('run python -c "import records"')
+            assert c.return_code != 0
+            c = p.pipenv('run python -c "import tablib"')
+            assert c.return_code == 0
+                
+
     @pytest.mark.run
     @pytest.mark.uninstall
     def test_uninstall(self):