Skip to content

How can I use Plover as a library from an independent script? #1292

Discussion options

You must be logged in to vote

Some modules can be used directly (KeyboardCapture for example).

Some others (system-dependent) require using the registry to register some modules.

# make sure that Plover can be imported in the current Python environment
import plover

from plover.registry import registry
from plover import system
from plover.steno import Stroke

registry.update()

system.setup("English Stenotype")

print(Stroke({"S-", "T-"}))

Note: registry.update() loads all the currently-installed plugins, which might take a long time depends on which plugins are installed (even with the base Plover installation, it still takes 0.6s). An alternative is to do

import pkg_resources

registry.register_plugin_from_entrypoint

Replies: 1 comment 4 replies

Comment options

user202729
Apr 24, 2021
Collaborator Author

You must be logged in to vote
4 replies
@benoit-pierre
Comment options

@benoit-pierre
Comment options

@benoit-pierre
Comment options

@user202729
Comment options

user202729 Apr 25, 2021
Collaborator Author

Answer selected by user202729
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants