Usage¶
Once GPyG is installed, it can be used to sign commits. Set the GPG_PASSPHRASE environment variable to your GPG passphrase. How to achieve this depends on the project requirements. For example, it can be set in the configuration file (e.g., ~/.bashrc, ~/.zshrc):
export GPG_PASSPHRASE="your_gpg_passphrase"
Alternatively, it can be set in the CI/CD pipeline configuration.
If it is being used with Gitea, it can be set in the systemd unit file for the gitea service:
[Service]
Environment="GPG_PASSPHRASE=your_gpg_passphrase"
Using a Different Passhrase Variable¶
A different environment variable can be used to store the GPG passphrase by setting the configuration for GPyG. This is done either by placing a configuration file at ~/.config/gpyg/config.yaml, ./gpyg.yaml, or as a section in the pyproject.toml file.
The yaml configuration file should look like this:
gpg_envvar_name: "YOUR_PASSPHRASE_VARIABLE_NAME"
If the pyproject.toml file is used, it should have a section like this:
[tool.gpyg]
gpg_envvar_name = "YOUR_PASSPHRASE_VARIABLE_NAME"
The order of precedence for the configuration is as follows:
./pyproject.toml./gpyg.yaml~/.config/gpyg/config.yaml
Logging¶
GPyG uses the logging module to log messages. Logging can be enabled with defaults by setting the logging key in the configuration file to an empty dictionary:
logging: {}
[tool.gpyg.logging]
By default, GPyG will log to the console, sets the log level to INFO, and uses a sensible log format. These may be changed by adding the following keys to the logging dictionary:
level: The log level. Can be one ofDEBUG,INFO,WARNING,ERROR, orCRITICAL.filename: The name of the file to log to or null to log to the console.format: The log format. Can be any valid log%sformat string. See the logging documentation for more information.
If any of these keys are not set, the default value will be used.