![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
A simple configuration manager for Python that allows you to easily manage nested configurations using JSON files.
You can install the package via pip:
pip install configurationlib
If the file specified does not exist, it will be created.
[!WARNING] Please do note, if you specify the wrong file with the wrong format, it may load incorrectly or may break your file.
Here is a simple example of the usage of this module:
import configurationlib
# Create an instance of the configuration manager
config = configurationlib.Instance(file="config.json") # Choose any file name you like! The file will be created if it does not exist.
# Use save() to get access to the current configuration and set values
config.save()["dic1"] = {} # Initialize a new dictionary
config.save()["dic1"]["afewmoredic"] = {} # Initialize a nested dictionary
config.save()["dic1"]["afewmoredic"]["key"] = "value" # Set a value
config.save()['weird'] = True
# Retrieve values from nested dictionaries using get()
retrieved_value = config.get()["dic1"]["afewmoredic"]["key"] # Use config.get to retrieve the value
print(retrieved_value) # Output: value
# Save changes after modifying (optional, since save is called after every modification)
config.save()
If you want, You can change the format of the saved file (YAML, JSON, dotENV) the default already is JSON so if you want json, you don't need to do anything. Here is how you can change it to YAML:
import configurationlib
# Create an instance of the configuration manager
config = configurationlib.Instance(file="config.json", format=configurationlib.Format.YAML) # Use Yaml. Change this to ENV to use env
# Use save() to get access to the current configuration and set values
config.save()["dic1"] = {} # Initialize a new dictionary
config.save()["dic1"]["afewmoredic"] = {} # Initialize a nested dictionary
config.save()["dic1"]["afewmoredic"]["key"] = "value" # Set a value
# Retrieve values from nested dictionaries using get()
retrieved_value = config.get()["dic1"]["afewmoredic"]["key"] # Use config.get to retrieve the value
print(retrieved_value) # Output: value
# Save changes after modifying (optional, since save is called after every modification)
config.save()
The only line that changes is config = configurationlib.Instance(file="config.json", format=configurationlib.Format.YAML
nothing else changes. It will automatically save the data into the data you'd like! If you remove format argument, it will default to JSON
.
[!NOTE] Hot reloading is disabled by default If you want to enable hot reloading, Use this:
config = configurationlib.Instance(file="config.json", format=configurationlib.Format.YAML, hot_reloading=True)
FAQs
A simple configuration manager
We found that configurationlib 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.