Introduction
Standalone Loader class simplifies loading of content from files .yaml, .json, .sql, and .txt.
Quick Start
# import the Loader class
from surquest.utils.loader import Loader
# load a yaml file
config_yaml = Loader.load(path="./path/to/config.yaml")
# alternatively load of yaml file
config_yaml = Loader.load_yaml(path="./path/to/config.yaml")
# load a json file
config_json = Loader.load(path="./path/to/config.json")
# alternatively load of json file
config_json = Loader.load_json(path="./path/to/config.json")
# load a sql file
config_sql = Loader.load(path="./path/to/config.sql")
# alternatively load of sql file
config_sql = Loader.load_sql(path="./path/to/config.sql")
Installation
pip install surquest-utils-loader
Additional information
Content loaded from JSON or YAML files is returned as a DictDot (dictionary which keys are accessible as attributes). This allows you to access the content of the file using the dot notation. Lets assume example.yaml contains the following content:
---
family:
name: Smith
members:
- name: John # father
age: 40
- name: Jane # mother
age: 38
You can access the content of the file using the dot notation:
from surquest.utils.loader import Loader
config = Loader.load_yaml(path="./path/to/example.yaml")
print(config.family.name) # Smith
print(config.family.members[0].name) # John
print(config.family.members[1].name) # Jane
In case you don't want to use the dot notation you can use the standard dictionary as output format for the loaded content:
from surquest.utils.loader import Loader
config = Loader.load_yaml(path="./path/to/example.yaml", output_type=dict)
Local development
You are more than welcome to contribute to this project. To make your start easier we have prepared a docker image with all the necessary tools to run it as interpreter for Pycharm or to run tests.
Build docker image
docker build `
--tag surquest/utils/loader `
--file package.base.dockerfile `
--target test .
Run tests
docker run --rm -it `
-v "${pwd}:/opt/project" `
-w "/opt/project/test" `
surquest/utils/loader pytest
Metadata
Release files for surquest-utils-loader 0.0.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 | Actions |
|---|---|---|---|---|
| surquest_utils_loader-0.0.1.tar.gz | 7.1 kB | Without provenance | Details for surquest_utils_loader-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| surquest_utils_loader-0.0.1-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for surquest_utils_loader-0.0.1-py2.py3-none-any.whl |
Total release size: 11.4 kB
Release files / surquest_utils_loader-0.0.1.tar.gz
| Download URL | surquest_utils_loader-0.0.1.tar.gz |
|---|---|
| Size | 7.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17bb44f48f46c884f9985b023a70c1b4a3701b9caec610e212631a8452268cd4
|
|
BLAKE2b-256 checksum How to use checksums |
9b3b398b036544eeaa412d4c927cc6eb53812bb77a09bcb9caefe84ce78fc668
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / surquest_utils_loader-0.0.1-py2.py3-none-any.whl
| Download URL | surquest_utils_loader-0.0.1-py2.py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
aa501edb5916cd54d824fe1df7f7df0a0645c2b6aacb0abf1c9e8e559bd31444
|
|
BLAKE2b-256 checksum How to use checksums |
08a1b8bcce5aa9ed37383e64e835bacdaf856d48c0eb5de0006196d0220a0a3d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for surquest-utils-loader 0.0.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.