From 04bb9ada05241e84a28aa0a3ee9cca36fdac8a84 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 15 Nov 2018 01:01:33 -0500 Subject: [PATCH 1/5] Fix circular import Signed-off-by: Dan Ryan --- pipenv/_compat.py | 6 +++--- pipenv/cli/command.py | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pipenv/_compat.py b/pipenv/_compat.py index 35ff2188..09f65669 100644 --- a/pipenv/_compat.py +++ b/pipenv/_compat.py @@ -14,7 +14,6 @@ import sys import warnings import vistir from tempfile import _bin_openflags, gettempdir, _mkstemp_inner, mkdtemp -from .utils import logging, rmtree try: from tempfile import _infer_return_type @@ -55,6 +54,7 @@ except ImportError: class finalize(object): def __init__(self, *args, **kwargs): + from .utils import logging logging.warn("weakref.finalize unavailable, not cleaning...") def detach(self): @@ -100,7 +100,7 @@ class TemporaryDirectory(object): @classmethod def _cleanup(cls, name, warn_message): - rmtree(name) + vistir.path.rmtree(name) warnings.warn(warn_message, ResourceWarning) def __repr__(self): @@ -114,7 +114,7 @@ class TemporaryDirectory(object): def cleanup(self): if self._finalizer.detach(): - rmtree(self.name) + vistir.path.rmtree(self.name) def _sanitize_params(prefix, suffix, dir): diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 14120e35..5a39fb02 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -15,7 +15,6 @@ import click_completion from click_didyoumean import DYMCommandCollection -from .. import environments from ..__version__ import __version__ from .options import ( CONTEXT_SETTINGS, PipenvGroup, code_option, common_options, deploy_option, @@ -115,6 +114,7 @@ def cli( return 1 if envs: echo("The following environment variables can be set, to do various things:\n") + from .. import environments for key in environments.__dict__: if key.startswith("PIPENV"): echo(" - {0}".format(crayons.normal(key, bold=True))) @@ -161,7 +161,8 @@ def cli( # --rm was passed… elif rm: # Abort if --system (or running in a virtualenv). - if environments.PIPENV_USE_SYSTEM: + from .environments import PIPENV_USE_SYSTEM + if PIPENV_USE_SYSTEM: echo( crayons.red( "You are attempting to remove a virtualenv that " From ffe1403809d25104d8216d9ae0c058167c58ca4b Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 15 Nov 2018 01:23:08 -0500 Subject: [PATCH 2/5] Re-try dest distribution Signed-off-by: Dan Ryan --- .azure-pipelines/steps/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/steps/run-tests.yml b/.azure-pipelines/steps/run-tests.yml index 6515f604..fa45f558 100644 --- a/.azure-pipelines/steps/run-tests.yml +++ b/.azure-pipelines/steps/run-tests.yml @@ -1,5 +1,5 @@ steps: -- powershell: ./DistributeTests.ps1 +- powershell: .\azure-pipelines\steps\DistributeTests.ps1 displayName: 'PowerShell Script to distribute tests' - powershell: | From addecb10f91879a272ef9420929d8b82fc75594c Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 15 Nov 2018 01:28:03 -0500 Subject: [PATCH 3/5] fix run path for test runner script Signed-off-by: Dan Ryan --- .azure-pipelines/steps/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure-pipelines/steps/run-tests.yml b/.azure-pipelines/steps/run-tests.yml index fa45f558..cbddf0ee 100644 --- a/.azure-pipelines/steps/run-tests.yml +++ b/.azure-pipelines/steps/run-tests.yml @@ -1,5 +1,5 @@ steps: -- powershell: .\azure-pipelines\steps\DistributeTests.ps1 +- powershell: .\.azure-pipelines\steps\DistributeTests.ps1 displayName: 'PowerShell Script to distribute tests' - powershell: | From 0af52248481272a81da1cc71c70a89729ef976e2 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Thu, 15 Nov 2018 01:44:15 -0500 Subject: [PATCH 4/5] dont distribute tests, it doesn't work Signed-off-by: Dan Ryan --- .azure-pipelines/steps/DistributeTests.ps1 | 43 ---------------------- .azure-pipelines/steps/run-tests.yml | 5 +-- pipenv/cli/command.py | 2 +- 3 files changed, 2 insertions(+), 48 deletions(-) delete mode 100644 .azure-pipelines/steps/DistributeTests.ps1 diff --git a/.azure-pipelines/steps/DistributeTests.ps1 b/.azure-pipelines/steps/DistributeTests.ps1 deleted file mode 100644 index d9fce4a3..00000000 --- a/.azure-pipelines/steps/DistributeTests.ps1 +++ /dev/null @@ -1,43 +0,0 @@ -<# -.SYNOPSIS - Distribute the tests in VSTS pipeline across multiple agents -.DESCRIPTION - This script slices tests files across multiple agents for faster execution. - We search for specific type of file structure (in this example test*), and slice them according to agent number - If we encounter multiple files [file1..file10] and if we have 2 agents, agent1 executes tests odd number of files while agent2 executes even number of files - For detalied slicing info: https://docs.microsoft.com/en-us/vsts/pipelines/test/parallel-testing-any-test-runner - We use JUnit style test results to publish the test reports. -#> - -$tests = Get-ChildItem ..\..\tests\unit,..\..\tests\integration -Filter "test*" # search for test files with specific pattern. -$totalAgents = [int]$Env:SYSTEM_TOTALJOBSINPHASE # standard VSTS variables available using parallel execution; total number of parallel jobs running -$agentNumber = [int]$Env:SYSTEM_JOBPOSITIONINPHASE # current job position -$testCount = $tests.Count - -# below conditions are used if parallel pipeline is not used. i.e. pipeline is running with single agent (no parallel configuration) -if ($totalAgents -eq 0) { - $totalAgents = 1 -} -if (!$agentNumber -or $agentNumber -eq 0) { - $agentNumber = 1 -} - -Write-Host "Total agents: $totalAgents" -Write-Host "Agent number: $agentNumber" -Write-Host "Total tests: $testCount" - -$testsToRun= @() - -# slice test files to make sure each agent gets unique test file to execute -For ($i=$agentNumber; $i -le $testCount;) { - $file = $tests[$i-1] - $testsToRun = $testsToRun + $file - Write-Host "Added $file" - $i = $i + $totalAgents - } - -# join all test files seperated by space. pytest runs multiple test files in following format pytest test1.py test2.py test3.py -$testFiles = $testsToRun -Join " " -Write-Host "Test files $testFiles" -# write these files into variable so that we can run them using pytest in subsequent task. -Write-Host "##vso[task.setvariable variable=pytestfiles;]$testFiles" diff --git a/.azure-pipelines/steps/run-tests.yml b/.azure-pipelines/steps/run-tests.yml index cbddf0ee..7496c76f 100644 --- a/.azure-pipelines/steps/run-tests.yml +++ b/.azure-pipelines/steps/run-tests.yml @@ -1,7 +1,4 @@ steps: -- powershell: .\.azure-pipelines\steps\DistributeTests.ps1 - displayName: 'PowerShell Script to distribute tests' - - powershell: | # Fix Git SSL errors pip install certifi @@ -15,7 +12,7 @@ steps: $env:TEMP='T:\' Write-Host "##vso[task.setvariable variable=TMP]T:\" $env:TMP='T:\' - D:\.venv\Scripts\pipenv run pytest -ra --ignore=pipenv\patched --ignore=pipenv\vendor --junitxml=test-results.xml "$env:pytestfiles" + D:\.venv\Scripts\pipenv run pytest -ra --ignore=pipenv\patched --ignore=pipenv\vendor --junitxml=test-results.xml tests displayName: Run integration tests - task: PublishTestResults@2 diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 5a39fb02..16778ede 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -161,7 +161,7 @@ def cli( # --rm was passed… elif rm: # Abort if --system (or running in a virtualenv). - from .environments import PIPENV_USE_SYSTEM + from ..environments import PIPENV_USE_SYSTEM if PIPENV_USE_SYSTEM: echo( crayons.red( From cc03cd0cb46f84a554a233a7edc1aaa0947432bd Mon Sep 17 00:00:00 2001 From: kashewnuts Date: Thu, 15 Nov 2018 16:01:50 +0900 Subject: [PATCH 5/5] fix 'Release 2018.11.14' markup --- CHANGELOG.rst | 92 +++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 3686ca85..45494be7 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -4,59 +4,59 @@ Features & Improvements ----------------------- -- Improved exceptions and error handling on failures.`#1977 `_ -- Added persistent settings for all CLI flags via ``PIPENV_{FLAG_NAME}`` environment variables by enabling ``auto_envvar_prefix=PIPENV`` in click (implements PEEP-0002).`#2200 `_ -- Added improved messaging about available but skipped updates due to dependency conflicts when running ``pipenv update --outdated``.`#2411 `_ +- Improved exceptions and error handling on failures. `#1977 `_ +- Added persistent settings for all CLI flags via ``PIPENV_{FLAG_NAME}`` environment variables by enabling ``auto_envvar_prefix=PIPENV`` in click (implements PEEP-0002). `#2200 `_ +- Added improved messaging about available but skipped updates due to dependency conflicts when running ``pipenv update --outdated``. `#2411 `_ - Added environment variable `PIPENV_PYUP_API_KEY` to add ability - to override the bundled pyup.io API key.`#2825 `_ -- Added additional output to ``pipenv update --outdated`` to indicate that the operation succeded and all packages were already up to date.`#2828 `_ -- Updated ``crayons`` patch to enable colors on native powershell but swap native blue for magenta.`#3020 `_ -- Added support for ``--bare`` to ``pipenv clean``, and fixed ``pipenv sync --bare`` to actually reduce output.`#3041 `_ -- Added windows-compatible spinner via upgraded ``vistir`` dependency.`#3089 `_ -- - Added support for python installations managed by ``asdf``.`#3096 `_ -- Improved runtime performance of no-op commands such as ``pipenv --venv`` by around 2/3.`#3158 `_ -- Do not show error but success for running ``pipenv uninstall --all`` in a fresh virtual environment.`#3170 `_ -- Improved asynchronous installation and error handling via queued subprocess paralleization.`#3217 `_ + to override the bundled pyup.io API key. `#2825 `_ +- Added additional output to ``pipenv update --outdated`` to indicate that the operation succeded and all packages were already up to date. `#2828 `_ +- Updated ``crayons`` patch to enable colors on native powershell but swap native blue for magenta. `#3020 `_ +- Added support for ``--bare`` to ``pipenv clean``, and fixed ``pipenv sync --bare`` to actually reduce output. `#3041 `_ +- Added windows-compatible spinner via upgraded ``vistir`` dependency. `#3089 `_ +- - Added support for python installations managed by ``asdf``. `#3096 `_ +- Improved runtime performance of no-op commands such as ``pipenv --venv`` by around 2/3. `#3158 `_ +- Do not show error but success for running ``pipenv uninstall --all`` in a fresh virtual environment. `#3170 `_ +- Improved asynchronous installation and error handling via queued subprocess paralleization. `#3217 `_ Bug Fixes --------- -- Remote non-PyPI artifacts and local wheels and artifacts will now include their own hashes rather than including hashes from ``PyPI``.`#2394 `_ -- Non-ascii characters will now be handled correctly when parsed by pipenv's ``ToML`` parsers.`#2737 `_ -- Updated ``pipenv uninstall`` to respect the ``--skip-lock`` argument.`#2848 `_ -- Fixed a bug which caused uninstallation to sometimes fail to successfullly remove packages from ``Pipfiles`` with comments on preceding or following lines.`#2885 `_, +- Remote non-PyPI artifacts and local wheels and artifacts will now include their own hashes rather than including hashes from ``PyPI``. `#2394 `_ +- Non-ascii characters will now be handled correctly when parsed by pipenv's ``ToML`` parsers. `#2737 `_ +- Updated ``pipenv uninstall`` to respect the ``--skip-lock`` argument. `#2848 `_ +- Fixed a bug which caused uninstallation to sometimes fail to successfullly remove packages from ``Pipfiles`` with comments on preceding or following lines. `#2885 `_, `#3099 `_ -- Pipenv will no longer fail when encountering python versions on Windows that have been uninstalled.`#2983 `_ -- Fixed unnecessary extras are added when translating markers`#3026 `_ -- Fixed a virtualenv creation issue which could cause new virtualenvs to inadvertently attempt to read and write to global site packages.`#3047 `_ -- Fixed an issue with virtualenv path derivation which could cause errors, particularly for users on WSL bash.`#3055 `_ -- Fixed a bug which caused ``Unexpected EOF`` errors to be thrown when ``pip`` was waiting for input from users who had put login credentials in environment variables.`#3088 `_ -- Fixed a bug in ``requirementslib`` which prevented successful installation from mercurial repositories.`#3090 `_ -- Fixed random resource warnings when using pyenv or any other subprocess calls.`#3094 `_ -- - Fixed a bug which sometimes prevented cloning and parsing ``mercurial`` requirements.`#3096 `_ -- Fixed an issue in ``delegator.py`` related to subprocess calls when using ``PopenSpawn`` to stream output, which sometimes threw unexpected ``EOF`` errors.`#3102 `_, +- Pipenv will no longer fail when encountering python versions on Windows that have been uninstalled. `#2983 `_ +- Fixed unnecessary extras are added when translating markers `#3026 `_ +- Fixed a virtualenv creation issue which could cause new virtualenvs to inadvertently attempt to read and write to global site packages. `#3047 `_ +- Fixed an issue with virtualenv path derivation which could cause errors, particularly for users on WSL bash. `#3055 `_ +- Fixed a bug which caused ``Unexpected EOF`` errors to be thrown when ``pip`` was waiting for input from users who had put login credentials in environment variables. `#3088 `_ +- Fixed a bug in ``requirementslib`` which prevented successful installation from mercurial repositories. `#3090 `_ +- Fixed random resource warnings when using pyenv or any other subprocess calls. `#3094 `_ +- - Fixed a bug which sometimes prevented cloning and parsing ``mercurial`` requirements. `#3096 `_ +- Fixed an issue in ``delegator.py`` related to subprocess calls when using ``PopenSpawn`` to stream output, which sometimes threw unexpected ``EOF`` errors. `#3102 `_, `#3114 `_, `#3117 `_ -- Fix the path casing issue that makes `pipenv clean` fail on Windows`#3104 `_ -- Pipenv will avoid leaving build artifacts in the current working directory.`#3106 `_ -- Fixed issues with broken subprocess calls leaking resource handles and causing random and sporadic failures.`#3109 `_ -- Fixed an issue which caused ``pipenv clean`` to sometimes clean packages from the base ``site-packages`` folder or fail entirely.`#3113 `_ -- Updated ``pythonfinder`` to correct an issue with unnesting of nested paths when searching for python versions.`#3121 `_ -- Added additional logic for ignoring and replacing non-ascii characters when formatting console output on non-UTF-8 systems.`#3131 `_ -- Fix virtual environment discovery when `PIPENV_VENV_IN_PROJECT` is set, but the in-project `.venv` is a file.`#3134 `_ -- Hashes for remote and local non-PyPI artifacts will now be included in ``Pipfile.lock`` during resolution.`#3145 `_ -- Fix project path hashing logic in purpose to prevent collisions of virtual environments.`#3151 `_ -- Fix package installation when the virtual environment path contains parentheses.`#3158 `_ -- Azure Pipelines YAML files are updated to use the latest syntax and product name.`#3164 `_ -- Fixed new spinner success message to write only one success message during resolution.`#3183 `_ -- Pipenv will now correctly respect the ``--pre`` option when used with ``pipenv install``.`#3185 `_ -- Fix a bug where exception is raised when run pipenv graph in a project without created virtualenv`#3201 `_ -- When sources are missing names, names will now be derived from the supplied URL.`#3216 `_ +- Fix the path casing issue that makes `pipenv clean` fail on Windows `#3104 `_ +- Pipenv will avoid leaving build artifacts in the current working directory. `#3106 `_ +- Fixed issues with broken subprocess calls leaking resource handles and causing random and sporadic failures. `#3109 `_ +- Fixed an issue which caused ``pipenv clean`` to sometimes clean packages from the base ``site-packages`` folder or fail entirely. `#3113 `_ +- Updated ``pythonfinder`` to correct an issue with unnesting of nested paths when searching for python versions. `#3121 `_ +- Added additional logic for ignoring and replacing non-ascii characters when formatting console output on non-UTF-8 systems. `#3131 `_ +- Fix virtual environment discovery when `PIPENV_VENV_IN_PROJECT` is set, but the in-project `.venv` is a file. `#3134 `_ +- Hashes for remote and local non-PyPI artifacts will now be included in ``Pipfile.lock`` during resolution. `#3145 `_ +- Fix project path hashing logic in purpose to prevent collisions of virtual environments. `#3151 `_ +- Fix package installation when the virtual environment path contains parentheses. `#3158 `_ +- Azure Pipelines YAML files are updated to use the latest syntax and product name. `#3164 `_ +- Fixed new spinner success message to write only one success message during resolution. `#3183 `_ +- Pipenv will now correctly respect the ``--pre`` option when used with ``pipenv install``. `#3185 `_ +- Fix a bug where exception is raised when run pipenv graph in a project without created virtualenv `#3201 `_ +- When sources are missing names, names will now be derived from the supplied URL. `#3216 `_ Vendored Libraries ------------------ -- Updated ``pythonfinder`` to correct an issue with unnesting of nested paths when searching for python versions.`#3061 `_, +- Updated ``pythonfinder`` to correct an issue with unnesting of nested paths when searching for python versions. `#3061 `_, `#3121 `_ - Updated vendored dependencies: - ``certifi 2018.08.24 => 2018.10.15`` @@ -68,20 +68,20 @@ Vendored Libraries - ``pythonfinder 0.1.2 => 0.1.3`` - ``requirementslib 1.1.9 => 1.1.10`` - ``backports.functools_lru_cache 1.5.0 (new)`` - - ``cursor 1.2.0 (new)```#3089 `_ + - ``cursor 1.2.0 (new)`` `#3089 `_ - Updated vendored dependencies: - ``requests 2.19.1 => 2.20.1`` - ``tomlkit 0.4.46 => 0.5.2`` - ``vistir 0.1.6 => 0.2.4`` - ``pythonfinder 1.1.2 => 1.1.8`` - - ``requirementslib 1.1.10 => 1.3.0```#3096 `_ -- Switch to ``tomlkit`` for parsing and writing. Drop ``prettytoml`` and ``contoml`` from vendors.`#3191 `_ -- Updated ``requirementslib`` to aid in resolution of local and remote archives.`#3196 `_ + - ``requirementslib 1.1.10 => 1.3.0`` `#3096 `_ +- Switch to ``tomlkit`` for parsing and writing. Drop ``prettytoml`` and ``contoml`` from vendors. `#3191 `_ +- Updated ``requirementslib`` to aid in resolution of local and remote archives. `#3196 `_ Improved Documentation ---------------------- -- Expanded development and testing documentation for contributors to get started.`#3074 `_ +- Expanded development and testing documentation for contributors to get started. `#3074 `_ 2018.10.13 (2018-10-13)