Application Builder
The goal of application builder is to have a single object that connects settings and the current application environment in one place. This object can then be used throughout your python application,
as a central spot for checking which environment the application is running under and for gettings settings accordingly.
Usage Example
from application_builder.application import Application
# our settings class must support 2 functions `load()` and `settings()`.
class MySettingsManager:
def __init__(self, env, app_root):
self._env = env
self._root = app_root
def load(self):
# json/yaml/python files could be loaded here
self._data = {
'test' : { 'db' : 'localhost' },
'dev' : { 'db' : 'some.server.com' }
}
def settings(self):
return self._data
def settings_init_fn(env: str, app_root: str):
sm = MySettingsManager(env, app_root)
return sm
# Let's assume MYAPP_ENV='dev'
myapp = Application(
name = 'myapp',
app_env_varname: 'MYAPP_ENV',
app_root_dir: '/path/to/myapp',
# sometimes you might need to do a lot more
# than just instantiate a class, that's why you need to pass a function
settings_class_init_fn: settings_init_fn
)
myapp.add_path('settings', 'config/settings')
myapp.add_path('data', 'data')
myapp.boot()
myapp.current_environment() # 'dev'
myapp.settings() # { 'db' : 'some.server.com' }
myapp.paths('root') # /path/to/myapp
myapp.paths('settings') # /path/to/myapp/config/settings
myapp.paths('data') # /path/to/myapp/data
Metadata
Release files for application-builder 0.1.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 | |
|---|---|---|---|---|
| application_builder-0.1.2.tar.gz | 3.1 kB | Without provenance | Details |
Release files / application_builder-0.1.2.tar.gz
| Download URL | application_builder-0.1.2.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d11a06ac0a2ed38be3f3eb2660869e391c1a8d9c451ed68f4030ade0153889f3
|
|
BLAKE2b-256 checksum How to use checksums |
9989efcc5c7d179b83fd30e92cec63f4b6c0d20690e41e0d6251282f2be8bdee
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1
|
Security for application-builder 0.1.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.