From b83ba99beb2426a7a6e4a9160c34042b854517e1 Mon Sep 17 00:00:00 2001 From: CW Andrews Date: Mon, 2 Oct 2017 15:24:41 -0400 Subject: [PATCH 1/5] Update index.rst --- docs/guide/index.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/index.rst b/docs/guide/index.rst index a05dbf0..27b0a3e 100644 --- a/docs/guide/index.rst +++ b/docs/guide/index.rst @@ -12,7 +12,7 @@ There are a few things that you should know while writing transformations graphs purity transformations services - envrionmental_variables + envrionment_variables Third party integrations :::::::::::::::::::::::: From 5f83aef47d7af31b2b71a715d7edf28d57902467 Mon Sep 17 00:00:00 2001 From: CW Andrews Date: Mon, 2 Oct 2017 15:25:13 -0400 Subject: [PATCH 2/5] Update jupyter.rst --- docs/guide/ext/jupyter.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/guide/ext/jupyter.rst b/docs/guide/ext/jupyter.rst index 0d00c58..8250853 100644 --- a/docs/guide/ext/jupyter.rst +++ b/docs/guide/ext/jupyter.rst @@ -1,6 +1,6 @@ Bonobo with Jupyter =================== -minimalistically + There is a builtin plugin that integrates (somewhat minimallistically, for now) bonobo within jupyter notebooks, so you can read the execution status of a graph within a nice (ok, not so nice) html/javascript widget. From 56d8f3291066348309121787f72cd0a67193c63a Mon Sep 17 00:00:00 2001 From: CW Andrews Date: Mon, 2 Oct 2017 15:34:00 -0400 Subject: [PATCH 3/5] Update environmental_variables.rst --- docs/guide/environmental_variables.rst | 30 ++++++++++++++------------ 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/docs/guide/environmental_variables.rst b/docs/guide/environmental_variables.rst index aa8bbaf..b81197a 100644 --- a/docs/guide/environmental_variables.rst +++ b/docs/guide/environmental_variables.rst @@ -1,44 +1,46 @@ -Environmental Variables +Environment Variables ======================= -Best practice holds that variables should be passed to graphs via environmental variables. +Best practice holds that variables should be passed to graphs via environment variables. Doing this is important for keeping sensitive data out of the code - such as an API token or username and password used to access a database. Not only is this approach more secure, it also makes graphs more flexible by allowing adjustments -for a variety of environments and contexts. Importantly, environmental variables +for a variety of environments and contexts. Importantly, environment variables are also the means by-which arguments can be passed to graphs. -Passing / Setting Environmental Variables +Passing / Setting Environment Variables :::::::::::::::::::::::::::::::::::::::::::: -The recommended way to set environmental variables for a given graph is simply to use +The recommended way to set environment variables for a given graph is simply to use the optional ``--env`` argument when running bonobo from the shell (bash, command prompt, etc). ``--env`` (or ``-e`` for short) should then be followed by the variable name and value using the -syntax `VAR_NAME=VAR_VALUE`. Multiple environmental variables can be passed by using +syntax `VAR_NAME=VAR_VALUE`. Multiple environment variables can be passed by using multiple ``--env`` / ``-e`` flags. Example: .. code-block:: bash - # Using one environmental variable: + # Using one environment variable via --env flag: bonobo run csvsanitizer --env SECRET_TOKEN=secret123 - # Using multiple environmental variables: + # Using multiple environment variables via -e (env) flag: bonobo run csvsanitizer -e SRC_FILE=inventory.txt -e DST_FILE=inventory_processed.csv + + # Using one environment variable in bash (*bash only): + SECRET_TOKEN=secret123 bonobo run csvsanitizer -If you're naming something which is configurable, that is will need to be instantiated or called to obtain something that -can be used as a graph node, then use camelcase names: + # Using multiple environment variables in bash (*bash only): + SRC_FILE=inventory.txt DST_FILE=inventory_processed.csv bonobo run csvsanitizer - -Accessing Environmental Variables from within the Graph Context +Accessing Environment Variables from within the Graph Context ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -Environmental variables, whether global or only for the scope of the graph, +Environment variables, whether global or only for the scope of the graph, can be can be accessed using any of the normal means. It is important to note that whether set globally for the system or just for the graph context, -environmental variables are accessed by bonobo in the same way. In the example +environment variables are accessed by bonobo in the same way. In the example below the database user and password are accessed via the ``os`` module's ``getenv`` function and used to get data from the database. From 504e8920f250689a65834bf728bb478bceaa2ff4 Mon Sep 17 00:00:00 2001 From: CW Andrews Date: Mon, 2 Oct 2017 16:06:04 -0400 Subject: [PATCH 4/5] Update and rename environmental_variables.rst to environment_variables.rst Made review requests per @hardym. --- ...ental_variables.rst => environment_variables.rst} | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) rename docs/guide/{environmental_variables.rst => environment_variables.rst} (74%) diff --git a/docs/guide/environmental_variables.rst b/docs/guide/environment_variables.rst similarity index 74% rename from docs/guide/environmental_variables.rst rename to docs/guide/environment_variables.rst index b81197a..44feb0d 100644 --- a/docs/guide/environmental_variables.rst +++ b/docs/guide/environment_variables.rst @@ -12,13 +12,13 @@ are also the means by-which arguments can be passed to graphs. Passing / Setting Environment Variables :::::::::::::::::::::::::::::::::::::::::::: -The recommended way to set environment variables for a given graph is simply to use -the optional ``--env`` argument when running bonobo from the shell (bash, command prompt, etc). +Setting environment variables for your graphs to use can be done in a variety of ways and which one used can vary +based-upon context. Perhaps the most immediate and simple way to set/override a variable for a given graph is +simply to use the optional ``--env`` argument when running bonobo from the shell (bash, command prompt, etc). ``--env`` (or ``-e`` for short) should then be followed by the variable name and value using the -syntax `VAR_NAME=VAR_VALUE`. Multiple environment variables can be passed by using -multiple ``--env`` / ``-e`` flags. +syntax `VAR_NAME=VAR_VALUE`. Multiple environment variables can be passed by using multiple ``--env`` / ``-e`` flags. Additionally, in bash you can also set environment variables by listing those you wish to set before the `bonobo run` command with space separating the key-value pairs (i.e. `FIZZ=buzz bonobo run ...` or `FIZZ=buzz FOO=bar bonobo run ...`). -Example: +The Examples below demonstrate setting one or multiple variables using both of these methods: .. code-block:: bash @@ -33,6 +33,8 @@ Example: # Using multiple environment variables in bash (*bash only): SRC_FILE=inventory.txt DST_FILE=inventory_processed.csv bonobo run csvsanitizer + +*Though not-yet implemented, the bonobo roadmap includes implementing environment / .env files as well.* Accessing Environment Variables from within the Graph Context ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: From 142a6d60dfaf5f95198e0beb1f1fdd35812ad523 Mon Sep 17 00:00:00 2001 From: CW Andrews Date: Mon, 2 Oct 2017 16:11:41 -0400 Subject: [PATCH 5/5] Updated inline examples and fixed code markup. --- docs/guide/environment_variables.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guide/environment_variables.rst b/docs/guide/environment_variables.rst index 44feb0d..003f0a1 100644 --- a/docs/guide/environment_variables.rst +++ b/docs/guide/environment_variables.rst @@ -16,7 +16,7 @@ Setting environment variables for your graphs to use can be done in a variety of based-upon context. Perhaps the most immediate and simple way to set/override a variable for a given graph is simply to use the optional ``--env`` argument when running bonobo from the shell (bash, command prompt, etc). ``--env`` (or ``-e`` for short) should then be followed by the variable name and value using the -syntax `VAR_NAME=VAR_VALUE`. Multiple environment variables can be passed by using multiple ``--env`` / ``-e`` flags. Additionally, in bash you can also set environment variables by listing those you wish to set before the `bonobo run` command with space separating the key-value pairs (i.e. `FIZZ=buzz bonobo run ...` or `FIZZ=buzz FOO=bar bonobo run ...`). +syntax ``VAR_NAME=VAR_VALUE``. Multiple environment variables can be passed by using multiple ``--env`` / ``-e`` flags (i.e. ``bonobo run --env FIZZ=buzz ...`` and ``bonobo run --env FIZZ=buzz --env Foo=bar ...``). Additionally, in bash you can also set environment variables by listing those you wish to set before the `bonobo run` command with space separating the key-value pairs (i.e. ``FIZZ=buzz bonobo run ...`` or ``FIZZ=buzz FOO=bar bonobo run ...``). The Examples below demonstrate setting one or multiple variables using both of these methods: @@ -39,7 +39,7 @@ The Examples below demonstrate setting one or multiple variables using both of t Accessing Environment Variables from within the Graph Context ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -Environment variables, whether global or only for the scope of the graph, +Environment variables, whether set globally or only for the scope of the graph, can be can be accessed using any of the normal means. It is important to note that whether set globally for the system or just for the graph context, environment variables are accessed by bonobo in the same way. In the example