# Puan Client DB
A small tool for calling a running `puan-server-db` http service.
## Install
```bash
pip install puan-client-db
```
## Quickstart
```python
import puan.logic.plog as pg
from puan_client_db import PropositionClient
# create a client
client = PropositionClient("http://localhost:8000") # we run a service on our local machine on port 8000
# create a puan model (pip install puan)
model = pg.All(
pg.Xor(*"xyz"),
pg.Imply(
pg.Any(*"AB"),
pg.All(*"ijk")
)
)
# store the model by commiting it into the service
# This will commit to a new model with default branch name (usually "main" but depends on backend config)
# (second parameter returned is an error)
sha_first, _ = client.commit(model)
# ... and we later made some changes
model = model.assume({"i": 1}) # this fixes `i` to always be set to 1/True
# then made another commit
client.commit(model)
# some time later we want to checkout the first commit
# (second parameter returned is an error)
model_first, _ = client.checkout(sha_first)
```
Raw data
{
"_id": null,
"home_page": "",
"name": "puan-client-db",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "",
"keywords": "combinatorial optimization,database,service,propositional logic,optimization",
"author": "",
"author_email": "Our Studio Void AB <moa@ourstudio.se>",
"download_url": "https://files.pythonhosted.org/packages/ae/a2/f830ec279f68f1184cb28ef38787334509813e4f687e9926ed5ec86acfb6/puan-client-db-0.0.4.tar.gz",
"platform": null,
"description": "# Puan Client DB\nA small tool for calling a running `puan-server-db` http service.\n\n## Install\n```bash\npip install puan-client-db\n```\n\n## Quickstart\n```python\nimport puan.logic.plog as pg\nfrom puan_client_db import PropositionClient\n\n# create a client\nclient = PropositionClient(\"http://localhost:8000\") # we run a service on our local machine on port 8000\n\n# create a puan model (pip install puan)\nmodel = pg.All(\n pg.Xor(*\"xyz\"),\n pg.Imply(\n pg.Any(*\"AB\"),\n pg.All(*\"ijk\")\n )\n)\n\n# store the model by commiting it into the service\n# This will commit to a new model with default branch name (usually \"main\" but depends on backend config) \n# (second parameter returned is an error)\nsha_first, _ = client.commit(model)\n\n# ... and we later made some changes\nmodel = model.assume({\"i\": 1}) # this fixes `i` to always be set to 1/True \n\n# then made another commit\nclient.commit(model)\n\n# some time later we want to checkout the first commit\n# (second parameter returned is an error)\nmodel_first, _ = client.checkout(sha_first)\n\n```\n",
"bugtrack_url": null,
"license": "",
"summary": "SDK for calling running http service of puan-server-db",
"version": "0.0.4",
"split_keywords": [
"combinatorial optimization",
"database",
"service",
"propositional logic",
"optimization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "918fc34d2b2a721d226272620090746fab0490ca60b0f66e25d1fbd2ae9c47b4",
"md5": "c786332e27f47020b04aa14cead88f6e",
"sha256": "88191431add3eae3edb7742530fad31e05573ff843832f1f5ee5b399e687e0c4"
},
"downloads": -1,
"filename": "puan_client_db-0.0.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c786332e27f47020b04aa14cead88f6e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 7341,
"upload_time": "2023-01-30T14:50:02",
"upload_time_iso_8601": "2023-01-30T14:50:02.165118Z",
"url": "https://files.pythonhosted.org/packages/91/8f/c34d2b2a721d226272620090746fab0490ca60b0f66e25d1fbd2ae9c47b4/puan_client_db-0.0.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "aea2f830ec279f68f1184cb28ef38787334509813e4f687e9926ed5ec86acfb6",
"md5": "5a3726b2d8854f1071c36e02c7210fc6",
"sha256": "cac23572112b8a5097859e428c09c4b131e15fbc60732845b00f1b028b567aab"
},
"downloads": -1,
"filename": "puan-client-db-0.0.4.tar.gz",
"has_sig": false,
"md5_digest": "5a3726b2d8854f1071c36e02c7210fc6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 6975,
"upload_time": "2023-01-30T14:50:03",
"upload_time_iso_8601": "2023-01-30T14:50:03.311991Z",
"url": "https://files.pythonhosted.org/packages/ae/a2/f830ec279f68f1184cb28ef38787334509813e4f687e9926ed5ec86acfb6/puan-client-db-0.0.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-30 14:50:03",
"github": false,
"gitlab": false,
"bitbucket": false,
"lcname": "puan-client-db"
}