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/docs/advanced.rst b/docs/advanced.rst index 6981abf5..3ac323e6 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_PYUP_API_KEY``. + ☤ Community Integrations ------------------------ diff --git a/news/2825.feature b/news/2825.feature new file mode 100644 index 00000000..ba112a58 --- /dev/null +++ b/news/2825.feature @@ -0,0 +1,2 @@ +Added environment variable `PIPENV_PYUP_API_KEY` to add ability +to override the bundled pyup.io API key. 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/core.py b/pipenv/core.py index 894ecaa2..bf4145e5 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -56,6 +56,7 @@ from .environments import ( PIPENV_DONT_USE_PYENV, SESSION_IS_INTERACTIVE, PIPENV_CACHE_DIR, + PIPENV_PYUP_API_KEY, ) from ._compat import fix_utf8 from . import exceptions @@ -2452,15 +2453,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_PYUP_API_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 c5874136..4ee8b90f 100644 --- a/pipenv/environments.py +++ b/pipenv/environments.py @@ -210,6 +210,7 @@ Default is to prompt the user for an answer if the current command line session if interactive. """ +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") 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() ):