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/docs/advanced.rst b/docs/advanced.rst index 91601a25..eb75d50a 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,91 @@ 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"} -And generate a set of requirements out of it with only the default dependencies:: +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": { + ... 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 ... + } + +Given the ``Pipfile.lock`` exists, you may generate a set of requirements out of it with 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 +350,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 --------------------------------------- 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/5345.behavior.rst b/news/5345.behavior.rst new file mode 100644 index 00000000..a92e9544 --- /dev/null +++ b/news/5345.behavior.rst @@ -0,0 +1 @@ +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" 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/news/5388.dev.process.rst b/news/5388.dev.process.rst new file mode 100644 index 00000000..fc0fe3cf --- /dev/null +++ b/news/5388.dev.process.rst @@ -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`` diff --git a/pipenv/__version__.py b/pipenv/__version__.py index 53c21b79..8974eb27 100644 --- a/pipenv/__version__.py +++ b/pipenv/__version__.py @@ -2,4 +2,4 @@ # // ) ) / / // ) ) //___) ) // ) ) || / / # //___/ / / / //___/ / // // / / || / / # // / / // ((____ // / / ||/ / -__version__ = "2022.9.25.dev0" +__version__ = "2022.10.5.dev0" 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 diff --git a/pipenv/project.py b/pipenv/project.py index c2f075e4..1a77a0db 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -692,8 +692,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/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" diff --git a/tests/integration/test_install_basic.py b/tests/integration/test_install_basic.py index e62b5556..5a800e87 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