Skip to main content

oiyshTerminal my basic libs: myLoger | FileActions | MyCalculate | db_helper | mysql_helper | ...

Project description

oiyshTerminal (pypips) - ot_my_libs

Set of function to speed up things like:

  • ArgsParse - to parse argument pass to app returns json
  • MyCalculate - trigonometry and other maths
  • db_helper - sqlite3 helper
  • myFastPlot - fast plot data with kivy
  • TimeHelper - to do operation on time
  • myLoger - logging unifide
  • XMLHelper
  • FileActions - file/dirs/path operations helper
  • myMqttClient
  • mysql_helper - mysql helper
  • example - use case of:
    • benchmarking - from TimeHelper
    • sqlite3 - from db_helper

important - some of subs will want more dependencies then default so look for logs if there is any pip missing ( myFastPlot )

check example

In directory of library in my case is /usr/lib/python3.8/site-packages

python3 ot_my_libs/example.py

this will run example use of bencharking uning ot_my_libs.TimeHelper and sqlite3 using ot_my_libs.db_helper from the example to get you going :)

or

xdocs - more in depth

example

TimeHelper use case as benchmarking tool

from ot_my_libs.TimeHelper import TimeHelper as thd
import time

def benchmarkTimer():
    th = thd()
    bKey = th.benStart()
    print("making test run ...")
    time.sleep(1)
    th.benDone(
        bKey,
        f"Result of benStart / benDone [run at:{th.getNiceShortDate()}]", 
        printIt=True 
        )

db_helper use case as fast sqlite3 init_table and CRUDish

from ot_my_libs.db_helper import db_helper as dbh

class mdb ( dbh ):
    ## set your structure of db / table
    def set_struct(self):
        self.struct = {
            'tableA' : { # your table name
                      'lat':     "float", # field 1 - name: lat type: float
                      'lon':     "float", # field 2 - name: lat type: float
                      }
            }
            
  db = mdb('/tmp/mdbTest1.db')

  # yes no initing strate to insert or ...
  print("inserting ....")
  insertRecordId = db.insert('tableA', {"lat":1.1,"lon":1.11} )

  print("select tableA ...")
  resA = db.select('tableA')
  print( resA )

  db.insert( 'tableA', {"lat":2.1,"lon":1.1} )
  print("select id,lat,lon from tableA where id=2 .....")
  # yes `id` column autoincremental is added automaticly 
  resB = db.select('tableA','id,lat,lon', 'id=2')
  print( resB )

  print("delete all ...")
  db.query('delete from tableA where 1')
  print("after delete ... select tableA")
  resC = db.select('tableA')
  print( resC )

development of package - base line

In directory of project to deploy tree ot_my_libs

ot_my_libs
├── __init__.py
├── ArgsParse.py
├── example.py
├── db_helper.py
├── FileActions.py
├── MyCalculate.py
├── myFastPlot.py
├── myLoger.py
├── myMqttClient.py
├── mysql_helper.py
├── TimeHelper.py
└── XMLHelper.py

uninstalling it

pip3 uninstall ot_my_libs

TODO

  • more examples
  • more def xdoc descriptions

change log

  • 0.0.11

    • fix some README errors parsing and ...
  • 0.0.10

    • ArgsParse to parse argument comming at start of app
    • myLoger have more colors to select and new defColor argument
    • add change log in README :)

If you see that this makes sense send me a ☕ | Master repository | About SvOiysh

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

ot_my_libs-0.0.11.tar.gz (17.7 kB view details)

Uploaded Source

Built Distribution

ot_my_libs-0.0.11-py3-none-any.whl (19.5 kB view details)

Uploaded Python 3

File details

Details for the file ot_my_libs-0.0.11.tar.gz.

File metadata

  • Download URL: ot_my_libs-0.0.11.tar.gz
  • Upload date:
  • Size: 17.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for ot_my_libs-0.0.11.tar.gz
Algorithm Hash digest
SHA256 3dfa146eeb2c0874e83da7b324eaa9af8658f32127e60b83be11a84f23e078c6
MD5 f2f797b09b0f54d631b919b23f96c968
BLAKE2b-256 2762cab5ca8db5e9b53cea7e0ba3be22a8b0be81e949218423ef56455c699eb7

See more details on using hashes here.

File details

Details for the file ot_my_libs-0.0.11-py3-none-any.whl.

File metadata

  • Download URL: ot_my_libs-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 19.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for ot_my_libs-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 70c103b5791816ddfb7d0ad3e7672460b9f242956f1cbcc183ec59a6fde874a7
MD5 7f9abc523994255fa012f7bfe5eb2e84
BLAKE2b-256 ef5e095bbb67c420b043e822ee1b34d38e659e26e5158230061a3641186bc508

See more details on using hashes here.

Supported by

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