mita-client


Namemita-client JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/ControlNet/mita
SummaryMita client for Python.
upload_time2024-03-03 09:52:35
maintainer
docs_urlNone
authorControlNet
requires_python>=3.6
license
keywords monitoring logging
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Mita

Mita, named as Multi-Tangled, is a web application for monitoring runtime status and data of multiple machines 
(clients).

Demo: [https://mita-demo.controlnet.space](https://mita-demo.controlnet.space)

<img src=".github/demo.png" style="max-height: 480px">

## Get Started

### Run Server

The server is used to accept client post data and host the web UI.

#### Docker
```bash
docker run \
  -p <PORT>:9000 \
  -e MITA_PASSWORD=<PASSWORD> \
  [-e MITA_GUEST_PASSWORD=<GUEST_PASSWORD>] \
  controlnet/mita[:<VERSION>]
```

#### Environment Variables

- `MITA_PASSWORD`: Password for **admin** accessing the api and web for read/write.
- `MITA_GUEST_PASSWORD`: Password for **guest** accessing the api and web for read only.
- `REACT_APP_PASSWORD`: _Optional_, set the default password for the frontend.
- `MITA_SECRET_KEY`: _Optional_, Server secret key for CRSF token.
- `MITA_TOKEN_SECRET`: _Optional_, Server secret key for JWT authentication token.

### Run Client

The client is the interface to post data to the server.

Now the python client is available. The other clients (nodejs, java, cli, ...) are in plan.

#### Python Client

Install the client from pypi:
```bash
pip install mita_client
```

Use the tqdm integrated client (require `tqdm` for progress bar):
```python
from mita_client import mita_tqdm
import time

for i in mita_tqdm(range(1000), ADDRESS, PASSWORD):
    time.sleep(0.1)
```

Use the fully client:
```python
from mita_client.client import Mita
from mita_client.component import *
from mita_client.view import View

# initialize components
view = View("python_view")
logger = Logger("python_logger")
line_chart = LineChart("python_line_chart")
progress_bar = ProgressBar("python_progress_bar", total=100)
var = Variable("python_var", 100)

# register components to view
view.add(
    var,
    progress_bar,
    logger,
    line_chart
)

# update data in the runtime, and post to the client
with Mita(ADDRESS, PASSWORD) as client:
    client.add(view)

    for i in range(10):
        logger.log(f"some msg {i}")
        line_chart.add(1 + i, 1 + i, "pos")
        line_chart.add(1 + i, 3.5 - i, "neg")
        progress_bar.set(i * 8 + 1)
        
        client.push()
```

## License

| Module | License                        |
|--------|--------------------------------|
| server | [AGPL](./LICENSE)              |
| client | [MIT](./client/python/LICENSE) |

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ControlNet/mita",
    "name": "mita-client",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "monitoring,logging",
    "author": "ControlNet",
    "author_email": "smczx@hotmail.com",
    "download_url": "https://files.pythonhosted.org/packages/dc/40/69b97f00227fee2aeab1dd6e3755cea35c69d7547571d00f97bdd413eeed/mita_client-0.0.5.tar.gz",
    "platform": null,
    "description": "# Mita\n\nMita, named as Multi-Tangled, is a web application for monitoring runtime status and data of multiple machines \n(clients).\n\nDemo: [https://mita-demo.controlnet.space](https://mita-demo.controlnet.space)\n\n<img src=\".github/demo.png\" style=\"max-height: 480px\">\n\n## Get Started\n\n### Run Server\n\nThe server is used to accept client post data and host the web UI.\n\n#### Docker\n```bash\ndocker run \\\n  -p <PORT>:9000 \\\n  -e MITA_PASSWORD=<PASSWORD> \\\n  [-e MITA_GUEST_PASSWORD=<GUEST_PASSWORD>] \\\n  controlnet/mita[:<VERSION>]\n```\n\n#### Environment Variables\n\n- `MITA_PASSWORD`: Password for **admin** accessing the api and web for read/write.\n- `MITA_GUEST_PASSWORD`: Password for **guest** accessing the api and web for read only.\n- `REACT_APP_PASSWORD`: _Optional_, set the default password for the frontend.\n- `MITA_SECRET_KEY`: _Optional_, Server secret key for CRSF token.\n- `MITA_TOKEN_SECRET`: _Optional_, Server secret key for JWT authentication token.\n\n### Run Client\n\nThe client is the interface to post data to the server.\n\nNow the python client is available. The other clients (nodejs, java, cli, ...) are in plan.\n\n#### Python Client\n\nInstall the client from pypi:\n```bash\npip install mita_client\n```\n\nUse the tqdm integrated client (require `tqdm` for progress bar):\n```python\nfrom mita_client import mita_tqdm\nimport time\n\nfor i in mita_tqdm(range(1000), ADDRESS, PASSWORD):\n    time.sleep(0.1)\n```\n\nUse the fully client:\n```python\nfrom mita_client.client import Mita\nfrom mita_client.component import *\nfrom mita_client.view import View\n\n# initialize components\nview = View(\"python_view\")\nlogger = Logger(\"python_logger\")\nline_chart = LineChart(\"python_line_chart\")\nprogress_bar = ProgressBar(\"python_progress_bar\", total=100)\nvar = Variable(\"python_var\", 100)\n\n# register components to view\nview.add(\n    var,\n    progress_bar,\n    logger,\n    line_chart\n)\n\n# update data in the runtime, and post to the client\nwith Mita(ADDRESS, PASSWORD) as client:\n    client.add(view)\n\n    for i in range(10):\n        logger.log(f\"some msg {i}\")\n        line_chart.add(1 + i, 1 + i, \"pos\")\n        line_chart.add(1 + i, 3.5 - i, \"neg\")\n        progress_bar.set(i * 8 + 1)\n        \n        client.push()\n```\n\n## License\n\n| Module | License                        |\n|--------|--------------------------------|\n| server | [AGPL](./LICENSE)              |\n| client | [MIT](./client/python/LICENSE) |\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Mita client for Python.",
    "version": "0.0.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/ControlNet/mita/issues",
        "Homepage": "https://github.com/ControlNet/mita",
        "Source Code": "https://github.com/ControlNet/mita"
    },
    "split_keywords": [
        "monitoring",
        "logging"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b331befd5c9234854eb8c35c7956f42bac02ee58044d620fe21b3a94ef7a12ea",
                "md5": "d9a0f790f773a66d5386ec59ec4afcc3",
                "sha256": "98f262554a44728e0f67b20b15bce058407a573028e0bd004c1942ce7f4e7f36"
            },
            "downloads": -1,
            "filename": "mita_client-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d9a0f790f773a66d5386ec59ec4afcc3",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8252,
            "upload_time": "2024-03-03T09:52:33",
            "upload_time_iso_8601": "2024-03-03T09:52:33.673647Z",
            "url": "https://files.pythonhosted.org/packages/b3/31/befd5c9234854eb8c35c7956f42bac02ee58044d620fe21b3a94ef7a12ea/mita_client-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "dc4069b97f00227fee2aeab1dd6e3755cea35c69d7547571d00f97bdd413eeed",
                "md5": "8c7ff50c36e46adb4e378b91af741df3",
                "sha256": "1e1c1d812602e9d1c1f6be15e767c164085da2ca36fbb937fea84d46bf26fbc4"
            },
            "downloads": -1,
            "filename": "mita_client-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "8c7ff50c36e46adb4e378b91af741df3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 8536,
            "upload_time": "2024-03-03T09:52:35",
            "upload_time_iso_8601": "2024-03-03T09:52:35.569418Z",
            "url": "https://files.pythonhosted.org/packages/dc/40/69b97f00227fee2aeab1dd6e3755cea35c69d7547571d00f97bdd413eeed/mita_client-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-03 09:52:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ControlNet",
    "github_project": "mita",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mita-client"
}
        
Elapsed time: 0.24686s