
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
confclasses
Advanced tools
Create dataclass-style classes that can be used for configuring a Python tool. The idea is to handle loading and saving the config from files while allowing simpler IDE usage with the config. We don't need 90% of the features in dataclasses, so we make the API easier.
The module is designed to have a global config object that is instantiated at the start and then loaded dynamically later. Please see the common usage section for an example.
confclasses_comments is also shipped with this tool. It uses ruamel.yaml to add comments and ast to get the "docstring" of the annotations (fields) in the config classes.
Create a config.py to store the config.
# config.py
@confclass
class RepeatingConfig:
test: str
default1: int = 123
@confclass
class NestedConfig:
field1: str = "foo"
field2: str = "bar"
""" test document for field 2 """
hashed_field3: RepeatingConfig = RepeatingConfig(test="nested")
@confclass
class ExampleConfig:
nested: NestedConfig
field3: int = 42
""" test document for field 3 """
hashed_field1: list = ["test", "items"]
hashed_field2: dict = {"key1": "value1"}
hashed_field4: RepeatingConfig = RepeatingConfig(test="base")
config = ExampleConfig()
Loading it at the start
# main.py
from confclasses import load_config
from config import config
from .example_module import example_function
def main():
with open('conf.yaml', 'r') as f:
load_config(config, f.read())
example_function()
In the example_module
# example_module.py
from config import config
def example_function():
print(config.field3)
FAQs
A simple wrapper around dataclasses, for general configuration
We found that confclasses demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.