From 6ad06134a2b877622da0cb7b37a57dbbab52b65e Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 2 Oct 2022 09:37:46 -0400 Subject: [PATCH 01/14] Update documentation around requirements command and provide current examples. --- docs/advanced.rst | 139 +++++++++++++++++++++++++++++++++++++++------- 1 file changed, 119 insertions(+), 20 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index 91601a25..357b79dc 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -247,7 +247,7 @@ Anaconda uses Conda to manage packages. To reuse Conda–installed Python packag Sometimes, you would want to generate a requirements file based on your current environment, for example to include tooling that only supports requirements.txt. -You can convert a ``Pipfile`` and ``Pipfile.lock`` into a ``requirements.txt`` +You can convert a ``Pipfile.lock`` into a ``requirements.txt`` file very easily. Let's take this ``Pipfile``:: @@ -255,44 +255,141 @@ Let's take this ``Pipfile``:: [[source]] url = "https://pypi.python.org/simple" verify_ssl = true + name = "pypi" [packages] - requests = {version="*"} + requests = {version="==2.18.4"} [dev-packages] - pytest = {version="*"} + pytest = {version="==3.2.3"} + +Which generates the following ``Pipfile.lock``:: + + { + "_meta": { + "hash": { + "sha256": "4b81df812babd4e54ba5a4086714d7d303c1c3f00d725c76e38dd58cbd360f4e" + }, + "pipfile-spec": 6, + "requires": {}, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + "certifi": { + "hashes": [ + "sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14", + "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382" + ], + "markers": "python_version >= '3.6'", + "version": "==2022.9.24" + }, + "chardet": { + "hashes": [ + "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", + "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" + ], + "version": "==3.0.4" + }, + "idna": { + "hashes": [ + "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f", + "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4" + ], + "version": "==2.6" + }, + "requests": { + "hashes": [ + "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", + "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" + ], + "index": "pypi", + "version": "==2.18.4" + }, + "urllib3": { + "hashes": [ + "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", + "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" + ], + "version": "==1.22" + } + }, + "develop": { + "colorama": { + "hashes": [ + "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da", + "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4" + ], + "markers": "sys_platform == 'win32'", + "version": "==0.4.5" + }, + "py": { + "hashes": [ + "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719", + "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378" + ], + "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", + "version": "==1.11.0" + }, + "pytest": { + "hashes": [ + "sha256:27fa6617efc2869d3e969a3e75ec060375bfb28831ade8b5cdd68da3a741dc3c", + "sha256:81a25f36a97da3313e1125fce9e7bbbba565bc7fec3c5beb14c262ddab238ac1" + ], + "index": "pypi", + "version": "==3.2.3" + }, + "setuptools": { + "hashes": [ + "sha256:1b6bdc6161661409c5f21508763dc63ab20a9ac2f8ba20029aaaa7fdb9118012", + "sha256:3050e338e5871e70c72983072fe34f6032ae1cdeeeb67338199c2f74e083a80e" + ], + "markers": "python_version >= '3.7'", + "version": "==65.4.1" + } + } + } And generate a set of requirements out of it with only the default dependencies:: $ pipenv requirements - -i https://pypi.org/simple + -i https://pypi.python.org/simple + certifi==2022.9.24 ; python_version >= '3.6' chardet==3.0.4 - requests==2.18.4 - certifi==2017.7.27.1 idna==2.6 + requests==2.18.4 urllib3==1.22 As with other commands, passing ``--dev`` will include both the default and development dependencies:: $ pipenv requirements --dev - -i https://pypi.org/simple - chardet==3.0.4 - requests==2.18.4 - certifi==2017.7.27.1 - idna==2.6 - urllib3==1.22 - py==1.4.34 + -i https://pypi.python.org/simple + colorama==0.4.5 ; sys_platform == 'win32' + py==1.11.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' pytest==3.2.3 + setuptools==65.4.1 ; python_version >= '3.7' + certifi==2022.9.24 ; python_version >= '3.6' + chardet==3.0.4 + idna==2.6 + requests==2.18.4 + urllib3==1.22 If you wish to generate a requirements file with only the development requirements you can do that too, using the ``--dev-only`` flag:: $ pipenv requirements --dev-only - -i https://pypi.org/simple - py==1.4.34 + -i https://pypi.python.org/simple + colorama==0.4.5 ; sys_platform == 'win32' + py==1.11.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' pytest==3.2.3 + setuptools==65.4.1 ; python_version >= '3.7' Adding the ``--hash`` flag adds package hashes to the output for extra security. Adding the ``--exclude-markers`` flag excludes the markers from the output. @@ -303,16 +400,18 @@ used to write them to a file:: $ pipenv requirements > requirements.txt $ pipenv requirements --dev-only > dev-requirements.txt $ cat requirements.txt - -i https://pypi.org/simple + -i https://pypi.python.org/simple + certifi==2022.9.24 ; python_version >= '3.6' chardet==3.0.4 - requests==2.18.4 - certifi==2017.7.27.1 idna==2.6 + requests==2.18.4 urllib3==1.22 $ cat dev-requirements.txt - -i https://pypi.org/simple - py==1.4.34 + -i https://pypi.python.org/simple + colorama==0.4.5 ; sys_platform == 'win32' + py==1.11.0 ; python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4' pytest==3.2.3 + setuptools==65.4.1 ; python_version >= '3.7' ☤ Detection of Security Vulnerabilities --------------------------------------- From 32ede85a557491cdf86281a43b0b94951be0ebe9 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Sun, 2 Oct 2022 09:50:53 -0400 Subject: [PATCH 02/14] Clarify sentence. --- docs/advanced.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index 357b79dc..fa2045fb 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -263,7 +263,7 @@ Let's take this ``Pipfile``:: [dev-packages] pytest = {version="==3.2.3"} -Which generates the following ``Pipfile.lock``:: +Which generated the following ``Pipfile.lock`` upon completion of running ``pipenv lock```:: { "_meta": { From 3fe367494997795f7db1450696e103637abd320e Mon Sep 17 00:00:00 2001 From: jerempy Date: Mon, 3 Oct 2022 09:10:56 -0400 Subject: [PATCH 03/14] test first - it fails expected output doesn't match current output which is "python_version": "3.10" --- tests/integration/test_install_basic.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py index eeea6cd2..7c1aaff3 100644 --- a/tests/integration/test_install_basic.py +++ b/tests/integration/test_install_basic.py @@ -374,6 +374,15 @@ def test_install_creates_pipfile(pipenv_instance_pypi): assert os.path.isfile(p.pipfile_path) +@pytest.mark.basic +@pytest.mark.install +def test_create_pipfile_requires_python_full_version(pipenv_instance_pypi): + with pipenv_instance_pypi(chdir=True) as p: + c = p.pipenv("--python 3.10.7") + assert c.returncode == 0 + assert p.pipfile["requires"] == {'python__full_version': '3.10.7'} + + @pytest.mark.basic @pytest.mark.install def test_install_non_exist_dep(pipenv_instance_pypi): From 4fd60625b5b24f74f70ae4a775383bd7e92f2511 Mon Sep 17 00:00:00 2001 From: jerempy Date: Mon, 3 Oct 2022 10:57:00 -0400 Subject: [PATCH 04/14] add pytest.markers to help silence most of the warnings when running pytest --- pyproject.toml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 7c6703a9..3b12f890 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -74,6 +74,33 @@ filterwarnings = [ "ignore::DeprecationWarning", "ignore::PendingDeprecationWarning", ] +# These are not all the custom markers, but most of the ones with repeat uses +# `pipenv run pytest --markers` will list all markers inlcuding these +markers = [ + "install: tests having to do with `pipenv install`", + "needs_internet: integration tests that require internet to pass", + "basic: basic pipenv tests grouping", + "dev: tests having to do with dev and dev packages", + "system: related or interacting with the os", + "utils: grouping of pipenv utility functions", + "cli: test grouping that relate to command line like `pipenv --flag args`", + "requirements: tests that save and alter pip requirements", + "run: tests that run or execute python through pipenv", + "script: grouping of tests that execute scripts", + "keep_outdated: when an activity is supposed to keep something out of date", + "lock: tests that interact with pipenv lock", + "markers: pipenv environment markers", + "vcs: tests integration with pipenv and vertsion control systems", + "project: tests with the project object", + "sync: related to `pipenv sync`", + "rrule: relating to rrules (as in recurring time)", + "tzoffset: timezone offset", + "gettz: tests with gettz (get timezone) from dateutil lib", + "tzstr: timezone string", + "extras", + "extended", + "ext: extra non-categorized tests", +] [tool.towncrier] package = "pipenv" From 31cfc992bc26d74e7a612acc4bf7c660e71f737d Mon Sep 17 00:00:00 2001 From: jerempy Date: Tue, 4 Oct 2022 09:32:11 -0400 Subject: [PATCH 05/14] Create 5388.process.dev --- news/5388.process.dev | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/5388.process.dev diff --git a/news/5388.process.dev b/news/5388.process.dev new file mode 100644 index 00000000..eaacf76a --- /dev/null +++ b/news/5388.process.dev @@ -0,0 +1 @@ +Silence majority of pytest.mark warnings by registering custom marks. Can view a list of custom marks by running `pipenv run pytest --markers` From 88aeff1bbbf2a8ec3d6656db596d275be59d6bbe Mon Sep 17 00:00:00 2001 From: jerempy Date: Tue, 4 Oct 2022 10:01:40 -0400 Subject: [PATCH 06/14] -> .rst --- news/{5388.process.dev => 5388.process.dev.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename news/{5388.process.dev => 5388.process.dev.rst} (100%) diff --git a/news/5388.process.dev b/news/5388.process.dev.rst similarity index 100% rename from news/5388.process.dev rename to news/5388.process.dev.rst From 2f14fa08d458a3a692639eefafafe3dae3cc7335 Mon Sep 17 00:00:00 2001 From: jerempy Date: Tue, 4 Oct 2022 10:38:21 -0400 Subject: [PATCH 07/14] filename change --- news/{5388.process.dev.rst => 5388.dev.process.rst} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename news/{5388.process.dev.rst => 5388.dev.process.rst} (100%) diff --git a/news/5388.process.dev.rst b/news/5388.dev.process.rst similarity index 100% rename from news/5388.process.dev.rst rename to news/5388.dev.process.rst From ee29d99821782d7562319429b424e26a4bc58da7 Mon Sep 17 00:00:00 2001 From: jerempy Date: Tue, 4 Oct 2022 11:24:46 -0400 Subject: [PATCH 08/14] solve lint error --- news/5388.dev.process.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/5388.dev.process.rst b/news/5388.dev.process.rst index eaacf76a..fc0fe3cf 100644 --- a/news/5388.dev.process.rst +++ b/news/5388.dev.process.rst @@ -1 +1 @@ -Silence majority of pytest.mark warnings by registering custom marks. Can view a list of custom marks by running `pipenv run pytest --markers` +Silence majority of pytest.mark warnings by registering custom marks. Can view a list of custom marks by running ``pipenv run pytest --markers`` From 6c457fe41cb4135b5fc2b457a0e0b09427c8ee79 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 4 Oct 2022 21:38:07 -0400 Subject: [PATCH 09/14] Release v2022.10.4 --- CHANGELOG.rst | 18 ++++++++++++++++++ news/5075.bugfix.rst | 1 - news/5187.vendor.rst | 1 - news/5380.bugfix.rst | 1 - pipenv/__version__.py | 2 +- pipenv/pipenv.1 | 16 +++++++++++++++- 6 files changed, 34 insertions(+), 5 deletions(-) delete mode 100644 news/5075.bugfix.rst delete mode 100644 news/5187.vendor.rst delete mode 100644 news/5380.bugfix.rst diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 29ff8d5f..4e918cac 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,3 +1,21 @@ +2022.10.4 (2022-10-04) +====================== +Pipenv 2022.10.4 (2022-10-04) +============================= + + +Bug Fixes +--------- + +- Use ``--creator=venv`` when creating virtual environments to avoid issue with sysconfig ``posix_prefix`` on some systems. `#5075 `_ +- Prefer to use the lockfile sources if available during the install phase. `#5380 `_ + +Vendored Libraries +------------------ + +- Drop vendored six - we no longer depend on this library, as we migrated from pipfile to plette. `#5187 `_ + + 2022.9.24 (2022-09-24) ====================== Pipenv 2022.9.24 (2022-09-24) diff --git a/news/5075.bugfix.rst b/news/5075.bugfix.rst deleted file mode 100644 index 8feed065..00000000 --- a/news/5075.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Use ``--creator=venv`` when creating virtual environments to avoid issue with sysconfig ``posix_prefix`` on some systems. diff --git a/news/5187.vendor.rst b/news/5187.vendor.rst deleted file mode 100644 index 84be73c0..00000000 --- a/news/5187.vendor.rst +++ /dev/null @@ -1 +0,0 @@ -Drop vendored six - we no longer depend on this library, as we migrated from pipfile to plette. diff --git a/news/5380.bugfix.rst b/news/5380.bugfix.rst deleted file mode 100644 index 7f4dcc92..00000000 --- a/news/5380.bugfix.rst +++ /dev/null @@ -1 +0,0 @@ -Prefer to use the lockfile sources if available during the install phase. diff --git a/pipenv/__version__.py b/pipenv/__version__.py index 53c21b79..0672722a 100644 --- a/pipenv/__version__.py +++ b/pipenv/__version__.py @@ -2,4 +2,4 @@ # // ) ) / / // ) ) //___) ) // ) ) || / / # //___/ / / / //___/ / // // / / || / / # // / / // ((____ // / / ||/ / -__version__ = "2022.9.25.dev0" +__version__ = "2022.10.4" diff --git a/pipenv/pipenv.1 b/pipenv/pipenv.1 index 6b2a69eb..1a087295 100644 --- a/pipenv/pipenv.1 +++ b/pipenv/pipenv.1 @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. -.TH "PIPENV" "1" "Sep 24, 2022" "2022.9.24" "pipenv" +.TH "PIPENV" "1" "Oct 04, 2022" "2022.10.4" "pipenv" .SH NAME pipenv \- pipenv Documentation \fI\%\fP\fI\%\fP\fI\%\fP @@ -453,6 +453,20 @@ You might want to set \fBexport PIPENV_VENV_IN_PROJECT=1\fP in your .bashrc/.zsh .sp Congratulations, you now know how to install and use Python packages! ✨ 🍰 ✨ .SS Release and Version History +.SS 2022.10.4 (2022\-10\-04) +.SS Pipenv 2022.10.4 (2022\-10\-04) +.SS Bug Fixes +.INDENT 0.0 +.IP \(bu 2 +Use \fB\-\-creator=venv\fP when creating virtual environments to avoid issue with sysconfig \fBposix_prefix\fP on some systems. \fI\%#5075\fP +.IP \(bu 2 +Prefer to use the lockfile sources if available during the install phase. \fI\%#5380\fP +.UNINDENT +.SS Vendored Libraries +.INDENT 0.0 +.IP \(bu 2 +Drop vendored six \- we no longer depend on this library, as we migrated from pipfile to plette. \fI\%#5187\fP +.UNINDENT .SS 2022.9.24 (2022\-09\-24) .SS Pipenv 2022.9.24 (2022\-09\-24) .SS Bug Fixes From 12ebb670ccb06503eed686c7bcf7033055e92957 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Wed, 5 Oct 2022 01:39:54 +0000 Subject: [PATCH 10/14] Bumped version. Signed-off-by: github-actions[bot] --- pipenv/__version__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pipenv/__version__.py b/pipenv/__version__.py index 0672722a..8974eb27 100644 --- a/pipenv/__version__.py +++ b/pipenv/__version__.py @@ -2,4 +2,4 @@ # // ) ) / / // ) ) //___) ) // ) ) || / / # //___/ / / / //___/ / // // / / || / / # // / / // ((____ // / / ||/ / -__version__ = "2022.10.4" +__version__ = "2022.10.5.dev0" From 8c0667539c0a653e61a53d0d06e9af85b02b97cc Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Tue, 4 Oct 2022 21:45:08 -0400 Subject: [PATCH 11/14] Update docs based on PR feedback. --- docs/advanced.rst | 130 ++++++++++++++-------------------------------- 1 file changed, 40 insertions(+), 90 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index fa2045fb..eb75d50a 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -263,99 +263,49 @@ Let's take this ``Pipfile``:: [dev-packages] pytest = {version="==3.2.3"} -Which generated the following ``Pipfile.lock`` upon completion of running ``pipenv lock```:: +Which generates a ``Pipfile.lock`` upon completion of running ``pipenv lock``` similar to:: { - "_meta": { - "hash": { - "sha256": "4b81df812babd4e54ba5a4086714d7d303c1c3f00d725c76e38dd58cbd360f4e" - }, - "pipfile-spec": 6, - "requires": {}, - "sources": [ - { - "name": "pypi", - "url": "https://pypi.python.org/simple", - "verify_ssl": true - } - ] - }, - "default": { - "certifi": { - "hashes": [ - "sha256:0d9c601124e5a6ba9712dbc60d9c53c21e34f5f641fe83002317394311bdce14", - "sha256:90c1a32f1d68f940488354e36370f6cca89f0f106db09518524c88d6ed83f382" - ], - "markers": "python_version >= '3.6'", - "version": "==2022.9.24" - }, - "chardet": { - "hashes": [ - "sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", - "sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" - ], - "version": "==3.0.4" - }, - "idna": { - "hashes": [ - "sha256:2c6a5de3089009e3da7c5dde64a141dbc8551d5b7f6cf4ed7c2568d0cc520a8f", - "sha256:8c7309c718f94b3a625cb648ace320157ad16ff131ae0af362c9f21b80ef6ec4" - ], - "version": "==2.6" - }, - "requests": { - "hashes": [ - "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", - "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" - ], - "index": "pypi", - "version": "==2.18.4" - }, - "urllib3": { - "hashes": [ - "sha256:06330f386d6e4b195fbfc736b297f58c5a892e4440e54d294d7004e3a9bbea1b", - "sha256:cc44da8e1145637334317feebd728bd869a35285b93cbb4cca2577da7e62db4f" - ], - "version": "==1.22" - } - }, - "develop": { - "colorama": { - "hashes": [ - "sha256:854bf444933e37f5824ae7bfc1e98d5bce2ebe4160d46b5edf346a89358e99da", - "sha256:e6c6b4334fc50988a639d9b98aa429a0b57da6e17b9a44f0451f930b6967b7a4" - ], - "markers": "sys_platform == 'win32'", - "version": "==0.4.5" - }, - "py": { - "hashes": [ - "sha256:51c75c4126074b472f746a24399ad32f6053d1b34b68d2fa41e558e6f4a98719", - "sha256:607c53218732647dff4acdfcd50cb62615cedf612e72d1724fb1a0cc6405b378" - ], - "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'", - "version": "==1.11.0" - }, - "pytest": { - "hashes": [ - "sha256:27fa6617efc2869d3e969a3e75ec060375bfb28831ade8b5cdd68da3a741dc3c", - "sha256:81a25f36a97da3313e1125fce9e7bbbba565bc7fec3c5beb14c262ddab238ac1" - ], - "index": "pypi", - "version": "==3.2.3" - }, - "setuptools": { - "hashes": [ - "sha256:1b6bdc6161661409c5f21508763dc63ab20a9ac2f8ba20029aaaa7fdb9118012", - "sha256:3050e338e5871e70c72983072fe34f6032ae1cdeeeb67338199c2f74e083a80e" - ], - "markers": "python_version >= '3.7'", - "version": "==65.4.1" - } - } - } + "_meta": { + "hash": { + "sha256": "4b81df812babd4e54ba5a4086714d7d303c1c3f00d725c76e38dd58cbd360f4e" + }, + "pipfile-spec": 6, + "requires": {}, + "sources": [ + { + "name": "pypi", + "url": "https://pypi.python.org/simple", + "verify_ssl": true + } + ] + }, + "default": { + ... snipped ... + "requests": { + "hashes": [ + "sha256:6a1b267aa90cac58ac3a765d067950e7dbbf75b1da07e895d1f594193a40a38b", + "sha256:9c443e7324ba5b85070c4a818ade28bfabedf16ea10206da1132edaa6dda237e" + ], + "index": "pypi", + "version": "==2.18.4" + }, + ... snipped ... + }, + "develop": { + ... snipped ... + "pytest": { + "hashes": [ + "sha256:27fa6617efc2869d3e969a3e75ec060375bfb28831ade8b5cdd68da3a741dc3c", + "sha256:81a25f36a97da3313e1125fce9e7bbbba565bc7fec3c5beb14c262ddab238ac1" + ], + "index": "pypi", + "version": "==3.2.3" + } + ... snipped ... + } -And generate a set of requirements out of it with only the default dependencies:: +Given the ``Pipfile.lock`` exists, you may generate a set of requirements out of it with the default dependencies:: $ pipenv requirements -i https://pypi.python.org/simple From 5bf9f1baacce78d9e87910b94ba3c1b4071e27d7 Mon Sep 17 00:00:00 2001 From: jerempy Date: Wed, 5 Oct 2022 10:47:00 -0400 Subject: [PATCH 12/14] pipfile saves correctly and news segment --- news/5345.behavior.rst | 1 + pipenv/project.py | 4 +++- tests/integration/test_install_basic.py | 18 +++++++++++++++++- 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 news/5345.behavior.rst diff --git a/news/5345.behavior.rst b/news/5345.behavior.rst new file mode 100644 index 00000000..1725fc46 --- /dev/null +++ b/news/5345.behavior.rst @@ -0,0 +1 @@ +New pipfiles show python_full_version under [requires] if specified diff --git a/pipenv/project.py b/pipenv/project.py index 40c6d0c8..f9d42b35 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -675,8 +675,10 @@ class Project: else: required_python = self.which("python") version = python_version(required_python) or self.s.PIPENV_DEFAULT_PYTHON_VERSION - if version and len(version.split(".")) > 2: + if version: data["requires"] = {"python_version": ".".join(version.split(".")[:2])} + if python and version and len(version.split(".")) > 2: + data["requires"].update({"python_full_version": version}) self.write_toml(data) @classmethod diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py index 7c1aaff3..a22b9844 100644 --- a/tests/integration/test_install_basic.py +++ b/tests/integration/test_install_basic.py @@ -1,4 +1,4 @@ -import os +import os, sys from pathlib import Path from tempfile import TemporaryDirectory @@ -372,6 +372,22 @@ def test_install_creates_pipfile(pipenv_instance_pypi): c = p.pipenv("install") assert c.returncode == 0 assert os.path.isfile(p.pipfile_path) + python_version = str(sys.version_info.major) + "." + str(sys.version_info.minor) + assert p.pipfile["requires"] == {'python_version': python_version} + + +@pytest.mark.basic +@pytest.mark.install +def test_create_pipfile_requires_python_full_version(pipenv_instance_pypi): + with pipenv_instance_pypi(chdir=True) as p: + python_version = str(sys.version_info.major) + "." + str(sys.version_info.minor) + python_full_version = python_version + "." + str(sys.version_info.micro) + c = p.pipenv(f"--python {python_full_version}") + assert c.returncode == 0 + assert p.pipfile["requires"] == { + 'python_full_version': python_full_version, + 'python_version': python_version + } @pytest.mark.basic From 3171333449e26c17bdfdea707cc96d2e5b79d331 Mon Sep 17 00:00:00 2001 From: jerempy Date: Wed, 5 Oct 2022 10:54:46 -0400 Subject: [PATCH 13/14] delete accidental dup test --- tests/integration/test_install_basic.py | 9 --------- 1 file changed, 9 deletions(-) diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py index a22b9844..f916916d 100644 --- a/tests/integration/test_install_basic.py +++ b/tests/integration/test_install_basic.py @@ -390,15 +390,6 @@ def test_create_pipfile_requires_python_full_version(pipenv_instance_pypi): } -@pytest.mark.basic -@pytest.mark.install -def test_create_pipfile_requires_python_full_version(pipenv_instance_pypi): - with pipenv_instance_pypi(chdir=True) as p: - c = p.pipenv("--python 3.10.7") - assert c.returncode == 0 - assert p.pipfile["requires"] == {'python__full_version': '3.10.7'} - - @pytest.mark.basic @pytest.mark.install def test_install_non_exist_dep(pipenv_instance_pypi): From 3cf06967699f95fd45175e6901944416ae851d08 Mon Sep 17 00:00:00 2001 From: jerempy Date: Wed, 5 Oct 2022 11:41:07 -0400 Subject: [PATCH 14/14] more news --- news/5345.behavior.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/5345.behavior.rst b/news/5345.behavior.rst index 1725fc46..a92e9544 100644 --- a/news/5345.behavior.rst +++ b/news/5345.behavior.rst @@ -1 +1 @@ -New pipfiles show python_full_version under [requires] if specified +New pipfiles show python_full_version under [requires] if specified. Previously creating a new pipenv project would only specify in the Pipfile the major and minor version, i.e. "python_version = 3.7". Now if you create a new project with a fully named python version it will record both in the Pipfile. So: "python_version = 3.7" and "python_full_version = 3.7.2"