Repository: pypa/pipenv

Issue:
SetuptoolsDeprecationWarning [...] `setuptools.config.read_configuration` became deprecated
### Issue description

After upgrading to Pipenv 2022.4.21 I get this warning on running `lock` and `sync` etc.:

```
/home/gert/.local/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
`setuptools.config.read_configuration` became deprecated.

For the time being, you can use the `setuptools.config.setupcfg` module
to access a backward compatible API, but this module is provisional
and might be removed in the future.

  warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
```

There's no traceback so I'm not sure what causes this, but to me it appears it could well be Pipenv's vendored dependency:
https://github.com/pypa/pipenv/blob/b5c7c1eb3bda3f15fdf78f38f9fb33fdaf207eb2/pipenv/vendor/requirementslib/models/setup_info.py#L516-L518

This is fixed upstream with https://github.com/sarugaku/requirementslib/pull/316

### Expected result

A silent and successful `pipenv lock` and installation of the venv with `pipenv sync --dev`.

### Actual result

The spurious warnings above.

### Steps to replicate

As I don't have this on every Pipenv-enabled 'project', but only on one particular one, I think it's because  I include a dependency that's editable-installed in the `Pipfile` like this.

1. Clone https://github.com/pypa/sampleproject
2. Create a Pipfile:
    ```
    [[source]]
    name = "pypi"
    url = "https://pypi.org/simple"
    verify_ssl = true

    [dev-packages]
    mypkg = {editable = true, path = ".", extras = ["development"]}

    [packages]
    mypkg = {editable = true, path = "."}

    [requires]
    python_version = "3.10"
    ```
3. Run `pipenv lock`
4. Observe warnings:
    ```
    $ pipenv lock
    Creating a virtualenv for this project...
    Pipfile: /home/gert/temp/sampleproject/Pipfile
    Using /usr/bin/python3 (3.10.4) to create virtualenv...
    ⠼ Creating virtual environment...created virtual environment CPython3.10.4.final.0-64 in 155ms
    creator CPython3Posix(dest=/home/gert/.local/share/virtualenvs/sampleproject-KET6yNd_, clear=False, no_vcs_ignore=False, global=False)
    seeder FromAppData(download=False, pip=bundle, setuptools=bundle, wheel=bundle, via=copy, app_data_dir=/home/gert/.local/share/virtualenv)
        added seed packages: pip==22.0.4, setuptools==62.1.0, wheel==0.37.1
    activators BashActivator,CShellActivator,FishActivator,NushellActivator,PowerShellActivator,PythonActivator

    ✔ Successfully created virtual environment! 
    Virtualenv location: /home/gert/.local/share/virtualenvs/sampleproject-KET6yNd_
    Locking [dev-packages] dependencies...
    Building requirements...
    /home/gert/.local/lib/python3.10/site-packages/setuptools/config/__init__.py:28: SetuptoolsDeprecationWarning: As setuptools moves its configuration towards `pyproject.toml`,
    `setuptools.config.read_configuration` became deprecated.

    For the time being, you can use the `setuptools.config.setupcfg` module
    to access a backward compatible API, but this module is provisional
    and might be removed in the future.

    warnings.warn(dedent(msg), SetuptoolsDeprecationWarning)
   ```

Use case: development of your own package, with a Pipfile in its repo.

-------------------------------------------------------------------------------

<details><summary>$ pipenv --support</summary>

Pipenv version: `'2022.4.21'`

Pipenv location: `'/home/gert/.local/lib/python3.10/site-packages/pipenv'`

Python location: `'/usr/bin/python'`

Python installations found:

  - `3.11.0`: `/home/gert/.pyenv/versions/3.11-dev/bin/python3`
  - `3.10.4`: `/usr/bin/python3`
  - `3.10.4`: `/usr/bin/python`
  - `3.10.4`: `/home/gert/.pyenv/versions/3.10.4/bin/python3`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '3.10.4',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '5.17.4-arch1-1',
 'platform_system': 'Linux',
 'platform_version': '#1 SMP PREEMPT Wed, 20 Apr 2022 18:29:28 +0000',
 'python_full_version': '3.10.4',
 'python_version': '3.10',
 'sys_platform': 'linux'}
