Skip to content

Commit

Permalink
#2317 documentation variable expansion (#2966)
Browse files Browse the repository at this point in the history
#2317 documentation variable expansion
  • Loading branch information
techalchemy authored May 27, 2019
2 parents d841dd5 + abee697 commit 8ae44bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 5 deletions.
20 changes: 15 additions & 5 deletions docs/advanced.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,12 +353,14 @@ To prevent pipenv from loading the ``.env`` file, set the ``PIPENV_DONT_LOAD_ENV
☤ Custom Script Shortcuts
-------------------------

Pipenv supports creating custom shortcuts in the (optional) ``[scripts]`` section of your Pipfile.
Pipenv supports creating custom shortcuts in the (optional) ``[scripts]`` section of your Pipfile.

You can then run ``pipenv run <shortcut name>`` in your terminal to run the command in the
context of your pipenv virtual environment even if you have not activated the pipenv shell first.
context of your pipenv virtual environment even if you have not activated the pipenv shell first.

For example, in your Pipfile::
For example, in your Pipfile:

.. code-block:: toml
[scripts]
printspam = "python -c \"print('I am a silly example, no one would need to do this')\""
Expand All @@ -369,18 +371,25 @@ And then in your terminal::
I am a silly example, no one would need to do this

Commands that expect arguments will also work.
For example::
For example:

.. code-block:: toml
[scripts]
echospam = "echo I am really a very silly example"
::

$ pipenv run echospam "indeed"
I am really a very silly example indeed

☤ Support for Environment Variables
-----------------------------------

Pipenv supports the usage of environment variables in values. For example::
Pipenv supports the usage of environment variables in place of authentication fragments
in your Pipfile. These will only be parsed if they are present in the ``[[source]]``
section. For example:

.. code-block:: toml
[[source]]
url = "https://${PYPI_USERNAME}:${PYPI_PASSWORD}@my_private_repo.example.com/simple"
Expand All @@ -395,6 +404,7 @@ Pipenv supports the usage of environment variables in values. For example::
records = "*"
Environment variables may be specified as ``${MY_ENVAR}`` or ``$MY_ENVAR``.

On Windows, ``%MY_ENVAR%`` is supported in addition to ``${MY_ENVAR}`` or ``$MY_ENVAR``.


Expand Down
1 change: 1 addition & 0 deletions news/2317.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added documenation about variable expansion in ``Pipfile`` entries.

0 comments on commit 8ae44bc

Please sign in to comment.