Skip to article frontmatterSkip to article content

Configuration

By default, an auto-generated config file is created in the user’s system config directory.

Get Config

1. get_config()

You can get the current config in runtime by calling pe.get_config().

import pfeed as pe
config = pe.get_config()

2. CLI Command

You can also get the current config by using the CLI command pfeed config --list.

Change Config

1. configure()

The recommended way to change the configuration is to use the configure() function. It will only change the config in runtime and should be called before any other functions in the library.

config = pe.configure(
    data_path='your_data_path',  # path to store data
    log_path='your_log_path',  # path to store logs
    debug=True,  # if True, will print debug information
    env_file_path='your_env_file_path',  # path to the .env file
)

- Example: Change Logging Level

This sets the logging level of the stream handler to WARNING so that only WARNING, ERROR, and CRITICAL messages are printed to the console.

pe.configure(
    logging_config={'handlers': {'stream_handler': {'level': 'WARNING'}}},
)

- Example: Load Logging Config File

You can write all the logging config in a yaml file and load it.

pe.configure(
    logging_config_file_path='path/to/your/logging.yml',
)

2. CLI Command

You can change the config by using the CLI command pfeed config. This will change the config file in the user’s system config directory.

pfeed config --data-path your_data_path --log-path your_log_path --debug True --env-file-path your_env_file_path

3. Edit Config File

You can also directly edit the config file manually.

pfeed open --config-file