couchbed


Namecouchbed JSON
Version 0.2.0 PyPI version JSON
download
home_page
SummaryLogging into CouchDB.
upload_time2023-07-02 08:20:07
maintainer
docs_urlNone
authorchocolate-icecream
requires_python>=3.6
license
keywords couchdb
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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:

```shell
pip install couchbed
```

## Usage

First, import the `CouchBed` class from the `couchbed` module:

```python
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).

```python
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.

```python
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.

```python
print(book["a"])
```

### Recording Messages

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

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

### Recording Logs

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

```python
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.

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

## License

CouchBed is licensed under the MIT License.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "couchbed",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "CouchDB",
    "author": "chocolate-icecream",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/c6/56/d0dbee8f2f00d2ba507514914470554e4ab2d1222acd28e518822f952463/couchbed-0.2.0.tar.gz",
    "platform": null,
    "description": "# CouchBed\n\nCouchBed 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.\n\n## Installation\n\nYou can install CouchBed using pip:\n\n```shell\npip install couchbed\n```\n\n## Usage\n\nFirst, import the `CouchBed` class from the `couchbed` module:\n\n```python\nfrom couchbed import CouchBed\n```\n\nCreate 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).\n\n```python\ncouch = CouchBed(\"__DATABASE_NAME__\")\nbook = couch.new_book()\n```\n\n### Recording Settings\n\nYou can record settings by using the `set` method or by directly assigning values to keys in the `CBBook` instance.\n\n```python\nbook.set({\"a\": 1, \"b\": 2})\n# or\nbook[\"key\"] = \"value\"\n```\n\n### Accessing Settings\n\nYou can access the recorded settings by using the `CBBook` instance as a dictionary.\n\n```python\nprint(book[\"a\"])\n```\n\n### Recording Messages\n\nYou can record messages by calling the `CBBook` instance as a function and passing the desired message as arguments.\n\n```python\nbook(\"Hello\", 1, 2, 3)\n```\n\n### Recording Logs\n\nYou can record logs by using the `log` method and passing a dictionary containing the log information.\n\n```python\nbook.log({\"epoch\": 1, \"train_loss\": 0.1, \"val_loss\": 0.15})\n```\n\n### Saving Data\n\nCouchBed 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.\n\n```python\nbook.save()\n# or\ncouch.save()\n```\n\n## License\n\nCouchBed is licensed under the MIT License.\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Logging into CouchDB.",
    "version": "0.2.0",
    "project_urls": null,
    "split_keywords": [
        "couchdb"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c656d0dbee8f2f00d2ba507514914470554e4ab2d1222acd28e518822f952463",
                "md5": "6f55f3d371d89893f61b61560010ccf9",
                "sha256": "e208a3f9dc6766c92dd10023e1820aeb4cfe7e3d2d98455bb789174be71b046a"
            },
            "downloads": -1,
            "filename": "couchbed-0.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "6f55f3d371d89893f61b61560010ccf9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 4347,
            "upload_time": "2023-07-02T08:20:07",
            "upload_time_iso_8601": "2023-07-02T08:20:07.375975Z",
            "url": "https://files.pythonhosted.org/packages/c6/56/d0dbee8f2f00d2ba507514914470554e4ab2d1222acd28e518822f952463/couchbed-0.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-02 08:20:07",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "couchbed"
}
        
Elapsed time: 0.08503s