projectutils
A small collections of modular components useful in other projects.
projectutils.init
The init module is helpful when you need to create a complex directory structure.
You can create objects that represent Directories and Files to create a tree.
projectutils.config
The config module allows you to define a configuration schema and dinamically load configurations
from multiple sources.
schema.json:
{
"string": {"doc": "String config", "format": "string", "default": "DEFAULT"},
"integer": {"doc": "Integer config", "format": "int", "default": 1},
"float": {"doc": "Float config", "format": "float", "default": 1.1},
"list": {"doc": "List config", "format": "list", "default": ["a", "b", "c"]},
"bool": {"doc": "Bool config", "format": "bool", "default": true},
"nested.string": {"doc": "String config", "format": "string", "default": "DEFAULT"},
}
/etc/myapp/config.json:
{
"float": 2.2,
"string": "loaded from json",
"nested": {
"string": "loaded from json"
}
}
/etc/myapp/.env:
MYAPP_CONF_LIST="e,n,v"
MYAPP_CONF_BOOL="False"
MYAPP_CONF_NESTED_STRING="loaded from env"
app.py:
import json
from pathlib import Path
from projectutils.config import Config, ENVSource, JSONSource
# Setup includes loading the schema
# and defining some params used in sources.
with open("schema.json", "r") as fp:
schema = json.load(fp)
envs_prefix = "MYAPP_CONF_"
configs_root = Path("/etc/myapp")
# Source definition dictates precedence.
# In this case ENV values will override JSON values.
sources = [
JSONSource(configs_root / "config.json"),
ENVSource(envs_prefix, configs_root),
]
# Load config
config = Config(schema, sources)
config.get("integer")
# 1
config.get("float")
# 2.2
config.get("bool")
# False
config.get("list")
# ['e', 'n', 'v']
config.get("nested.string")
# 'loaded from env'
config.get("string")
# 'loaded from json'
Metadata
Release files for projectutils 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 |
|---|---|---|---|---|
| projectutils-1.tar.gz | 18.1 kB | Without provenance | Details for projectutils-1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| projectutils-1-py3-none-any.whl | Python 3 | none | any | Details for projectutils-1-py3-none-any.whl |
Total release size: 36.7 kB
Release files / projectutils-1.tar.gz
| Download URL | projectutils-1.tar.gz |
|---|---|
| Size | 18.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
625d7e56104b5f65ae41f21e97ee139081158a4b09bb0cd06dc949d27ba28a70
|
|
BLAKE2b-256 checksum How to use checksums |
0e004da4748c58bc675b4cd92bcadbb625ba54bca37e8a3fdb6f49c45114d0bf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Release files / projectutils-1-py3-none-any.whl
| Download URL | projectutils-1-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4f96d7a0910977c12ea469b1bd4f349ba7caa301568051960b376ef34896ac6c
|
|
BLAKE2b-256 checksum How to use checksums |
d4bc8a94e0e5ddf1305af48d54389db06fac25298aa7d0362a4cb992bad3c33d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.1
|
Security for projectutils 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.