# sparrow_tool
[![image](https://img.shields.io/badge/Pypi-0.8.5-green.svg)](https://pypi.org/project/sparrow_tool)
[![image](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/)
[![image](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![image](https://img.shields.io/badge/author-kunyuan-orange.svg?style=flat-square&logo=appveyor)](https://github.com/beidongjiedeguang)
-------------------------
## Install
```bash
pip install sparrow-tool
# Or dev version
pip install sparrow-tool[dev]
# Or
pip install -e .
# Or
pip install -e .[dev]
```
## Usage
### Safe logger in `multiprocessing`
```python
from sparrow.log import Logger
import numpy as np
logger = Logger(name='train-log', log_dir='./logs', )
logger.info("hello","numpy:",np.arange(10))
logger2 = Logger.get_logger('train-log')
print(id(logger2) == id(logger))
>>> True
```
### Multiprocessing SyncManager
Open server first:
```bash
$ spr start-server
```
The defualt port `50001`.
(Process1) productor:
```python
from sparrow.multiprocess.client import Client
client = Client(port=50001)
client.update_dict({'a': 1, 'b': 2})
```
(Process2) consumer:
```python
from sparrow.multiprocess.client import Client
client = Client(port=50001)
print(client.get_dict_data())
>>> {'a': 1, 'b': 2}
```
### Common tools
- **Kill process by port**
```bash
$ spr kill {port}
```
- **pack & unpack**
support archive format: "zip", "tar", "gztar", "bztar", or "xztar".
```bash
$ spr pack pack_dir
```
```bash
$ spr unpack filename extract_dir
```
## Vector Database && Search
**Milvus**
- start
```bash
$ spr milvus start
```
- stop
```bash
$ spr milvus stop
```
- remove database
```bash
$ spr milvus rm
```
Raw data
{
"_id": null,
"home_page": "https://github.com/beidongjiedeguang/sparrow",
"name": "sparrow-tool",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "Machine Learning,nlp,cv,cli",
"author": "kunyuan",
"author_email": "beidongjiedeguang@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/54/64/49db4f345d87fc38de62cccb37911a46c0565161886c289fde7ca1e70c1a/sparrow_tool-0.8.5.tar.gz",
"platform": null,
"description": "# sparrow_tool\n[![image](https://img.shields.io/badge/Pypi-0.8.5-green.svg)](https://pypi.org/project/sparrow_tool)\n[![image](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/)\n[![image](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n[![image](https://img.shields.io/badge/author-kunyuan-orange.svg?style=flat-square&logo=appveyor)](https://github.com/beidongjiedeguang)\n\n\n-------------------------\n## Install\n```bash\npip install sparrow-tool\n# Or dev version\npip install sparrow-tool[dev]\n# Or\npip install -e .\n# Or\npip install -e .[dev]\n```\n\n\n## Usage\n\n### Safe logger in `multiprocessing`\n```python\nfrom sparrow.log import Logger\nimport numpy as np\nlogger = Logger(name='train-log', log_dir='./logs', )\nlogger.info(\"hello\",\"numpy:\",np.arange(10))\n\nlogger2 = Logger.get_logger('train-log')\nprint(id(logger2) == id(logger))\n>>> True\n```\n\n### Multiprocessing SyncManager\n\nOpen server first:\n```bash\n$ spr start-server\n```\nThe defualt port `50001`.\n\n(Process1) productor:\n```python\nfrom sparrow.multiprocess.client import Client\nclient = Client(port=50001)\nclient.update_dict({'a': 1, 'b': 2})\n```\n\n(Process2) consumer:\n```python\nfrom sparrow.multiprocess.client import Client\nclient = Client(port=50001)\nprint(client.get_dict_data())\n\n>>> {'a': 1, 'b': 2}\n```\n\n### Common tools\n- **Kill process by port**\n ```bash\n $ spr kill {port}\n ```\n\n- **pack & unpack** \n support archive format: \"zip\", \"tar\", \"gztar\", \"bztar\", or \"xztar\".\n ```bash\n $ spr pack pack_dir\n ```\n ```bash\n $ spr unpack filename extract_dir\n ```\n\n\n## Vector Database && Search\n**Milvus** \n - start\n ```bash\n $ spr milvus start\n ```\n - stop\n ```bash\n $ spr milvus stop\n ```\n - remove database\n ```bash\n $ spr milvus rm\n ```\n\n\n\n",
"bugtrack_url": null,
"license": "",
"summary": "",
"version": "0.8.5",
"split_keywords": [
"machine learning",
"nlp",
"cv",
"cli"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "255a7be6d1d681a7c09e0a9267983218c221c3ebed2e0c5df65bd717eb5edc48",
"md5": "554c04850d3ee0aa3473dca218628caf",
"sha256": "98a81662a536418829f820dbf2668501e55401132c50a5c2298aec1d35ba4327"
},
"downloads": -1,
"filename": "sparrow_tool-0.8.5-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "554c04850d3ee0aa3473dca218628caf",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": null,
"size": 4797470,
"upload_time": "2023-01-27T17:38:16",
"upload_time_iso_8601": "2023-01-27T17:38:16.927088Z",
"url": "https://files.pythonhosted.org/packages/25/5a/7be6d1d681a7c09e0a9267983218c221c3ebed2e0c5df65bd717eb5edc48/sparrow_tool-0.8.5-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "546449db4f345d87fc38de62cccb37911a46c0565161886c289fde7ca1e70c1a",
"md5": "8aef6560503511fa5e36853e360dddc7",
"sha256": "06a37cea08d17155ffe52a3c4ae32f7518c188c9e1448cdf136f0db2fe2cf5de"
},
"downloads": -1,
"filename": "sparrow_tool-0.8.5.tar.gz",
"has_sig": false,
"md5_digest": "8aef6560503511fa5e36853e360dddc7",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 4725202,
"upload_time": "2023-01-27T17:38:19",
"upload_time_iso_8601": "2023-01-27T17:38:19.396534Z",
"url": "https://files.pythonhosted.org/packages/54/64/49db4f345d87fc38de62cccb37911a46c0565161886c289fde7ca1e70c1a/sparrow_tool-0.8.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-01-27 17:38:19",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "beidongjiedeguang",
"github_project": "sparrow",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "sparrow-tool"
}