Skip to main content

Environment views

Manage your project environment from the Environment, Files, and Variables sidebars.

Environment

Compute profile

From the Environment sidebar in your Hex project, you can customize the memory limit and compute power of your project.

Image

By default, projects use Python 3.9. You can change which version of Python the project uses via the Image dropdown. If your organization uses custom images, you can use the same dropdown to select a custom image to be used in your projects.

Size

tip

Available kernel sizes depend on which plan your workspace is on. Community plans are limited to small kernels, Professional plans can select up to medium kernels, and workspaces with Teams or Enterprise plans can use any kernel size.

Depending on the needs of your project, you can opt into more (or less!) memory and processing power by changing the size of your kernel.

Compute Profiles can be changed in the Environment section on the left side panel by adjusting the Size dropdown under Compute Profile. Profiles range from 2-32 GB of memory and 0.25 - 4 CPUs.

SizeRAM (GB)CPU
X Small20.25
Small40.5
Medium (default)81
Large162
X Large324

By default, projects are created with a Medium profile. Note that if you have configured scheduled runs of a project, those will run with the compute profile as set in the latest published version of your project.

You can find a memory tracker in the lower right of your project's Notebook view that will show you exactly how much memory the kernel has used. Note that this tracker will be updated after each cell has run; it will not update while a given cell is running.

For more info on kernel size availability see Hex's pricing page. Also note that projects using Custom images are limited to large kernels.

Cell execution order

Hex uses a project’s DAG to understand dependencies between cells. Instead of running cells linearly according to the notebook ordering, Hex can leverage this dependency graph to perform various runtime optimizations such as parallelizing independent cells and ignoring hidden cells (when in app view).

In the middle of the Environment sidebar, you can use the Cell execution order toggle to determine if the project should run with performance optimization (toggle on) or run linearly (toggle off). Leaving the toggle ON is recommended for the vast majority of cases - when in doubt, leave it alone!

In rare circumstances where Hex is not able to intuit a dependency between python cells, the toggle can be turned OFF to force linear ordering based on the notebook cell order.

Files

From the Files sidebar in your Hex project, you can upload files including CSV and JSON files.

Variables

From the Variables sidebar in your Hex project, you can add project secrets and environment variables, as well as reference built-in variables and any variables defined in your code.

Secrets

Keep your sensitive values, like API tokens or passwords, secret by adding them as Secrets. We store all Secrets in a highly-encrypted vault, which is only visible to other users with "Full Access" or "Can Edit" project permissions. Secrets can be referenced in Python cells, but an attempt to display them in the Notebook view or App builder will return [SECRET VALUE] .

You can add a Secret to a project by clicking the +Add button in the Secrets tab of the left sidebar. If you want to use a Secret which is defined as a shareable, workspace Secret, choose Import workspace secret from the menu to be presented with Secrets which are available for import. If you want to create a Secret for use only in the given project select Create project secret.

To access your Secrets, call them directly in place of where you would hard-code your credentials. In the example below, we're setting up a Snowflake connection and passing the database details as Secrets.

Environment variables

You can configure environment variables to be used in your projects. Environment variables aren't kept in the encrypted vault, nor are they redacted. Setting an environment variable in the left side panel is equivalent to using the python os library directly in your logic.

See more documentation for the os library here.

Built-in variables

We also have some variables which are automatically included in your project. These variables can be referenced in any cell.

VariableValueDescription
hex_scheduledFalse/TrueIf the run is being executed as part of a scheduled run, this variable is set to True. If the run is executed in any other context, the variable is set to False.
hex_user_emailemailIf a user is logged in and viewing a published app, this variable is equal to the email address associated with their user account. Helpful if you want to customize what a given user sees in the app. Check out our Tutorials page for an example.
hex_run_context"logic", "app", "scheduled", "api-triggered"Describes the context that the project is being run in. Helpful if you want to restrict certain logic to only run in particular run contexts. For example, use this if you have some debug code that you want to run in the logic, but don't want to run while a user is interacting with the published app.
hex_timezone"America/Los_Angeles", "Australia/Sydney", etc.The timezone selected for the project. By default this is the workspace timezone, but can also be overridden at the project level, as well as for specific app sessions. See Chart cell timezones for more information.
hex_project_idProject ID i.e. 1f0cfa16-cea1-428a-b950-e56379f2fdacA unique project identifier found in the Project's URL
hex_project_nameProject Name i.e. "Weekly Metrics"Name given to the project
hex_status"In Progress", "Approved", "Archive", etc.Status the project is tagged with. Admins can configure custom statuses in the Organization section of workspace settings.
hex_categories["Q2 projects", "Analytics", etc.]Category or categories the project is tagged with. Admins can configure custom categories in the Organization section of workspace settings.
hex_color_palette['#4C78A8', '#F58518', '#E45756', ... ]An array of CSS color codes that map to the currently active workspace color palette. Using this variable can help create consistently themed visualizations when using both the native Chart cell and visualizations created via Python packages.

Mute cells

If there are cells in your project that you only want to execute in specific contexts (e.g. on project runs in Notebook view, only during scheduled runs, etc.), you can do so using the built-in hex_run_context and hex_scheduled variables. With these variables, you can check the context for when each cell is run and execute the desired logic accordingly. See the below code snippets for some examples code!

if hex_run_context == 'logic':
## Something that only needs to happen during a Notebook run
else:
## otherwise this cell will be muted

Similarly, you can do the same in an SQL cell via Jinja.

{% if hex_run_context == 'logic' %}
-- Something that only needs to happen during a Notebook run

{% endif %}

Variable explorer

The Variable explorer allows you to browse the variables generated by your code. For each variable, we show you its name, type, and value.