diff --git a/news/5070.bugfix.rst b/news/5070.bugfix.rst new file mode 100644 index 0000000000..9fd8072d42 --- /dev/null +++ b/news/5070.bugfix.rst @@ -0,0 +1 @@ +Fixes issue of ``requirements`` command problem by modifying to print ``-e`` and path of the editable package. diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 0a3c6aeb90..e40ad3313c 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -759,21 +759,25 @@ def requirements(state, dev=False, dev_only=False, hash=False): lockfile = state.project.lockfile_content for i, package_index in enumerate(lockfile["_meta"]["sources"]): prefix = "-i" if i == 0 else "--extra-index-url" - echo(crayons.normal(" ".join([prefix, package_index["url"]]))) + echo(" ".join([prefix, package_index["url"]])) if not dev_only: for req_name, value in lockfile["default"].items(): - if hash: + if value.get("editable", False): + echo("-e " + value["path"]) + elif hash: hashes = [f" \\\n --hash={h}" for h in value.get("hashes", [])] + echo("".join([req_name, value["version"], *hashes])) else: - hashes = [] - echo(crayons.normal("".join([req_name, value["version"], *hashes]))) + echo("".join([req_name, value["version"]])) if dev or dev_only: for req_name, value in lockfile["develop"].items(): - if hash: + if value.get("editable", False): + echo("-e " + value["path"]) + elif hash: hashes = [f" \\\n --hash={h}" for h in value.get("hashes", [])] + echo("".join([req_name, value["version"], *hashes])) else: - hashes = [] - echo(crayons.normal("".join([req_name, value["version"], *hashes]))) + echo("".join([req_name, value["version"]])) sys.exit(0)