Security News
Supply Chain Attack Detected in Solana's web3.js Library
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
VariConfig is a Python package for managing configuration files in a variety of formats and is able to handle variable substitution.
VariConfig is a flexible and powerful Python package for managing configuration files. It supports both YAML and JSON formats and allows for the use of variables within the configuration files, using template placeholders like {{ var }}
.
{{ var }}
).To install VariConfig, use pip:
pip install variconfig
You can load configuration files in YAML or JSON format:
from variconfig import ConfigDict
# Load a YAML file
config = ConfigDict.from_yaml('config.yml')
# Load a JSON file
config = ConfigDict.from_json('config.json')
Once the configuration is loaded, values can be accessed as object attributes:
# Access configuration values
print(config.data_dir) # Output: path from config.yml
print(config.logging_config.loggers.matgraphdb.level) # Output: INFO
Variables can be defined using {{ var }}
placeholders in the configuration file. These will be resolved when the configuration is loaded:
root_dir: "."
data_dir: "{{ root_dir }}/data"
log_dir: "{{ root_dir }}/logs"
In the example above, data_dir
will be resolved to ./data
, and log_dir
will be resolved to ./logs
.
You can modify configuration values at runtime:
# Update a configuration value
config.logging_config.loggers.matgraphdb.level = 'DEBUG'
# Print updated value
print(config.logging_config.loggers.matgraphdb.level) # Output: DEBUG
If you need to convert the configuration back to a standard Python dictionary:
config_dict = config.to_dict()
print(config_dict)
root_dir: "."
data_dir: "{{ root_dir }}/data"
log_dir: "{{ root_dir }}/logs"
db_name: 'VariConfig'
logging_config:
version: 1
disable_existing_loggers: False
formatters:
simple:
format: '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
datefmt: '%Y-%m-%d %H:%M:%S'
handlers:
console:
class: logging.StreamHandler
formatter: simple
stream: ext://sys.stdout
file:
class: logging.FileHandler
formatter: simple
filename: "{{ log_dir }}/variconfig.log"
mode: a
loggers:
variconfig:
level: INFO
handlers: [console]
propagate: no
This project is licensed under the MIT License - see the LICENSE file for details.
FAQs
VariConfig is a Python package for managing configuration files in a variety of formats and is able to handle variable substitution.
We found that variconfig demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A supply chain attack has been detected in versions 1.95.6 and 1.95.7 of the popular @solana/web3.js library.
Research
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.