Skip to main content

Use your local environment variables in Plover

Project description

Plover Local Env Var

Build Status PyPI - Version PyPI - Downloads linting: pylint

This Plover extension plugin contains a meta that can read in and output values stored in local environment variables on your computer.

Use Case

Ever 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 in my 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 with direnv, 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 your strokes.log file for what Plover records by default). Use a password manager.

Install

  1. In the Plover application, open the Plugins Manager (either click the Plugins Manager icon, or from the Tools menu, select Plugins Manager).
  2. From the list of plugins, find plover-local-env-var
  3. Click "Install/Update"
  4. When it finishes installing, restart Plover
  5. After re-opening Plover, open the Configuration screen (either click the Configuration icon, or from the main Plover application menu, select Preferences...)
  6. Open the Plugins tab
  7. Check the box next to plover_local_env_var to activate the plugin

How To Use

After defining and exporting environment variables in your shell configuration file, you can use them in your outlines with the ENV_VAR meta. For an environment variable named $PHONE_NUMBER, the outline would look like:

macOS or Linux

"{:ENV_VAR:$PHONE_NUMBER}"

Windows

"{:ENV_VAR:$ENV: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.

All the fetched values also get cached, so subsequent calls to the same env var get returned quicker.

Development

Clone from GitHub with git:

git clone git@github.com:paulfioravanti/plover-local-env-var.git
cd plover-local-env-var
python -m pip install --editable ".[test]"

If you are a Tmuxinator user, you may find my plover_local_env_var project file of reference.

Python Version

Plover's Python environment currently uses version 3.9 (see Plover's workflow_context.yml to 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.

Testing

  • Pytest is used for testing in this plugin.
  • Coverage.py and pytest-cov are used for test coverage, and to run coverage within Pytest
  • Pylint is used for code quality
  • Mypy is used for static type checking

Currently, 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-missing
pylint plover_local_env_var
mypy plover_local_env_var

To get a HTML test coverage report:

coverage run --module pytest
coverage html
open htmlcov/index.html

If you are a just user, you may find the justfile useful during development in running multiple test commands. You can run the following command from the project root directory:

just --working-directory . --justfile test/justfile

Deploying Changes

After making any code changes, deploy the plugin into Plover with the following command:

plover --script plover_plugins install --editable .

Where plover in the command is a reference to your locally installed version of Plover. See the Invoke Plover from the command line page for details on how to create that reference.

When necessary, the plugin can be uninstalled via the command line with the following command:

plover --script plover_plugins uninstall plover-local-env-var

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

plover_local_env_var-0.3.3.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

plover_local_env_var-0.3.3-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file plover_local_env_var-0.3.3.tar.gz.

File metadata

  • Download URL: plover_local_env_var-0.3.3.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.6

File hashes

Hashes for plover_local_env_var-0.3.3.tar.gz
Algorithm Hash digest
SHA256 b2aa01ce61a966a6481753d833a2d7ec4207d07b8f1b1952c166a73697139665
MD5 c18399fa474208384ffa4e9b31627813
BLAKE2b-256 4a6f276edffea79d8d1e68644c3d48ba81b4f0d786744081961519bd89687380

See more details on using hashes here.

File details

Details for the file plover_local_env_var-0.3.3-py3-none-any.whl.

File metadata

File hashes

Hashes for plover_local_env_var-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5b8d72342c5307ff5ed515a3aec7582a1ca4b324a9872939cc1089b5c2c4d898
MD5 2658634d9af5f2d50c1c4ebd34739a26
BLAKE2b-256 2ebcef68f7cfc2aa8e79f4e934c83cbb863a903829c45626cc09eb292a22c286

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page