direg Overview
direg lets you maintain arbitrary registry data (in the form of python dictionaries that can be “merged” in a logical way (think: global config -vs- user config). With a small amount of work, it is possible to replace hardcoded values with easily-maintainable and flexible registry entries.
Suppose we have a file at /my/path/registry.py with the following contents.
data = {
'one.Foo.meth.somevar': 26804,
'one.Foo.somevar': 24742,
'one.myfunc.somevar': 16834,
'one.outer.inner.somevar': 7678,
}
Then, in some module one, we can do the following:
one.py
from direg import get_value, registries
# Load the registry with the above data. Note that this could take place in another module and could include an
# arbitrary number of registry files.
registries.append('/my/path/registry.py')
class Foo:
somevar = get_value('somevar') # will be 24742
def meth(self):
return get_value('somevar')
f = Foo()
f.meth() # will return 26804
f.somevar # 24742
Foo.somevar # also 24742
def myfunc():
somevar = get_value('somevar')
return somevar
myfunc() # will be 16834
Metadata
Release files for direg 0.2.6
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 |
|---|---|---|---|---|
| direg-0.2.6.zip | 7.6 kB | Without provenance | Details for direg-0.2.6.zip |
Release files / direg-0.2.6.zip
| Download URL | direg-0.2.6.zip |
|---|---|
| Size | 7.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0271ecc30b9eef6bb340b6433749c85865bca289c2f56701926aaece226a81ce
|
|
BLAKE2b-256 checksum How to use checksums |
82f3d987e74faa4742e341a8f495abd5d257557ef0b93f2daf9125e809840cd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for direg 0.2.6
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.