
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Using YAML configuration files for python require less boilerplate code, and accessing the values by dot notation.
pip install comfyconf
Create a config file in YAML and name it foo.yaml:
test:
title: 'test'
ip: '127.0.0.1'
port: 5000
production:
title: 'My amazing server'
ip: '1234.255.255.1'
port: 1234
Now, load it using make_config
:
>>> from comfyconf import make_config
>>> config = make_config("foo.yaml")
>>> config.test.ip
'127.0.0.1'
>>> config.production.port
1234
Note that numerical keys are not allowed (even if they're strings in YAML), doing so will raise a ValueError
.
If you prefer ruamel.yaml or need to parse YAML 1.2 document you can specify `"ruamel"`` as the reader:
>>> config = make_config("foo.yaml", reader="ruamel")
If you need to be validate that the configuration is compatible with a schema, you can use validate_config:
First, create a schema:
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"$defs": {
"connection": {
"type": "object",
"additionalProperties": false,
"properties": {
"title": {"type": "string"},
"ip": {"type": "string", "format":"ipv4"},
"port": { "type": "integer", "minimum": 1, "maximum": 65535}
},
"required": ["title", "ip", "port"]
}
},
"type": "object",
"properties": {
"test": {"$ref": "#/$defs/connection"},
"production": {"$ref": "#/$defs/connection"}
}
}
>>> from comfyconf import make_config, validate_config
>>> config = make_config("foo.yaml", reader="ruamel")
>>> validate_config(config, "schema.json", validator='json')
Currently, json-schema (validator='json'
) is the default but yamale schema can also be used (validator='yamale'
) if yamale is installed.
If you find a bug or have a feature request, please raise on issue on Github.
Contributions are more than welcome, but please:
FAQs
YAML config parser
We found that comfyconf 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
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.