Skip to content

Commit

Permalink
Always show version in pip command
Browse files Browse the repository at this point in the history
The most common reason I find myself going to PyPi is to find the latest version to copy & paste into my `requirements.txt`. It'd be really nice if the main package page had the string that goes into requirements.txt. What I usually do is copy and paste the title, and edit the space to be `==`.
  • Loading branch information
bfirsh committed Apr 30, 2021
1 parent b579d68 commit 62c9607
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions warehouse/templates/packaging/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,10 @@ <h3 class="package-snippet__title">
{% set index_url = " -i https://test.pypi.org/simple/" %}
{%- endif -%}

{%- if request_route == "packaging.release" -%}
{% set project_version = "==" + release.version %}
{%- endif -%}

{%- if release.version.epoch -%}
pip install{{ index_url }} '{{ release.project.name }}{{ project_version }}'
pip install{{ index_url }} '{{ release.project.name }}=={{ release.version }}'
{%- else -%}
pip install{{ index_url }} {{ release.project.name }}{{ project_version }}
pip install{{ index_url }} {{ release.project.name }}=={{ release.version }}
{%- endif -%}
{%- endmacro -%}

Expand Down

0 comments on commit 62c9607

Please sign in to comment.