From bec205bbd51271c4a5335f257d2d66e012ddaa39 Mon Sep 17 00:00:00 2001 From: Ulrik Johansson Date: Sun, 9 Sep 2018 13:35:12 +0200 Subject: [PATCH 1/4] Add ability to override the pyup.io API key for the check command --- docs/advanced.rst | 3 +++ pipenv/core.py | 7 ++++--- pipenv/environments.py | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index f3122724..a3f044cb 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -240,6 +240,9 @@ Example:: API access throttling based on overall usage rather than individual client usage. + You can also use your own safety API key by setting the + environment variable ``PIPENV_CHECK_KEY``. + ☤ Community Integrations ------------------------ diff --git a/pipenv/core.py b/pipenv/core.py index 52c127b1..830834a4 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -55,6 +55,7 @@ from .environments import ( PIPENV_DONT_USE_PYENV, SESSION_IS_INTERACTIVE, PIPENV_CACHE_DIR, + PIPENV_CHECK_KEY, ) # Packages that should be ignored later. @@ -2275,15 +2276,15 @@ def do_check( else: ignored = "" c = delegator.run( - '"{0}" {1} check --json --key=1ab8d58f-5122e025-83674263-bc1e79e0 {2}'.format( - python, escape_grouped_arguments(path), ignored + '"{0}" {1} check --json --key={2} {3}'.format( + python, escape_grouped_arguments(path), PIPENV_CHECK_KEY, ignored ) ) try: results = simplejson.loads(c.out) except ValueError: click.echo("An error occurred:", err=True) - click.echo(c.err, err=True) + click.echo(c.err if len(c.err) > 0 else c.out, err=True) sys.exit(1) for (package, resolved, installed, description, vuln) in results: click.echo( diff --git a/pipenv/environments.py b/pipenv/environments.py index b6633f39..6762709d 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -194,6 +194,7 @@ Default is to prompt the user for an answer if the current command line session if interactive. """ +PIPENV_CHECK_KEY = os.environ.get("PIPENV_CHECK_KEY", "1ab8d58f-5122e025-83674263-bc1e79e0") # Internal, support running in a different Python from sys.executable. PIPENV_PYTHON = os.environ.get("PIPENV_PYTHON") From 59824c3725756e5e01508afbb3a01d7247fe2e55 Mon Sep 17 00:00:00 2001 From: Ulrik Johansson Date: Mon, 10 Sep 2018 06:58:55 +0200 Subject: [PATCH 2/4] Add news fragment --- news/2825.feature | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 news/2825.feature diff --git a/news/2825.feature b/news/2825.feature new file mode 100644 index 00000000..9dcbf4ff --- /dev/null +++ b/news/2825.feature @@ -0,0 +1,2 @@ +Added environment variable `PIPENV_CHECK_KEY` to add ability +to override the bundled pyup.io API key. From ba61dd06220c6e91fc196324745d28a8e4338eb4 Mon Sep 17 00:00:00 2001 From: Ulrik Johansson Date: Wed, 19 Sep 2018 07:40:05 +0200 Subject: [PATCH 3/4] Use less ambiguous env var name for pyup api key --- docs/advanced.rst | 2 +- news/2825.feature | 2 +- pipenv/core.py | 4 ++-- pipenv/environments.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/advanced.rst b/docs/advanced.rst index a3f044cb..f2fdee05 100644 --- a/docs/advanced.rst +++ b/docs/advanced.rst @@ -241,7 +241,7 @@ Example:: client usage. You can also use your own safety API key by setting the - environment variable ``PIPENV_CHECK_KEY``. + environment variable ``PIPENV_PYUP_API_KEY``. ☤ Community Integrations diff --git a/news/2825.feature b/news/2825.feature index 9dcbf4ff..ba112a58 100644 --- a/news/2825.feature +++ b/news/2825.feature @@ -1,2 +1,2 @@ -Added environment variable `PIPENV_CHECK_KEY` to add ability +Added environment variable `PIPENV_PYUP_API_KEY` to add ability to override the bundled pyup.io API key. diff --git a/pipenv/core.py b/pipenv/core.py index 830834a4..91633aed 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -55,7 +55,7 @@ from .environments import ( PIPENV_DONT_USE_PYENV, SESSION_IS_INTERACTIVE, PIPENV_CACHE_DIR, - PIPENV_CHECK_KEY, + PIPENV_PYUP_API_KEY, ) # Packages that should be ignored later. @@ -2277,7 +2277,7 @@ def do_check( ignored = "" c = delegator.run( '"{0}" {1} check --json --key={2} {3}'.format( - python, escape_grouped_arguments(path), PIPENV_CHECK_KEY, ignored + python, escape_grouped_arguments(path), PIPENV_PYUP_API_KEY, ignored ) ) try: diff --git a/pipenv/environments.py b/pipenv/environments.py index 6762709d..558bafd2 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -194,7 +194,7 @@ Default is to prompt the user for an answer if the current command line session if interactive. """ -PIPENV_CHECK_KEY = os.environ.get("PIPENV_CHECK_KEY", "1ab8d58f-5122e025-83674263-bc1e79e0") +PIPENV_PYUP_API_KEY = os.environ.get("PIPENV_PYUP_API_KEY", "1ab8d58f-5122e025-83674263-bc1e79e0") # Internal, support running in a different Python from sys.executable. PIPENV_PYTHON = os.environ.get("PIPENV_PYTHON") From 545a23662cad1b3d4e7351854093027b0619c8d0 Mon Sep 17 00:00:00 2001 From: Aliaksei Urbanski Date: Fri, 2 Nov 2018 20:40:04 +0300 Subject: [PATCH 4/4] Fix _get_virtualenv_hash function Case-sensitive filesystems were handled like case-insensitive and vice versa. Close #3151 This changes also: - Add PyCharm's config directory to .gitignore --- .gitignore | 3 +++ news/3151.bugfix | 1 + pipenv/project.py | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 news/3151.bugfix diff --git a/.gitignore b/.gitignore index 4809d065..766ffe3a 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,9 @@ .AppleDouble .LSOverride +# PyCharm +.idea/ + # VSCode .vscode diff --git a/news/3151.bugfix b/news/3151.bugfix new file mode 100644 index 00000000..96f14c10 --- /dev/null +++ b/news/3151.bugfix @@ -0,0 +1 @@ +Fix project path hashing logic in purpose to prevent collisions of virtual environments. diff --git a/pipenv/project.py b/pipenv/project.py index 195448d9..0b32811d 100644 --- a/pipenv/project.py +++ b/pipenv/project.py @@ -449,7 +449,7 @@ class Project(object): # In-project venv # "Proper" path casing (on non-case-sensitive filesystems). if ( - fnmatch.fnmatch("A", "a") + not fnmatch.fnmatch("A", "a") or self.is_venv_in_project() or get_workon_home().joinpath(venv_name).exists() ):