bjorn
The Bjorn module loads a configuration file for your python script.
Installation
To install bjorn, run this command in your terminal:
$ pip install bjorn
The basics
A settings file is just a Python module with module-level variables. Settings example:
import os
LOGGING_CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {"format": "%(asctime)s [%(levelname)s] %(name)s: %(message)s"},
},
"handlers": {
"default": {
"level": "INFO",
"formatter": "standard",
"class": "logging.StreamHandler",
},
"file_handler": {
"level": "INFO",
"filename": "/tmp/mylogfile.log",
"class": "logging.FileHandler",
"formatter": "standard",
},
},
"loggers": {
"job": {
"handlers": ["default"],
"level": os.environ.get("LOGGER_LEVEL", "INFO"),
"propagate": True,
},
},
}
VALUE_TO_TEST = "A"
Because a settings file is a Python module, the following apply:
It doesn’t allow for Python syntax errors.
It can assign settings dynamically using normal Python syntax. For example:
MY_SETTING = [str(i) for i in range(30)]
Designating the settings
JOB_SETTINGS When you use Bjorn, you have to tell it which settings you’re using. Do this by using an environment variable, JOB_SETTINGS.
The value of JOB_SETTINGS should be in Python path syntax, e.g. mysite.settings. Note that the settings module should be on the Python import search path.
Usage
Create a settings.py file in the root of the project. Then you can call it from your script using the following way.
from bjorn.config import settings
if __name__ == '__main__':
print(settings.VALUE_TO_TEST)
History
0.1.0 (2021-01-23)
First release on PyPI.
Metadata
Release files for bjorn 0.1.5
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 |
|---|---|---|---|---|
| bjorn-0.1.5.tar.gz | 9.5 kB | Without provenance | Details for bjorn-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bjorn-0.1.5-py2.py3-none-any.whl | Python 3, Python 2 | none | any | Details for bjorn-0.1.5-py2.py3-none-any.whl |
Total release size: 13.7 kB
Release files / bjorn-0.1.5.tar.gz
| Download URL | bjorn-0.1.5.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
41d495df8e316223a92c22dbc65cea05ec760fad6c56783656ce7978cab4da5f
|
|
BLAKE2b-256 checksum How to use checksums |
54a1120a0b3e5c4af080226885dd27800198845fc330b32470a3c42bfae261cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Release files / bjorn-0.1.5-py2.py3-none-any.whl
| Download URL | bjorn-0.1.5-py2.py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
1222ff5330eba71b4c078b284d8f9bd58cae066b46809d2dc09a316fd26bdcc8
|
|
BLAKE2b-256 checksum How to use checksums |
32ea4bef8f66c3c9d87726ec1c43e3c308641dae5e45379ab7a8a9dae7e50fb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.8
|
Security for bjorn 0.1.5
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.