Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

couchbed

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

couchbed

Logging into CouchDB.

  • 0.2.0
  • PyPI
  • Socket score

Maintainers
1

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc