Skip to main content

CouchBed

CouchBed is a Python library that allows you to log your code execution into CouchDB. It provides a simple and convenient way to record settings, messages, and logs into a CouchDB database.

Installation

You can install CouchBed using pip:

pip install couchbed

Usage

First, import the CouchBed class from the couchbed module:

from couchbed import CouchBed

Create an instance of the CouchBed class, specifying the name of the CouchDB database as a parameter. By default, CouchBed uses the CouchDB URI provided by the PYTHON_COUCHBED environment variable. Alternatively, you can pass the URI as a parameter when creating the CouchBed instance. For each trial, you prepare a new book (CBBook).

couch = CouchBed("__DATABASE_NAME__")
book = couch.new_book()

Recording Settings

You can record settings by using the set method or by directly assigning values to keys in the CBBook instance.

book.set({"a": 1, "b": 2})
# or
book["key"] = "value"

Accessing Settings

You can access the recorded settings by using the CBBook instance as a dictionary.

print(book["a"])

Recording Messages

You can record messages by calling the CBBook instance as a function and passing the desired message as arguments.

book("Hello", 1, 2, 3)

Recording Logs

You can record logs by using the log method and passing a dictionary containing the log information.

book.log({"epoch": 1, "train_loss": 0.1, "val_loss": 0.15})

Saving Data

CouchBed automatically saves the data every 5 seconds if there are any changes. However, it's recommended to explicitly call the save method at the end of your program to ensure all the data is saved. Otherwise, the last 5-second data may be lost.

book.save()
# or
couch.save()

License

CouchBed is licensed under the MIT License.

Metadata

Release files for couchbed 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for couchbed 0.2.0
File Size Uploaded Provenance Actions
couchbed-0.2.0.tar.gz 4.3 kB Without provenance Details for couchbed-0.2.0.tar.gz

Release files / couchbed-0.2.0.tar.gz

Download URL couchbed-0.2.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e208a3f9dc6766c92dd10023e1820aeb4cfe7e3d2d98455bb789174be71b046a
BLAKE2b-256 checksum
How to use checksums
c656d0dbee8f2f00d2ba507514914470554e4ab2d1222acd28e518822f952463
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.16

Security for couchbed 0.2.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page