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):

Bash/Zsh
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:

Gitea systemd unit file
[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:

~/.config/gpyg/config.yaml or ./gpyg.yaml
gpg_envvar_name: "YOUR_PASSPHRASE_VARIABLE_NAME"

If the pyproject.toml file is used, it should have a section like this:

./pyproject.toml
[tool.gpyg]
gpg_envvar_name = "YOUR_PASSPHRASE_VARIABLE_NAME"

The order of precedence for the configuration is as follows:

  1. ./pyproject.toml

  2. ./gpyg.yaml

  3. ~/.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:

~/.config/gpyg/config.yaml or ./gpyg.yaml
logging: {}
./pyproject.toml
[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 of DEBUG, INFO, WARNING, ERROR, or CRITICAL.

  • 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 %s format string. See the logging documentation for more information.

If any of these keys are not set, the default value will be used.