Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
A Pydantic-ish way to manage your project's YAML configurations.
CI/CD | |
Package |
Documentation: https://dribia.github.io/driconfig
Source Code: https://github.com/dribia/driconfig
The usage of YAML files to store configurations and parameters is widely accepted in the Python community, especially in Data Science environments. DriConfig provides a clean interface between your Python code and these YAML configuration files.
This project resides in the Python Package Index (PyPI), so it can easily be installed with pip
:
pip install driconfig
You can import the DriConfig
class from the driconfig
package and create your own configuration classes.
from driconfig import DriConfig
Let's say we have a YAML configuration file config.yaml
with the following data:
# config.yaml
model_parameters:
eta: 0.2
gamma: 2
lambda: 1
date_interval:
start: 2021-01-01
end: 2021-12-31
Then we can configparse with driconfig
as follows:
from datetime import date
from typing import Dict
from driconfig import DriConfig, DriConfigConfigDict
from pydantic import BaseModel
class DateInterval(BaseModel):
"""Model for the `date_interval` configuration."""
start: date
end: date
class AppConfig(DriConfig):
"""Interface for the config/config.yaml file."""
"""Configure the YAML file location."""
model_config = DriConfigConfigDict(
config_folder=".",
config_file_name="config.yaml",
)
model_parameters: Dict[str, float]
date_interval: DateInterval
config = AppConfig()
print(config.model_dump_json(indent=4))
"""
{
"model_parameters": {
"eta": 0.2,
"gamma": 2.0,
"lambda": 1.0
},
"date_interval": {
"start": "2021-01-01",
"end": "2021-12-31"
}
}
"""
Poetry is the best way to interact with this project. To install it, follow the official Poetry installation guide.
With poetry
installed, one can install the project dependencies with:
poetry install
Then, to run the project unit tests:
make test
To run the linters (ruff
and mypy
):
make lint
driconfig
is distributed under the terms of the
MIT license.
Check the LICENSE file for further details.
FAQs
Pydantic-ish YAML configuration management.
We found that driconfig demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.