Package: bitsmiths-lib
BITSMITHS LIBThis is the base/core Bitsmiths python library upon which all other products are built upon. This library contains the most
common base objects and patterns that we use for all our other projects.This library contains bothnormalandasyncversion of these common objects so that projects down the line can choose to
implement whichever version the need.Library ObjectsThese are the common objects in the library as well as a short description of their intended purpose.TransactionableTransactionableis an interface class that allows derived objects to extendbegin,commit, androllbackmethods. This object is intended to be used with database connections or anytransactionableobject. For example theAuditProduct extends this to do automatic record auditing on thecommit()method.Note there is also anTransactionableAsyncobject forasynccode.AutoTransactionTheAutoTransactionobject is designed to be used with one or manyTransactionableobjects. After a piece ofworkis complete, one would perform acommit()which would in turncommitall thetransactionableobjects that
were instantiated. If an error occurs, or if you do not do acommit(), this object will auto rollback all
thetransactionableobjects for you.Note there is also anAutoTransactionAsyncobject forasynccode.Below is an example of intended use:defsave_bank_record(self,brec:tBank):withAutoTransaction(self.database_connection)asat:withBankManager(self.database_connection)asbm:bm.save(brec)at.commit()PodThe intended purpose of thePodis to contain the shared/common business objects in a given product. By our
design we always at least have the following public properties in a pod:dbcon : The active database connection that is ready for usecfg : A shared/common configuration dictionarylog : The active logging logger object that is ready for useusr_id : The current business or systems user identifier string that is performing the current action/workThink of aPodas a context maanager that youinjectinto all your business code down the line. ThePodcontains
everything your business code needs to do its job. You are encouraged to extend thePodobject to have
any other common business properties your project requires.  Note also see theProviderfor dynamically creating
core business objects.You will notice that thePodinherits fromTransactionableand it also automaticallycommitsandrollbacksthe
database connection if it used withAutoTransaction.Note there is also aPodAsyncobject forasynccode.ProviderThe provider is designed to be an interface that you can override to create commonly used objects from sort
of factory.  It was originally a pattern we copied from C++, but it does have a place in Python frameworks if
one embraces the pattern.  We don't use it much, but there is nothing wrong with having it here.Query BuilderThequery_builderobject is just a common piece of code use to string together dynamic SQL. Its is meant to be
relativelySQL Injectionsafe, but use it responsibly.CommonThis is just a collection of commonly used functions that we use often in multiple different products.SentinelThis is process/thread server management tool. More to explain here in the future.Change History2.1.4TypeDescriptionBugSentinelManager now raises notification for failed pluggins/threads correctly.2.1.3TypeDescriptionBugFixed a blatent bug in SentinelManager when handling SentinelThread objects ending.2.1.2TypeDescriptionNewCustom notification method added to sentinel manager when a child process or pluggin ends.2.1.1TypeDescriptionNewAdded parameters to SentinelProcess so that it can swallow standard output from child processes.BugFixed the pythonSentinelThread.pywas still importing the oldCommonmodule from bs_lib instead ofcommon.2.1.0TypeDescriptionNewThe project now has a dependency on PYPI mettle instead of a external shared link.2.0.0TypeDescriptionNewAdded async equivalent objects for Pod (APod) and Transactionable (ATrasactionable).NewAdded async version of sql_run and sql_fetch to common.Breaking ChangeRemoved initialize and destroy method from Pod.Breaking ChangeSnake cased the entire library in regards to methods and members.