```

System environment variables:

  - `SHELL`
  - `SESSION_MANAGER`
  - `WINDOWID`
  - `QT_SCREEN_SCALE_FACTORS`
  - `COLORTERM`
  - `PYENV_SHELL`
  - `XDG_CONFIG_DIRS`
  - `XDG_SESSION_PATH`
  - `LANGUAGE`
  - `SSH_AUTH_SOCK`
  - `SHELL_SESSION_ID`
  - `DESKTOP_SESSION`
  - `LC_MONETARY`
  - `GTK_RC_FILES`
  - `XCURSOR_SIZE`
  - `GTK_MODULES`
  - `XDG_SEAT`
  - `PWD`
  - `XDG_SESSION_DESKTOP`
  - `LOGNAME`
  - `XDG_SESSION_TYPE`
  - `SYSTEMD_EXEC_PID`
  - `XAUTHORITY`
  - `MOTD_SHOWN`
  - `GTK2_RC_FILES`
  - `HOME`
  - `LANG`
  - `XDG_CURRENT_DESKTOP`
  - `KONSOLE_DBUS_SERVICE`
  - `KONSOLE_DBUS_SESSION`
  - `PROFILEHOME`
  - `XDG_SEAT_PATH`
  - `KONSOLE_VERSION`
  - `KDE_SESSION_UID`
  - `XDG_SESSION_CLASS`
  - `TERM`
  - `USER`
  - `COLORFGBG`
  - `KDE_SESSION_VERSION`
  - `PAM_KWALLET5_LOGIN`
  - `DISPLAY`
  - `SHLVL`
  - `LC_MEASUREMENT`
  - `XDG_VTNR`
  - `XDG_SESSION_ID`
  - `PAPERSIZE`
  - `XDG_RUNTIME_DIR`
  - `LC_TIME`
  - `QT_AUTO_SCREEN_SCALE_FACTOR`
  - `XCURSOR_THEME`
  - `KDE_FULL_SESSION`
  - `PATH`
  - `DBUS_SESSION_BUS_ADDRESS`
  - `KDE_APPLICATIONS_AS_SCOPE`
  - `MAIL`
  - `LC_NUMERIC`
  - `OLDPWD`
  - `KONSOLE_DBUS_WINDOW`
  - `_`
  - `PIP_SHIMS_BASE_MODULE`
  - `PIP_DISABLE_PIP_VERSION_CHECK`
  - `PIP_PYTHON_PATH`
  - `PYTHONDONTWRITEBYTECODE`
  - `PYTHONFINDER_IGNORE_UNSUPPORTED`

Pipenv–specific environment variables:


Debug–specific environment variables:

  - `PATH`: `~/.local/bin:/home/gert/.pyenv/shims:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl`
  - `SHELL`: `/bin/bash`
  - `LANG`: `en_US.UTF-8`
  - `PWD`: `/home/gert/temp/sampleproject`


---------------------------

Contents of `Pipfile` ('/home/gert/temp/sampleproject/Pipfile'):

```toml
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
sampleproject = {editable = true, path = ".", extras = ["development"]}

[packages]
sampleproject = {editable = true, path = "."}

[requires]
python_version = "3.10"

```


Contents of `Pipfile.lock` ('/home/gert/temp/sampleproject/Pipfile.lock'):

```json
{
    "_meta": {
        "hash": {
            "sha256": "0d4f647925b713668873ae632d1643ffbbece47d1150c504fcd67f2c75e55ecd"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.10"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "peppercorn": {
            "hashes": [
                "sha256:46125cad688a9cf3b08e463bcb797891ee73ece93602a8ea6f14e40d1042d454",
                "sha256:96d7681d7a04545cfbaf2c6fb66de67b29cfc42421aa263e4c78f2cbb85be4c6"
            ],
            "version": "==0.6"
        },
        "sampleproject": {
            "editable": true,
            "path": "."
        }
    },
    "develop": {
        "peppercorn": {
            "hashes": [
                "sha256:46125cad688a9cf3b08e463bcb797891ee73ece93602a8ea6f14e40d1042d454",
                "sha256:96d7681d7a04545cfbaf2c6fb66de67b29cfc42421aa263e4c78f2cbb85be4c6"
            ],
            "version": "==0.6"
        },
        "sampleproject": {
            "editable": true,
            "path": "."
        }
    }
}

```
</details>



Discussion:

Resolving patch:
diff --git a/pipenv/vendor/requirementslib/__init__.py b/pipenv/vendor/requirementslib/__init__.py
--- a/pipenv/vendor/requirementslib/__init__.py
+++ b/pipenv/vendor/requirementslib/__init__.py
@@ -10,7 +10,7 @@
 from .models.pipfile import Pipfile
 from .models.requirements import Requirement
 
-__version__ = "1.6.3"
+__version__ = "1.6.4"
 
 
 logger = logging.getLogger(__name__)
diff --git a/pipenv/vendor/requirementslib/models/setup_info.py b/pipenv/vendor/requirementslib/models/setup_info.py
--- a/pipenv/vendor/requirementslib/models/setup_info.py
+++ b/pipenv/vendor/requirementslib/models/setup_info.py
@@ -513,7 +513,11 @@ def _find_in_dict(dict_: ast.Dict, name: str) -> "Optional[Any]":
 
 
 def setuptools_parse_setup_cfg(path):
-    from setuptools.config import read_configuration
+    try:
+        # v61.0.0 of setuptools deprecated setuptools.config.read_configuration
+        from setuptools.config.setupcfg import read_configuration
+    except ImportError:
+        from setuptools.config import read_configuration
 
     parsed = read_configuration(path)
     results = parsed.get("metadata", {})


Test patch: