Repository: pypa/pipenv

Issue:
Python 3.10 is shown as python_version = "3.1" in Pipfile and Pipfile.lock
### Issue description

Python 3.10 is shown as `python_version = "3.1"` in Pipfile and Pipfile.lock

```
        "requires": {
            "python_version": "3.1"
        },
```

### Expected result

`python_version = "3.10"`

### Steps to replicate

- On a fresh macOS 10.14.6, installed and activated Python 3.10.0a0 (using pyenv)

```
brew install pyenv

echo -e 'export LC_ALL=en_US.UTF-8\nexport LANG=en_US.UTF-8' >> ~/.bash_profile
echo -e 'export PIPENV_VENV_IN_PROJECT=1\nexport PYENV_ROOT=$HOME/.pyenv\nexport PIPENV_PYTHON=$PYENV_ROOT/shims/python\n' >> ~/.bash_profile
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n  eval "$(pyenv init -)"\nfi' >> ~/.bash_profile

# in new shell
pyenv install 3.10-dev
pyenv global 3.10-dev
```

- installed latest pipenv and installed the requests package:

```
pip install git+https://github.com/pypa/pipenv.git
mkdir test1 && cd test1
pipenv install requests
pipenv shell
```

- then checked the Pipfiles

-------------------------------------------------------------------------------

<details><summary>$ pipenv --support</summary>

Pipenv version: `'2020.6.2.dev0'`

Pipenv location: `'/Users/editor/.pyenv/versions/3.10-dev/lib/python3.10/site-packages/pipenv'`

Python location: `'/Users/editor/.pyenv/versions/3.10-dev/bin/python3.10'`

Python installations found:

  - `3.10.0`: `/Users/editor/test1/.venv/bin/python3`
  - `3.10.0`: `/Users/editor/test1/.venv/bin/python3`
  - `3.10.0`: `/Users/editor/.pyenv/versions/3.10-dev/bin/python3`
  - `3.10.0`: `/Users/editor/.pyenv/versions/3.10-dev/bin/python3`
  - `3.6.10`: `/Users/editor/.pyenv/versions/3.6.10/bin/python3`
  - `2.7.10`: `/usr/bin/python2.7`

PEP 508 Information:

```
{'implementation_name': 'cpython',
 'implementation_version': '3.10.0a0',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '18.6.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 18.6.0: Sun Apr 28 18:06:45 PDT '
                     '2019; root:xnu-4903.261.4~6/RELEASE_X86_64',
 'python_full_version': '3.10.0a0',
 'python_version': '3.1',
 'sys_platform': 'darwin'}
```

System environment variables:

  - `TERM_PROGRAM`
  - `PIPENV_PYTHON`
  - `PYENV_ROOT`
  - `PIP_PYTHON_PATH`
  - `TERM`
  - `SHELL`
  - `PIPENV_VENV_IN_PROJECT`
  - `TMPDIR`
  - `Apple_PubSub_Socket_Render`
  - `TERM_PROGRAM_VERSION`
  - `TERM_SESSION_ID`
  - `LC_ALL`
  - `PYENV_VERSION`
  - `USER`
  - `PYENV_DIR`
  - `SSH_AUTH_SOCK`
  - `__CF_USER_TEXT_ENCODING`
  - `VIRTUAL_ENV`
  - `PIPENV_ACTIVE`
  - `PATH`
  - `PWD`
  - `LANG`
  - `PYENV_HOOK_PATH`
  - `XPC_FLAGS`
  - `PS1`
  - `PYTHONDONTWRITEBYTECODE`
  - `XPC_SERVICE_NAME`
  - `PYENV_SHELL`
  - `HOME`
  - `SHLVL`
  - `LOGNAME`
  - `PIP_DISABLE_PIP_VERSION_CHECK`
  - `LC_CTYPE`
  - `_`
  - `PIP_SHIMS_BASE_MODULE`
  - `PYTHONFINDER_IGNORE_UNSUPPORTED`

Pipenv–specific environment variables:

 - `PIPENV_PYTHON`: `/Users/editor/.pyenv/shims/python`
 - `PIPENV_VENV_IN_PROJECT`: `1`
 - `PIPENV_ACTIVE`: `1`

