PyRAII
Declerative resource management library for python
Examples
Closing Resources only on exception:
from pyraii.context import closing_on_exception
def wait_for_authenticated_client_connection():
my_socket = wait_for_client_connection(*args)
with closing_on_exception(my_socket):
username = authenticate_connection(my_socket)
return my_socket, username
Nothrow closing:
from pyraii.context import closing_nothrow
# If the file fails to close no exception will be thrown
with closing_nothrow(my_file):
my_file.write(data)
Resource owning classes:
from pyraii.resource_owner import ResourceOwner
class Server(ResourceOwner):
def __init__():
self.socket_a = get_socket()
self.socket_b = get_other_socket()
self._log_file = open_log_file()
self._data = "asdasd"
my_server = Server()
my_server.close() # will close all sockets and files which are members of the server
This package was created with Cookiecutter and the audreyr/cookiecutter-pypackage project template.
Free software: MIT license
History
1.0.0 (2019-10-18)
First release on PyPI.
1.0.1 (2019-10-18)
Add coverage
Fix documentation
Metadata
Release files for pyraii 1.0.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 |
|---|---|---|---|---|
| pyraii-1.0.1.tar.gz | 11.8 kB | Without provenance | Details for pyraii-1.0.1.tar.gz |
Release files / pyraii-1.0.1.tar.gz
| Download URL | pyraii-1.0.1.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6552dac366b7d8a16986e5e32567450ec8daa35c8334348a6293ec75883850f3
|
|
BLAKE2b-256 checksum How to use checksums |
f1dc40a0571264477cb283d4217318ef3231e885f2dbcfe7f2347c6ac678ab85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.6.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/2.7.12
|
Security for pyraii 1.0.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.