simplesettings-py
Python settings files done simple.
Simple docs
simplesettings.clear() Clears the settings file
simplesettings.save() Saves a variable to the settings file, example:
import simplesettings_py as settings
settings.save("Data", 123)
settings.save("MoreData", "real")
settings.save("MoreMoreData", {"You can save": "a dictionary!"}, table="dictionaries")
settings.save("EvenMoreMoreData", ("A", "B", "C"), table="tuples")
Outputted settings file (by default .settings):
(main)
Data = 123
MoreData = real
(dictionaries)
MoreMoreData = {'You can save': 'a dictionary!'}
(tuples)
EvenMoreMoreData = ('A', 'B', 'C')
simplesettings.save_dict() Saves an entire dictionary to the settings file in simplesettings format, example:
import simplesettings_py as settings
a_dictionary = {
"Data": 123,
"MoreData": "One Two Three",
"MoreMoreData": {"You can save": "a dictionary!"},
"EvenMoreMoreData": ("A", "B", "C")
}
settings.save_dict(a_dictionary, table="saved_dict")
Outputted settings file:
(saved_dict)
Data = 123
MoreData = One Two Three
MoreMoreData = {'You can save': 'a dictionary!'}
EvenMoreMoreData = ('A', 'B', 'C')
simplesettings.load() Loads the settings file into a dictionary; example:
import simplesettings_py as settings
print(settings.load())
Output: {'saved_dict': {'Data': 123, 'MoreData': 'One Two Three', 'MoreMoreData': {'You can save': 'a dictionary!'}, 'EvenMoreMoreData': ('A', 'B', 'C')}}
You can use this to get certain values, example:
import simplesettings_py as settings
settings = settings.load()
print(settings["saved_dict"]["Data"])
Output: 123
simplesettings.loads() The same as simplesettings.load() but takes a simplesettings string as an argument, example:
import simplesettings_py as settings
print(settings.loads(
"""
(main)
Data = 123
MoreData = real
(dictionaries)
MoreMoreData = {'You can save': 'a dictionary!'}
(tuples)
EvenMoreMoreData = ('A', 'B', 'C')
"""
))
Output: {'main': {'Data': 123, 'MoreData': 'real'}, 'dictionaries': {'MoreMoreData': {'You can save': 'a dictionary!'}}, 'tuples': {'EvenMoreMoreData': ('A',
'B', 'C')}}
Note that the load() and loads() functions will automatically convert strings of integers, floats, booleans, tuples, lists and dictionaries to the right type, don't forget to convert them back to the type you want (which you should be doing anyway x))
Please feel free to create a pull request if you encounter any issues or something that could be improved
Metadata
Release files for simplesettings-py 1.0.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| simplesettings-py-1.0.4.tar.gz | 3.6 kB | Without provenance | Details for simplesettings-py-1.0.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| simplesettings_py-1.0.4-py3-none-any.whl | Python 3 | none | any | Details for simplesettings_py-1.0.4-py3-none-any.whl |
Total release size: 7.6 kB
Release files / simplesettings-py-1.0.4.tar.gz
| Download URL | simplesettings-py-1.0.4.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2a91917b17f6bd21e74054b8f733a1c0e8f5080a3c1a880d1dedd94955cbbd4e
|
|
BLAKE2b-256 checksum How to use checksums |
d133c9b83f2179c2f217539c9fa4ac2aa75e45597e3c011e76b72b69d39f00be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Release files / simplesettings_py-1.0.4-py3-none-any.whl
| Download URL | simplesettings_py-1.0.4-py3-none-any.whl |
|---|---|
| Size | 4.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
73b3d7a4140eed36c91f9d7a66f0e226a425331f443db7fbe87ba34e9da764e0
|
|
BLAKE2b-256 checksum How to use checksums |
a5a297a2e607c19b9ce21d889979ad2720cd218131943bcccf76b2606e300ee0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.1
|
Security for simplesettings-py 1.0.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.