Package: plover-local-env-var
Plover Local Env VarThisPloverextensionplugincontains ametathat can read in
and output values stored in localenvironment variableson your computer.Use CaseEver have information that is not quite secret enough to warrant putting in a
password manager, but not public enough that you want to have steno dictionary
outlines containing it available to the public? Information like your phone
number, home address, and date of birth is very handy to have in outline values
when filling in online forms etc, but I wouldn't want to share that info inmy steno dictionaries.So, in order to be able to share the outlines I use, but not the values
contained in them, I put that kind of semi-secret information in environment
variables, manage them withdirenv, and use this plugin to access them in
order to write them out.[!NOTE]
If you prefer to manually write out all your semi-secret information and/or
you do not share your steno dictionaries publicly, you may not need to use
this plugin at all.[!WARNING]
Please do not put secret information like passwords in your steno dictionary
outlines! Plover stands between when you write your keystrokes and when they
output on screen, fitting the very definition of a"man-in-the-middle"(see yourstrokes.logfile for what Plover records by default). Use a
password manager.InstallIn the Plover application, open the Plugins Manager (either click the Plugins
Manager icon, or from theToolsmenu, selectPlugins Manager).From the list of plugins, findplover-local-env-varClick "Install/Update"When it finishes installing, restart PloverAfter re-opening Plover, open the Configuration screen (either click the
Configuration icon, or from the main Plover application menu, selectPreferences...)Open the Plugins tabCheck the box next toplover_local_env_varto activate the pluginHow To UseAfter defining andexportingenvironment variables in yourshell
configuration file, you can use them in your outlines with theENV_VARmeta. For an environment variable named$PHONE_NUMBER, the outline would look
like:"{:ENV_VAR:$PHONE_NUMBER}"Pressing the "Disconnect and reconnect the machine" button on the Plover UI
resets the environment variable cache. If you make any changes to the values
contained in your environment variables, make sure to press it so they get
re-read in again.Why a Plugin?I used to access environment variables from a steno outline like in this
example:"PHAEUL/PHAEUL":"{:COMMAND:SHELL:bash -ci 'osascript $STENO_DICTIONARIES/src/command/actions/output-env-var.scpt EMAIL'}"This solution does the following:uses thePlover Run Shellplugin to run a shell command from Pythoncallsbashininteractive mode(-i) so that the command can seeenvironment variables($STENO_DICTIONARIESin this case) defined outside
of the Plover environmentgetsbashto use theosascriptcommand-line tool to load in and run
the target compiledAppleScript(.scpt) fileThe AppleScript in question would then call out to the shell to fetch the$EMAILenv var, and keystroke it out to the screenThis stack ofPython->Shell->AppleScript->Shellis convoluted and just not the
right tool for the job at hand. Plover Local Env Var just uses Python and Shell,
and reduces the outline above to be just:"PHAEUL/PHAEUL":"{:ENV_VAR:$EMAIL}"All the fetched values also get cached, so subsequent calls to the same env var
get returned quicker.DevelopmentClone from GitHub withgit:git clone git@github.com:paulfioravanti/plover-local-env-var.gitcd plover-local-env-varPython VersionPlover's Python environment currently uses version 3.9 (see Plover'sworkflow_context.ymlto confirm the current version).So, in order to avoid unexpected issues, use your runtime version manager to
make sure your local development environment also uses Python 3.9.x.TestingPytestis used for testing in this plugin.Coverage.pyandpytest-covare used for test coverage, and to run
coverage within PytestPylintis used for code qualityMypyis used for static type checkingCurrently, the only parts able to be tested are ones that do not rely directly
on Plover.Run tests, coverage, and linting with the following commands:pytest --cov --cov-report=term-missingpylint plover_local_env_varmypy plover_local_env_varTo get a HTML test coverage report:coverage run --module pytestcoverage htmlopen htmlcov/index.htmlDeploying ChangesAfter making any code changes, deploy the plugin into Plover with the following
command:plover -s plover_plugins install .Whereploverin the command is a reference to your locally installed version
of Plover. See theInvoke Plover from the command linepage for details on
how to create that reference.