Skip to main content

Set of python helpers to ease development

Project description


Welcome to pysol

Copyright (C) 2013/2017 Laurent Labatut / Laurent Champagnac

pysolbase is a set of python helpers to ease development.

It is gevent (co-routines) based.


Engage gevent monkey patching and setup default logger configuration:


Initialize logging system (without engaging gevent) with default configuration (ie console logs - there is support for syslog and file logs).


Re-initialize logging system (without engaging gevent):

SolBase.logging_init("DEBUG", True)

Millis helpers:

ms = SolBase.mscurrent()
ms_elapsed = SolBase.msdiff(ms)

Date helpers

dt = SolBase.datecurrent()
ms_elapsed = SolBase.datediff(dt)

Binary and unicode 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

   a = None
   b = a + 1
except Exception as e:
   logger.warn("Ex=%s", SolBase.extostr(e))

Source code

  • We are pep8 compliant (as far as we can, with some exemptions)
  • We use a right margin of 360 characters (please don't talk me about 80 chars)
  • All unittest files must begin with test_ or Test, should implement setUp and tearDown methods
  • All tests must adapt to any running directory
  • The whole project is backed by gevent (
  • We use docstring (:return, :rtype, :param, :type etc..), they are mandatory
  • We use PyCharm "noinspection", feel free to use them


  • Debian 8 Jessie or greater, x64, Python 2.7


To run unittests, you will need:

  • nothing special except python and dependencies requirements.


This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pysolbase, version 1.1.8
Filename, size File type Python version Upload date Hashes
Filename, size pysolbase-1.1.8.tar.gz (25.8 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page