pysolbase
============
Welcome to pysol
Copyright (C) 2013/2025 Laurent Labatut / Laurent Champagnac
pysolbase is a set of python helpers to ease development.
It is gevent (co-routines) based.
Usage
===============
Engage gevent monkey patching and setup default logger configuration:
`SolBase.voodoo_init()`
Initialize logging system (without engaging gevent) with default configuration (ie console logs - there is support for syslog and file logs).
`SolBase.logging_init("INFO")`
Re-initialize logging system (without engaging gevent):
`SolBase.logging_init("DEBUG", True)`
Millis helpers:
```
ms = SolBase.mscurrent()
do_something()
ms_elapsed = SolBase.msdiff(ms)
```
Date helpers
```
dt = SolBase.datecurrent()
do_something()
ms_elapsed = SolBase.datediff(dt)
```
Binary helpers
```
bin_buf = SolBase.unicode_to_binary('This is my text buffer', encoding='utf-8')
unicode_string = SolBase.binary_to_unicode(bin_buf, encoding='utf-8')
```
File helpers
```
FileUtility.append_text_to_file('/tmp/test.txt', 'This is my text buffer', 'utf-8')
bin_buf = FileUtility.file_to_binary('/tmp/test.txt')
unicode_string = FileUtility.file_to_text('/tmp/test.txt', 'utf-8')
```
Exception helper
```
try:
a = None
b = a + 1
except Exception as e:
logger.warn("Ex=%s", SolBase.extostr(e))
```
Raw data
{
"_id": null,
"home_page": "https://github.com/champax/pysolbase",
"name": "pysolbase",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "Laurent Champagnac <champagnac.laurent@gmail.com>, Laurent Labatut <laurent@labatut.net>",
"keywords": "python, gevent",
"author": "Laurent Champagnac",
"author_email": "Laurent Champagnac <champagnac.laurent@gmail.com>, Laurent Labatut <laurent@labatut.net>",
"download_url": "https://files.pythonhosted.org/packages/96/fc/aa6cafa9a97c909f9697f0917c540722b8b2c3bf0662973f71fc47c8642a/pysolbase-3.13.5.tar.gz",
"platform": null,
"description": "pysolbase\n============\n\nWelcome to pysol\n\nCopyright (C) 2013/2025 Laurent Labatut / Laurent Champagnac\n\npysolbase is a set of python helpers to ease development.\n\nIt is gevent (co-routines) based.\n\nUsage\n===============\n\nEngage gevent monkey patching and setup default logger configuration:\n\n`SolBase.voodoo_init()`\n\nInitialize logging system (without engaging gevent) with default configuration (ie console logs - there is support for syslog and file logs).\n\n`SolBase.logging_init(\"INFO\")`\n\nRe-initialize logging system (without engaging gevent):\n\n`SolBase.logging_init(\"DEBUG\", True)`\n\nMillis helpers:\n\n```\nms = SolBase.mscurrent()\ndo_something()\nms_elapsed = SolBase.msdiff(ms)\n```\n\nDate helpers\n\n```\ndt = SolBase.datecurrent()\ndo_something()\nms_elapsed = SolBase.datediff(dt)\n```\n\nBinary helpers\n\n```\nbin_buf = SolBase.unicode_to_binary('This is my text buffer', encoding='utf-8')\nunicode_string = SolBase.binary_to_unicode(bin_buf, encoding='utf-8')\n```\n\nFile helpers\n\n```\nFileUtility.append_text_to_file('/tmp/test.txt', 'This is my text buffer', 'utf-8')\nbin_buf = FileUtility.file_to_binary('/tmp/test.txt')\nunicode_string = FileUtility.file_to_text('/tmp/test.txt', 'utf-8')\n```\n\nException helper\n\n```\ntry:\n a = None\n b = a + 1\nexcept Exception as e:\n logger.warn(\"Ex=%s\", SolBase.extostr(e))\n```\n",
"bugtrack_url": null,
"license": "GPL-3.0",
"summary": "pysolbase",
"version": "3.13.5",
"project_urls": {
"Homepage": "https://github.com/champax/pysolbase",
"Repository": "https://github.com/champax/pysolbase"
},
"split_keywords": [
"python",
" gevent"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "96fcaa6cafa9a97c909f9697f0917c540722b8b2c3bf0662973f71fc47c8642a",
"md5": "2e76d1db25f8fd9de45bf90625e16458",
"sha256": "0ac90d6ca3da22c350acbfdefb3da041e7a7ce4531b45f85acd75ab6bdeaf6e1"
},
"downloads": -1,
"filename": "pysolbase-3.13.5.tar.gz",
"has_sig": false,
"md5_digest": "2e76d1db25f8fd9de45bf90625e16458",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 25967,
"upload_time": "2025-09-10T13:23:13",
"upload_time_iso_8601": "2025-09-10T13:23:13.160172Z",
"url": "https://files.pythonhosted.org/packages/96/fc/aa6cafa9a97c909f9697f0917c540722b8b2c3bf0662973f71fc47c8642a/pysolbase-3.13.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-10 13:23:13",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "champax",
"github_project": "pysolbase",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "greenlet",
"specs": []
},
{
"name": "gevent",
"specs": []
},
{
"name": "distro",
"specs": []
},
{
"name": "pytz",
"specs": []
},
{
"name": "pyyaml",
"specs": []
}
],
"tox": true,
"lcname": "pysolbase"
}