Github
PYPI
Discord
FastDataFile
This library is a simple library helping you to establish file datafiles with ease
How to install
To install just use following command
pip install fastdatafile
If you are looking for latest beta/alpha, you can use following command
pip install --upgrade git+https://github.com/Ashenguard/FastDataFile.git
By installing this library following libraries and their dependencies will be installed too.
Json & Yaml - Used as basic encoders
Example
This example JSON file
{
"Test": {
"BranchA": 5,
"BranchB": "Great ;)"
},
"TestValue": 1234
}
Basic example on how fast datafiles work, JSONDataFile is an example here and YAMLDataFile is also the same
from FastDataFile import JSONDataFile
"""
If you set `create_if_missing` to `True` it will create the file if it's missing and will save the `default_data` in it.
Providing `None` to `default_data` will result of saving an empty data (`{}`)
Arguments shown here are default values, You can ignore them if you want to use the default values.
"""
json_db = JSONDataFile.open('path/to/file.json', create_if_missing=True, default_data=None, encoding='utf8')
"""
Data can be nested tree, You can move in the tree by using `.` as seperator.
You can provide the method a type or lambda as cast, It will use it to process data one more time! It's not required!
"""
print(json_db.get_data('Test.BranchA', cast=int) * 2)
# Prints: 10
print(json_db.get_data('Test.BranchA', cast=str) * 2)
# Prints: 55
"""
Same rules is applied here for the pathing in the data.
If `default` is set to `True` it will only apply data if the path do not exists!
"""
json_db.set_data('Test.BranchB', "Hey!") # Change the data to `Hey!`
json_db.set_data('Test.BranchB', "Hi!", default=True) # Skips as it exists
json_db.set_data('Test.BranchC', "Hi!", default=True) # Adds the new path and save the data
"""
Removes the path and value for ever! (A long time!!!)
"""
json_db.remove('TestValue')
"""
Removes the data file for ever! (A long time!!!)
You must provide the `confirm` wih `True` or it will not remove the file!
"""
json_db.delete(confirm=True)
You can use YAMLDataFile instead of JSONDataFile and it will be the same, Just another format of file encoding will be used.
❗ There will be more tutorials and examples at FastDataFile Wiki ❗
Metadata
Release files for FastDataFile 2.1.1
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 | |
|---|---|---|---|---|
| FastDataFile-2.1.1.tar.gz | 7.2 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| FastDataFile-2.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.7 kB
Release files / FastDataFile-2.1.1.tar.gz
| Download URL | FastDataFile-2.1.1.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
51a3dc047e63879b3441ee19e6138d92aaab5adec5a90319ff4d13c526b87dd6
|
|
BLAKE2b-256 checksum How to use checksums |
b592797e56606430256d9984d7ed2895c40180d90221c3b3702a9daf90c18e57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.26.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.6
|
Release files / FastDataFile-2.1.1-py3-none-any.whl
| Download URL | FastDataFile-2.1.1-py3-none-any.whl |
|---|---|
| Size | 8.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3a958ed62effe479c893e663915905db30d3fd1f5837fbf6e461b5aef7bac711
|
|
BLAKE2b-256 checksum How to use checksums |
3a3b22226d19a58977d4acc82079ebc2acb1e0545e1156e404e6a80e0ab12770
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.26.0 setuptools/56.0.0 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.9.6
|
Security for FastDataFile 2.1.1
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.