Debug–specific environment variables:

  - `PATH`: `/Users/editor/test1/.venv/bin:/Users/editor/.pyenv/versions/3.10-dev/bin:/usr/local/Cellar/pyenv/1.2.19/libexec:/Users/editor/.pyenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin`
  - `SHELL`: `/bin/bash`
  - `LANG`: `en_US.UTF-8`
  - `PWD`: `/Users/editor/test1`
  - `VIRTUAL_ENV`: `/Users/editor/test1/.venv`


---------------------------

Contents of `Pipfile` ('/Users/editor/test1/Pipfile'):

```toml
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
requests = "*"

[requires]
python_version = "3.1"

```


Contents of `Pipfile.lock` ('/Users/editor/test1/Pipfile.lock'):

```json
{
    "_meta": {
        "hash": {
            "sha256": "ab48fa1b55b806a9cdac8488497e868f2273a61ea4c5abcca9609059197e1136"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.1"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "certifi": {
            "hashes": [
                "sha256:5930595817496dd21bb8dc35dad090f1c2cd0adfaf21204bf6732ca5d8ee34d3",
                "sha256:8fc0819f1f30ba15bdb34cceffb9ef04d99f420f68eb75d901e9560b8749fc41"
            ],
            "version": "==2020.6.20"
        },
        "chardet": {
            "hashes": [
                "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
                "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
            ],
            "version": "==3.0.4"
        },
        "idna": {
            "hashes": [
                "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6",
                "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
            "version": "==2.10"
        },
        "requests": {
            "hashes": [
                "sha256:b3559a131db72c33ee969480840fff4bb6dd111de7dd27c8ee1f820f4f00231b",
                "sha256:fe75cc94a9443b9246fc7049224f75604b113c36acb93f87b80ed42c44cbb898"
            ],
            "index": "pypi",
            "version": "==2.24.0"
        },
        "urllib3": {
            "hashes": [
                "sha256:3018294ebefce6572a474f0604c2021e33b3fd8006ecd11d62107a5d2a963527",
                "sha256:88206b0eb87e6d677d424843ac5209e3fb9d0190d0ee169599165ec25e9d9115"
            ],
            "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' and python_version < '4'",
            "version": "==1.25.9"
        }
    },
    "develop": {}
}

```
</details>




Discussion:

Resolving patch:
diff --git a/pipenv/project.py b/pipenv/project.py
--- a/pipenv/project.py
+++ b/pipenv/project.py
@@ -756,8 +756,8 @@ def create_pipfile(self, python=None):
             else:
                 required_python = self.which("python")
         version = python_version(required_python) or PIPENV_DEFAULT_PYTHON_VERSION
-        if version and len(version) >= 3:
-            data[u"requires"] = {"python_version": version[: len("2.7")]}
+        if version and len(version.split(".")) > 2:
+            data[u"requires"] = {"python_version": ".".join(version.split(".")[:2])}
         self.write_toml(data)
 
     @classmethod
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -42,7 +42,7 @@
         "parver",
         "invoke",
     ],
-    "tests": ["pytest<5.0", "pytest-timeout", "pytest-xdist", "flaky", "mock"],
+    "tests": ["pytest<5.0", "pytest-timeout", "pytest-xdist<2.0", "flaky", "mock"],
 }
 
 


Test patch:
diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py
--- a/tests/integration/test_install_basic.py
+++ b/tests/integration/test_install_basic.py
@@ -419,7 +419,7 @@ def test_install_venv_project_directory(PipenvInstance):
 @pytest.mark.system
 def test_system_and_deploy_work(PipenvInstance):
     with PipenvInstance(chdir=True) as p:
-        c = p.pipenv("install six requests")
+        c = p.pipenv("install tablib")
         assert c.return_code == 0
         c = p.pipenv("--rm")
         assert c.return_code == 0
@@ -432,7 +432,7 @@ def test_system_and_deploy_work(PipenvInstance):
         Path(p.pipfile_path).write_text(
             u"""
 [packages]
-requests = "*"
+tablib = "*"
         """.strip()
         )
         c = p.pipenv("install --system")