microenv
A minimal Python environment abstraction with privacy controls and async “next” subscriptions.
Installation
pip install microenv
or
python -m pip install microenv
or
python3 -m pip install microenv
Quickstart
import asyncio
from microenv import microenv
# Define initial data and optional descriptor
data = {"public": 1, "secret": "s3cr3t"}
descriptor = {
"children": [
{"key": "public", "type": "number"},
{"key": "secret", "type": "string", "private": True},
]
}
# Create the environment
env = microenv(obj=data, descriptor=descriptor)
face = env.face
# Basic get / set via the face
print(face.public) # → 1
face.public = 42
print(env.data["public"]) # → 42
# Privacy: direct .secret bypasses privacy checks on the face
print(face.secret) # → "s3cr3t"
face.secret = "new!"
print(env.data["secret"]) # → "new!"
# Async “next” subscription: await the next update to a key
async def wait_for_update():
fut = env.get("public", next_=True)
print("waiting for next public…")
val = await fut
print("new public value:", val)
# Schedule waiter and then update
loop = asyncio.get_event_loop()
loop.create_task(wait_for_update())
loop.call_soon(lambda: setattr(face, "public", 99))
loop.run_forever()
API
microenv(obj: dict, descriptor: dict = None) → MicroEnvenv.face: proxy for getting/setting properties.env.get(key, caller=None, next_=False): synchronous read or, ifnext_=True, a Future resolving on nextset.env.set(key, value, caller=None): update a property, resolving any pending “next” futures.
License
This project is licensed under the MIT License.
See LICENSE for details.
Metadata
Release files for microenv 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 |
|---|---|---|---|---|
| microenv-0.1.5.tar.gz | 6.6 kB | Without provenance | Details for microenv-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| microenv-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for microenv-0.1.5-py3-none-any.whl |
Total release size: 10.8 kB
Release files / microenv-0.1.5.tar.gz
| Download URL | microenv-0.1.5.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5f4e3aab2831666878735a0a9bd651702d8ac6b6fcedf4db666145f7e1d0009
|
|
BLAKE2b-256 checksum How to use checksums |
0521c10c38ed67e16b33826f22b40572d770964c6fdd5c0d5f8b6c6472431803
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / microenv-0.1.5-py3-none-any.whl
| Download URL | microenv-0.1.5-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
20e0647561660a1f5414b64bd93911eba43080c9de99a9e0780e6deb69a518e5
|
|
BLAKE2b-256 checksum How to use checksums |
b30c552e85f4fa5c39e98ada96f2874ae5090ba4e3668e7fa3751721c4ece495
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for microenv 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.