The boacontructor is a templating library for data.
It allows you to construct Python dictionaries from other templates, dictionaries or instances.
- Source code is available on github:
- Documentation is available here:
An Example
I’ll let the code and comments do the talking:
from boaconstructor import Template
# Some shared information in a dict. This could also be a class instance
# or something else that supports getattr and hasattr.
#
common = dict(
timeout = 30,
email = "admin@example.com"
)
# This is a template created in a module. You need one of these. I pass in
# references that are available at this stage. The 'host.$.name' I will pass
# in at render time.
#
webserver_data = Template('webserver',
dict(
interface = 'host.$.name',
port = 32189,
timeout = 'common.$.timeout',
alert_email = 'common.$.email',
),
# This is uses common as an 'internal' reference
references={'common':common}
)
# At run time I can pass 'external' references to resolve the hostnames.
# Maybe I got these from a database or some other source.
#
machine_1 = webserver_data.render({'host': {'name': 'myserver1'}}),
# {'alert_email': 'admin@example.com', 'interface': 'myserver1', 'port': 32189, 'timeout': 30}
machine_2 = webserver_data.render({'host': {'name': 'myserver2'}}),
# {'alert_email': 'admin@example.com', 'interface': 'myserver2', 'port': 32189, 'timeout': 30}
# Now I can pass these to Cheetah/Mako/etc to render a specific type of
# XML/INI/Text configuration files.
Metadata
Release files for boaconstructor 0.3.0
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 |
|---|---|---|---|---|
| boaconstructor-0.3.0.tar.gz | 13.1 kB | Without provenance | Details for boaconstructor-0.3.0.tar.gz |
Release files / boaconstructor-0.3.0.tar.gz
| Download URL | boaconstructor-0.3.0.tar.gz |
|---|---|
| Size | 13.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8aea33b8eccd4d074f63cd416a040182932b7599404f0b45545e15b24976d613
|
|
BLAKE2b-256 checksum How to use checksums |
8f0ef6e0b30f8c0d8d6d52d661a5b820bbbf26b36cdd8624e5705605ad62106a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for boaconstructor 0.3.0
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.