gileum
Installing
- Python: >= 3.7
python -m pip install gileum
Basic Usage
gileum is a loader of configuration scripts written in Python. On gileum, a configuration can be implemented as a subclass of gileum.BaseGileum. gileum.BaseGileum is a light-weight wrapper of pydantic.BaseModel, so you can easily implemented the subclass in almost same way as pydantic.
Developer-side
In source code of something like web application, a developer can implement a gileum class as below, which will be the interface to launch the app:
from typing import Literal
from gileum import BaseGileum
class SampleGileum(BaseGileum):
app_name: str
hostname: str
port: int
glm_name: Literal["main", "test"]
Note that all subclasses of gileum.BaseGileum must have the field glm_name whose type must be Literal of some strings. The field may be used as a flag and the developer may judge the flag to determine how the app should work.
After the implementaion is done, the developer can invoke gileum.load_glms_at() specifying path of a configuration file for users to create:
from gileum import load_glms_at
load_glms_at(path_to_config)
Note that the default suffix of configuration files is .glm.py, e.g. config.glm.py. There is also another function named gileum.load_glms_in(), which loads all the configuration files in specified directory.
Fianlly, the developer can access to the SampleGileum objects loaded by calling gileum.get_glm() function:
from gileum import get_glm
config_main = get_glm("main", SampleGileum)
config_test = get_glm("test", SampleGileum)
# Now you can access to the fields of the SampleGileum objects.
assert config_main.glm_name == "main"
assert config_test.glm_name == "test"
User-side
A user of the app above needs to create a configuration file and generate two SimpleGileum objects. The location of the configuration file depends on apps the user uses. Now, let's assume that the name of the app package is sample_app, and in the app, the location is user's working directory. For example, the user can create a configuration file named config.glm.py and generate the SimpleGileum objects:
# config.glm.py
from sample_app import SimpleGileum
gileum_main = SimpleGileum(
app_name="sample_app",
hostname="example.com",
port=443,
glm_name="main"
)
gileum_main = SimpleGileum(
app_name="sample_app@test",
hostname="localhost",
port=8000,
glm_name="test"
)
That's it!! Now what you have to do the next is just to execute the app. The way of it depends on the app.
Metadata
Release files for gileum 0.2.2
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 |
|---|---|---|---|---|
| gileum-0.2.2.tar.gz | 5.6 kB | Without provenance | Details for gileum-0.2.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| gileum-0.2.2-py3-none-any.whl | Python 3 | none | any | Details for gileum-0.2.2-py3-none-any.whl |
Total release size: 13.3 kB
Release files / gileum-0.2.2.tar.gz
| Download URL | gileum-0.2.2.tar.gz |
|---|---|
| Size | 5.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fff21ac2c43e004e36cbafc7f2befa09b0affc44acd71be2c858dabbc655999
|
|
BLAKE2b-256 checksum How to use checksums |
ab941a35a2f159d59cb592e631dc27c4a90bcbd2a931055430e12be7905f0933
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10
|
Release files / gileum-0.2.2-py3-none-any.whl
| Download URL | gileum-0.2.2-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0d6379d90bafd5081bf73ddad772985cd5147de820a97a601b969bf3f0bf1f32
|
|
BLAKE2b-256 checksum How to use checksums |
82b1816214cbb5d53dc25011b44bac343e3d467d65c43a20ab5b7e60f0de4cca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.7.10
|
Security for gileum 0.2.2
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.