From 238860d87217892ed0bb034e3530358f55909d09 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Mon, 9 Apr 2018 14:33:31 -0400 Subject: [PATCH 1/2] Fixes #1002, #1939 Signed-off-by: Dan Ryan --- HISTORY.txt | 3 ++- pipenv/core.py | 2 ++ pipenv/resolver.py | 5 ++++- pipenv/utils.py | 5 +++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/HISTORY.txt b/HISTORY.txt index 1ef0cdac..082775b8 100644 --- a/HISTORY.txt +++ b/HISTORY.txt @@ -3,7 +3,8 @@ - Ensure lock hash does not change based on injected env vars. - Fix bug in detecting .venv at project root when in subdirectories. - Parse quoting in [scripts] section correctly + clearer run errors. - - Fix bug resolving & locking markers correctly + - Fix bug resolving & locking markers correctly + - Bugfix for allow_global with new resolver fixes. 11.9.0: - Vastly improve markers capabilities. - Support for environment variables in Pipfiles. diff --git a/pipenv/core.py b/pipenv/core.py index 5fa05917..52132607 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -1065,6 +1065,7 @@ def do_lock( project=project, clear=clear, pre=pre, + allow_global=system, ) # Add develop dependencies to lockfile. for dep in results: @@ -1124,6 +1125,7 @@ def do_lock( project=project, clear=False, pre=pre, + allow_global=system, ) # Add default dependencies to lockfile. for dep in results: diff --git a/pipenv/resolver.py b/pipenv/resolver.py index 300acf20..c04a6b3c 100644 --- a/pipenv/resolver.py +++ b/pipenv/resolver.py @@ -24,6 +24,7 @@ def main(): do_pre = '--pre' in ' '.join(sys.argv) do_clear = '--clear' in ' '.join(sys.argv) is_debug = '--debug' in ' '.join(sys.argv) + system = '--system' in ' '.join(sys.argv) new_sys_argv = [] for v in sys.argv: if v.startswith('--'): @@ -51,7 +52,7 @@ def main(): del packages[i] project = pipenv.core.project - def resolve(packages, pre, sources, verbose, clear): + def resolve(packages, pre, sources, verbose, clear, system): import pipenv.utils return pipenv.utils.resolve_deps( packages, @@ -61,6 +62,7 @@ def main(): sources=sources, clear=clear, verbose=verbose, + allow_global=system, ) results = resolve( @@ -69,6 +71,7 @@ def main(): sources=project.sources, verbose=is_verbose, clear=do_clear, + system=system, ) print('RESULTS:') if results: diff --git a/pipenv/utils.py b/pipenv/utils.py index 80db89d4..58bbbe27 100644 --- a/pipenv/utils.py +++ b/pipenv/utils.py @@ -372,18 +372,19 @@ def actually_resolve_reps( def venv_resolve_deps( - deps, which, project, pre=False, verbose=False, clear=False + deps, which, project, pre=False, verbose=False, clear=False, allow_global=False ): from . import resolver import json resolver = escape_grouped_arguments(resolver.__file__.rstrip('co')) - cmd = '{0} {1} {2} {3} {4}'.format( + cmd = '{0} {1} {2} {3} {4} {5}'.format( escape_grouped_arguments(which('python')), resolver, '--pre' if pre else '', '--verbose' if verbose else '', '--clear' if clear else '', + '--system' if allow_global else '', ) os.environ['PIPENV_PACKAGES'] = '\n'.join(deps) c = delegator.run(cmd, block=True) From c84e60cdaa39bc608d6682fd58e6c8ece5dce115 Mon Sep 17 00:00:00 2001 From: Dan Ryan Date: Tue, 10 Apr 2018 19:27:30 -0400 Subject: [PATCH 2/2] Update vcs documentation - Add link to pip docs - Unquote `-e .` example - Add detail to examples - Closes #1908 Signed-off-by: Dan Ryan --- docs/basics.rst | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/docs/basics.rst b/docs/basics.rst index f77d850b..5bb0cf7f 100644 --- a/docs/basics.rst +++ b/docs/basics.rst @@ -126,6 +126,7 @@ Example Pipfile.lock - Generally, keep both ``Pipfile`` and ``Pipfile.lock`` in version control. - Do not keep ``Pipfile.lock`` in version control if multiple versions of Python are being targeted. - Specify your target Python version in your `Pipfile`'s ``[requires]`` section. Ideally, you should only have one target Python version, as this is a deployment tool. +- ``pipenv install`` is fully compatible with ``pip install`` syntax, for which the full documentation can be found `here `_. @@ -234,11 +235,13 @@ automatically, falling back to whatever your system's default ``python`` install You can tell Pipenv to install a path as editable — often this is useful for the current working directory when working on packages:: - $ pipenv install '-e .' --dev + $ pipenv install --dev -e . $ cat Pipfile + ... [dev-packages] "e1839a8" = {path = ".", editable = true} + ... Note that all sub-dependencies will get added to the ``Pipfile.lock`` as well. @@ -325,12 +328,15 @@ You should do this for your shell too, in your ``~/.profile`` or ``~/.bashrc`` o ☤ A Note about VCS Dependencies ------------------------------- -Pipenv will resolve the sub–dependencies of VCS dependencies, but only if they are editable, like so:: +Pipenv will resolve the sub–dependencies of VCS dependencies, but only if they are installed in editable mode:: + $ pipenv install -e git+https://github.com/requests/requests.git#egg=requests + + $ cat Pipfile [packages] requests = {git = "https://github.com/requests/requests.git", editable=true} -If editable is not true, sub–dependencies will not get resolved. +If editable is not true, sub–dependencies will not be resolved. For more information about other options available when specifying VCS dependencies, please check the `Pipfile spec `__.