Skip to main content

DSP utility collection

Project description

DSP utility packages

Common utilities developed by DSP inc.

packages

  1. log
  2. dbintf

log

A loggin decorator keeps logging functions' error messeages

  • features
    1. Crete logger using different log file
    2. Identical log file shared by multiple log instances (in same module scope) won't create multiple file handler for multiple write
  • import package
from dsputility import log
instance = log()
from dsputility.log import log
instance = log()
import dsputility as du
instance = du.log()
  • usseage
from dsputility import log

logName = os.path.basename(__file__)
myLog = log(logPath=logName) 
myLog2 = log(logPath=logName)

@myLog.errlog(logName)
def func1(x):
    return x/0

@myLog.errlog(logName)
async def afunc1():
    open('not exist', 'r')
		
@myLog2.errlog(logName)
def func2(x):
    "won't cause multiple handler problem"
    return x/0

dbintf

A simple interface to setup user, password, host and establish an DB engine

  • features
    1. Setup an attribute engine contain an DB engine established by sqlalchemy
  • import package
from dsputility import dbintf
instance = dbintf()
from dsputility.dbintf import dbintf
instance = dbintf()
import dsputility as du
instance = du.dbintf()
  • usseage
from dsputility import dbintf
intf = dbintf(db_name='data', user='postgres', password='password', host='localhost', port='5432', vendor:str='postgresql')
# this will setup intf.engine as an instance of
# sqlalchemy.create_engine(f"postgresql://postgres:password@localhost:5432/data")

# after setup intf, you can do database operations through intf.engine, such as
intf.engine.connect()

Project details


Download files

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

Source Distribution

DSPutility-0.0.15.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

DSPutility-0.0.15-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file DSPutility-0.0.15.tar.gz.

File metadata

  • Download URL: DSPutility-0.0.15.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for DSPutility-0.0.15.tar.gz
Algorithm Hash digest
SHA256 81377c515c4684bc1b38d238d9fe5f821509c58e0b87dabd241a38ea1bbbf208
MD5 7aea83fb55a9f3fd6390fcd26db856c9
BLAKE2b-256 518108f56206dbeb6cf58b2c0ba14ec49d7002cd394d513db8e247006841cf2f

See more details on using hashes here.

File details

Details for the file DSPutility-0.0.15-py3-none-any.whl.

File metadata

  • Download URL: DSPutility-0.0.15-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.10

File hashes

Hashes for DSPutility-0.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 0ea1e2c5dcac047efb3acdc5e6b4a92320679582f78feca49f5c9a9a980282f9
MD5 afee2ddc99e5d15b72595e2c64956b50
BLAKE2b-256 52880a246b27f07ae92af01c45ff599c704dc0f5cfd8817d0a58bbf0771b1d1b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page