You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are many situations where working with .env files could be beneficial:
They will first of all document and aggregate all the env vars that we currently support
Using .env can streamline our GitHub CI workflows so we don't have to specify the same environment variables in each .yml file, for example we could instead set up a single .env.github file for that
To facilitate changing between different PyFluent/Fluent usage scenarios without having to rewrite code or have separate scripts, can instead have a .env.standalone for standalone Fluent client run, .env.development for local Fluent development version, .env.debug with full logging enabled, .env.container for Docker container run, etc.
We would also no longer need to manually set environment variables in the operating system when executing PyFluent
Initial example of what a .env.example file could look like that documents all env vars (but does not set any values):
.env.example
# Fluent connection
PYFLUENT_FLUENT_ROOT # E:\ANSYS Inc\v241\fluent
SERVER_INFO_DIR # directory where to write server info file
PYFLUENT_SHOW_SERVER_GUI # 0, 1
PYFLUENT_FLUENT_IP # 127.0.0.1
PYFLUENT_FLUENT_PORT # 61738
PYFLUENT_TIMEOUT_FORCE_EXIT # OFF, 5, 10, 30
ANSYSLMD_LICENSE_FILE # license file location or license server port@address
PYFLUENT_FLUENT_DEBUG # 0, 1; whether to launch Fluent in debug mode
# Fluent container launch
PYFLUENT_LAUNCH_CONTAINER # 0, 1
FLUENT_IMAGE_NAME # ghcr.io/ansys/pyfluent
FLUENT_IMAGE_TAG # v23.2.0
FLUENT_CONTAINER_IMAGE # ghcr.io/ansys/pyfluent:v23.2.0
PYFLUENT_CONTAINER_MOUNT_PATH # /mnt/pyfluent
# PyFluent debug logging
PYFLUENT_LOGGING # OFF, DEBUG, INFO, WARNING, ERROR, CRITICAL
PYFLUENT_HIDE_LOG_SECRETS # 0, 1
PYFLUENT_WATCHDOG_DEBUG # OFF, ON
PYFLUENT_GRPC_LOG_BYTES_LIMIT # 1000; 0 to disable
# Documentation specific
DOCUMENTATION_CNAME # nocname.com
PYFLUENT_SKIP_EXAMPLES_DOC # 0, 1
# Testing specific
PYFLUENT_TEST_NAME # none
We can include more Fluent-specific env vars, such as FLUENT_NO_AUTOMATIC_TRANSCRIPT which would help address e.g. #1765
Ideas of how we can actually load the .env files in PyFluent/GitHub:
Automatically load a local .env (if it exists) whenever PyFluent is imported through python-dotenv (https://github.com/theskumar/python-dotenv), so for example before running GitHub CI we would rename .env.github to .env. PyFluent would then automatically pick up and load as environment variables any local .env file when it is being executed (probably not ideal, maybe if the one automatically loaded was called .env.pyfluent)
Could instead (or in addition) make PyFluent automatically load a .env file located in %LocalAppData%\Ansys\ansys-fluent-core
This discussion was converted from issue #1846 on September 20, 2023 17:26.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Based on idea by @mkundu1: #1616 (item 2)
Related: #1439 (document env vars)
There are many situations where working with
.env
files could be beneficial:.env
can streamline our GitHub CI workflows so we don't have to specify the same environment variables in each .yml file, for example we could instead set up a single.env.github
file for that.env.standalone
for standalone Fluent client run,.env.development
for local Fluent development version,.env.debug
with full logging enabled,.env.container
for Docker container run, etc.Initial example of what a
.env.example
file could look like that documents all env vars (but does not set any values):.env.example
We can include more Fluent-specific env vars, such as
FLUENT_NO_AUTOMATIC_TRANSCRIPT
which would help address e.g. #1765Ideas of how we can actually load the
.env
files in PyFluent/GitHub:.env
(if it exists) whenever PyFluent is imported throughpython-dotenv
(https://github.com/theskumar/python-dotenv), so for example before running GitHub CI we would rename.env.github
to.env
. PyFluent would then automatically pick up and load as environment variables any local.env
file when it is being executed (probably not ideal, maybe if the one automatically loaded was called.env.pyfluent
).env
file located in%LocalAppData%\Ansys\ansys-fluent-core
.env
files using for example https://github.com/marketplace/actions/dotenv-action or https://github.com/marketplace/actions/simple-dotenvpytest-dotenv
https://github.com/quiqua/pytest-dotenvBeta Was this translation helpful? Give feedback.
All reactions