Saravanan666/pypi-org huggingface dataset:
Package: simple-social-suture
#simple_social_sutureThis library provides a unified JSON structure for Twitter, Instagram and Vimeo##Usage:from simple_social_suture.api import get_my_messagessettings = {'TWITTER_APP_KEY' : 'XXXXXXXXXX','TWITTER_APP_KEY_SECRET' : 'XXXXXXXXXX','TWITTER_ACCESS_TOKEN' : 'XXXXXXXXXX','TWITTER_ACCESS_TOKEN_SECRET' : 'XXXXXXXXXX','INSTAGRAM_USER_NAME' : 'XXXXXXXXXX','INSTAGRAM_CLIENT_ID' : 'XXXXXXXXXX','INSTAGRAM_SECRET_CLIENT_ID' : 'XXXXXXXXXX','INSTAGRAM_ACCESS_TOKEN' : 'XXXXXXXXXX','VIMEO_USER_NAME' : 'XXXXXXXXXX','VIMEO_CLIENT_ID' : 'XXXXXXXXXX','VIMEO_SECRET_CLIENT_ID' : 'XXXXXXXXXX','MAX_TWITTER_COUNT' : 100,'MAX_QUERY_COUNT' : 200}messages = get_my_messages(settings, "@twitter_username", "@instagram_username", "vimeo_username")print messages#Example schema output[{'message_date': datetime.datetime(2017, 5, 4, 14, 11, 37),'message_timesince': '3 days ago','hashes': [],'id': XXXXXXXXXX,'user_profile_url': u'https: //twitter.com/XXXXXXXXXX','message_html': u'XXXXXXXXXX','raw_data': {... this is the json returned from Twitter API ...},'user_screen_name': u'XXXXXXXXXX','user_avatar_url': u'https: //pbs.twimg.com/profile_images/XXXXXXXXXX/XXXXXXXXXX.jpg','message_url': u'https: //twitter.com/XXXXXXXXXX/status/XXXXXXXXXX','user_name': u'XXXXXXXXXX','message_id': 'tweet_XXXXXXXXXX'},{'message_date': datetime.datetime(2017, 5, 1, 10, 0, 19),'message_timesince': '6 days ago','hashes': [u'XXXXXXXXXX',u'XXXXXXXXXX',u'XXXXXXXXXX'],'id': XXXXXXXXXX,'user_profile_url': u'https: //instagram.com/XXXXXXXXXX','message_html': u"XXXXXXXXXX",'raw_data': {... this is the json returned from Instagram API ...},'user_screen_name': u'XXXXXXXXXX','user_avatar_url': u'https: //scontent.cdninstagram.com/XXXXXXXXXX/XXXXXXXXXX.jpg','message_url': u'https: //www.instagram.com/p/XXXXXXXXXX/','user_name': u'XXXXXXXXXX','message_id': u'instagram_XXXXXXXXXX'},{'message_date': datetime.datetime(2016,8, 15, 18,30,55),'message_timesince': '8 months ago','hashes': [],'id': 'XXXXXXXXXX','user_profile_url': u'https: //vimeo.com/XXXXXXXXXX','message_html': u'<iframesrc="https://player.vimeo.com/video/XXXXXXXXXX?badge=0&autopause=0&player_id=0" width="640" height="360" frameborder="0" title="XXXXXXXXXX" ></iframe>','raw_data': {... this is the json returned from Vimeo API ...},'user_screen_name': 'XXXXXXXXXX','user_avatar_url': u'https: //i.vimeocdn.com/portrait/XXXXXXXXXX?r=pad','message_url': u'https: //vimeo.com/XXXXXXXXXX','user_name': u'XXXXXXXXXX','message_id': 'vimeo_XXXXXXXXXX'}]
Package: simple-socket
SimpleTCPClientimportrandomimporttimefromsimple_socket.tcp_clientimportSimpleTCPClient# try also SimpleSSLClient for semi-secure communication (it does not verify the cert)client=SimpleTCPClient('192.168.254.254',1885)print('client.Hostname=',client.Hostname)# by default, the client will connect and attempt to maintain its connection.# if you want to manually control the connection, pass autoConnect=False# then use the .Connect() and .Disconnect() methods to manage your connection manuallyclient.onConnected=lambda_,state:print('The client is',state)client.onDisconnected=lambda_,state:print('The client is',state)client.onReceive=lambda_,data:print('Rx:',data)whileTrue:cmd=random.choice(['q','n','i'])print('sending:',cmd)if'Connected'inclient.ConnectionStatus:client.Send(cmd)time.sleep(5)SimpleUDPClientfromsimple_socket.udp_clientimportSimpleUDPClientimporttimeclient1=SimpleUDPClient('localhost',sendIPPort=1025,receiveIPPort=1024)defClient1HandleReceive(interface,data):client1.Send('From client1 echo:{}'.format(data.decode()))client1.onReceive=Client1HandleReceiveprint('client1=',client1)client2=SimpleUDPClient('localhost',sendIPPort=1024,receiveIPPort=1025)client2.onReceive=lambda_,data:print('Rx:',data)print('client2=',client2)whileTrue:client2.Send(f'From client2: The time is{time.asctime()}\r\n')time.sleep(3)SimpleTCPServerfromsimple_socket.tcp_serverimportSimpleTCPServer# try also SimpleSSLServer for semi-secure communication (it uses a self-signed cert)server=SimpleTCPServer(3888)server.onConnected=lambdaclient,state:print('Client{}is{}'.format(client,state))server.onDisconnected=lambdaclient,state:print('Client{}is{}'.format(client,state))defHandleRx(client,data):print('Server received{}from{}'.format(data,client))client.Send(b'Echo: '+data+b'\r\n')ifb'q'indata:# the server can force-close a connection# in this case,# the server will disconnect a client if they send the letter 'q'client.Disconnect()server.onReceive=HandleRxNotesYou can pass the parameter “listenAddress” to a Server init. This will allow you to listen to
Package: simple-socket-client
Simple TCP socket clientInstallationInstall it with pip:$pipinstallsimple-socket-clientOr you can add it as dependency in requirements.txt file of your python application:simple-socket-client~=1.5Usagefromsimple_socket_clientimportSimpleSocketClientclient=SimpleSocketClient('192.168.0.2',6666)client.connect(timeout=10)client.send('Test'.encode())# if you don't need an answeranswer=client.ask('Hi!'.encode())print(answer.decode())client.disconnect()
Package: simplesockets
IntroductionThis library allows to easily create TCP Servers and Clients using Python socketsIf you want a secure connection, use the secure variantsecuresockets. It uses thepycryptodomelibrary. It should be clear, that you need to install said library to use
the secure variant.If you have encountered a bug or have an idea, share it ongithub. For more help look
up thedocs(Note: They may be incomplete)Installationusepip install simplesocketsto install this library.ExamplesThis package also contains an example, an echo Server and Client:echoclient.pyif__name__=="__main__":fromsimplesocketsimportTCPClientClient=TCPClient()Client.setup(target_ip="localhost",target_port=25567)# prepares the ClientClient.connect()# connects the Client to the ServerClient.autorecv()# enables autorecv: automatically saves all incoming data in Client.recved_data,# return them with Client.return_recved_data()Client.send_data(b'Test')# sends the text to the ServerwhileTrue:ifClient.event.new_data:# checks if any data receiveddata:list=Client.return_recved_data()# returns the received data as a listforelementindata:print(element.response)# should print b'Test'break# ends the while loopechoserver.pyif__name__=="__main__":fromsimplesocketsimportTCPServerServer=TCPServer()Server.setup(ip='127.0.0.1',port=25567)# prepares the serverServer.start()# starts the serverwhileTrue:ifServer.event.new_data:# checks if any data receiveddata:list=Server.return_recved_data()# returns the received data as a listforelementindata:response:bytes=element.response# element is a Socket_Response object,client=element.from_# sets client to a Server_Client objectServer.send_data(response,client)
Package: simple-socket-server
Simple TCP socket server with selectInstallationInstall it with pip:$pipinstallsimple-socket-serverOr you can add it as dependency in requirements.txt file of your python application:simple-socket-server~=1.8UsageEasy way to understand how it works is testing socket server via telnet terminal:fromsocketimportsocketfromsimple_socket_serverimportSimpleSocketServersocket_server=SimpleSocketServer()@socket_server.on('connect')defon_connect(sock:socket,peer):print('New connection from%s:%s'%peer)socket_server.send(sock,bytes('What is your name?\r\n','utf-8'))@socket_server.on('disconnect')defon_disconnect(_sock,peer):print('Connection from%s:%sis closed'%peer)@socket_server.on('message')defon_message(sock:socket,peer,message:bytes):print('Incoming data from%s:%s'%peer,message)socket_server.send(sock,bytes('Hi, ','utf-8')+message)socket_server.run(host='0.0.0.0',port=5000)Then you can connect to server:telnet127.0.0.15000
Package: simplesocks
SimplesocksA simple socket wrapper for python built on top of the standard socket library with password based encryption for security.InstructionsInstallpipinstallsimplesocksCreate server.pyimportsocketfromsimplesocks.serverimportSimpleServerimportjsonclassTestServer(SimpleServer):defaccept_client_connection(self,client_socket:socket.socket,client_address:tuple,initialization_data:object)->None:super().accept_client_connection(client_socket,client_address,initialization_data)initialization_data=json.loads(initialization_data)['id']print(f"Client{client_address[0]}:{client_address[1]}connected as{initialization_data}")defhandle_incoming_data(self,client_id:str,client_socket:socket.socket,data:bytes)->None:super().handle_incoming_data(client_id,client_socket,data)ifdata==b"TERMINATE":print(f"Server termination requested by{client_id}")self.terminate_server()self.broadcast_data(client_socket,json.dumps({'id':client_id,'data':data.decode()}).encode('utf-8'))defclose_client_connection(self,client_id:str,client_socket:socket.socket)->None:super().close_client_connection(client_id,client_socket)print(f"Client{client_id}disconnected")server=TestServer(server_key=b"msZ5ZR9zjtBXRzssQ3qD33FAVxTBir55rHa1dAJlV5g=")server.listen()Create client.pyimportjsonimportthreadingimporttimefromsimplesocks.clientimportSimpleClient,ClientReceiveDataTimeoutExceptionclient=SimpleClient('192.168.1.200',4444,server_key=b"msZ5ZR9zjtBXRzssQ3qD33FAVxTBir55rHa1dAJlV5g=")defreceive():whileTrue:try:message=json.loads(client.receive_data().decode('utf-8'))print(f"{message['id']}:{message['data']}")exceptClientReceiveDataTimeoutExceptionase:continuedefwrite():whileTrue:client.send_data(input("").encode('utf-8'))receive_thread=threading.Thread(target=receive)receive_thread.start()write_thread=threading.Thread(target=write)write_thread.start()Start the serverpython server.pyConnect with client instancespython client.py
Package: simple-soundboard
Simple SoundboardSimple soundboard web app that plays sounds on a central serverInstallationInstall through pip withpip install simple_soundboardUsageEdit config in ~/simple_soundboard/config.json
Start by runningsimple_soundboardMQTT APIMQTT Server is configured in ~/simple_soundboard/config.json
MQTT API includessimple_soundboard/stop_all
simple_soundboard/stop_sounds
simple_soundboard/fadeout
simple_soundboard/pause_music
simple_soundboard/resume_music
simple_soundboard/play/<topic_from_web_ui>No payload requiredThe server output two MQTT topicsimple_soundboard/stopped_all
simple_soundboard/stopped_sounds
simple_soundboard/playing/<topic_from_web_ui> (If MQTT Topic is set)will be publishedTODOMake the config editable onlineMultiple music?Developmentgit clone this projectCreate a new venvpython3 -m venv --system-site-packages ./venvSource itsource ./venv/bin/activateInstall all dependancies with poetrypoetry installInstall git hookspre-commit installUpload to pypiSource the venvsource ./venv/bin/activateInstall twinepip install twineConfig your pypi credentials in the file~/.pypirc[pypi]username=pypi_usernamepassword=pypi_passwordRunpoetryinstalltwinecheckdist/*twineuploaddist/*
Package: simple-spaced-repetition
simple-spaced-repetitionSimple spaced repetition scheduler, based on theclassic Anki algorithmand implemented in under 40 lines of code.This scheduler is used atPython.cards.!Test statusInstallationInstall with pip:pip install simple_spaced_repetitionExample usageTheCardclass is what you should use:>>>fromsimple_spaced_repetitionimportCard>>>Card()Card(status=learning,step=0,interval=None,ease=2.5)Cardhas a single methodoptions()which returns the 4 possible choices for answering a card:>>>fromsimple_spaced_repetitionimportCard>>>card=Card()>>>card.options()[('again',Card(status=learning,step=0,interval=0:01:00,ease=2.5)),('hard',Card(status=learning,step=1,interval=0:06:00,ease=2.5)),('good',Card(status=learning,step=1,interval=0:10:00,ease=2.5)),('easy',Card(status=reviewing,step=0,interval=4days,0:00:00,ease=2.5))]Next to each answer is a newCardobject that represents the card after answering with that option.The attributeintervalholds the time that must pass before the card is due again:>>>fromsimple_spaced_repetitionimportCard>>>card=Card()>>>foranswer,new_cardincard.options():...print(answer,new_card.interval)again0:01:00hard0:06:00good0:10:00easy4days,0:00:00Run testsSimply run:python test_simple_spaced_repetition.py
Package: simple-speak
实现语音唤醒，基于调度命令长期调度直到唤醒命令，实现语音输入输出；综合了语音转文本、文本转语音、录音、自然语言处理、爬虫等技术；实现语音控制，依据传入命令调动该命令意图实现的程序，当然这需要任务程序的接口；依据任务程序的数量实现程序泛化
Package: simple-specification
A simple pythonic implementation of theSpecification Patternfor Python 3.7 or higher.Installationpipinstallsimple-specificationExamplesCreating specification classes to check integer numbersfromsimple_specificationimportSpecification# hardcoded specificationclassOdd(Specification):defis_satisfied_by(self,candidate:int)->bool:returncandidate%2!=0# parametrized specificationclassDivisibleBy(Specification):def__init__(self,number:int):self.number=numberdefis_satisfied_by(self,candidate:int)->bool:returncandidate%self.number==0Instantiating the specifications>>>odd=Odd()>>>even=~odd>>>div3=DivisibleBy(3)>>>div5=DivisibleBy(5)Using specifications - methodis_satisfied_by(candidate)>>>odd.is_satisfied_by(1)True>>>odd.is_satisfied_by(2)False>>>even.is_satisfied_by(3)False>>>even.is_satisfied_by(4)True>>>div3.is_satisfied_by(9)True>>>div5.is_satisfied_by(12)FalseComposing specifications - operators&and|>>># AND>>>(even&div3).is_satisfied_by(6)True>>>(even&div3).is_satisfied_by(9)False>>>(even&div3&div5).is_satisfied_by(30)True>>>(even&div3&div5).is_satisfied_by(36)False>>>>>># OR>>>(even|div3).is_satisfied_by(10)True>>>(even|div3).is_satisfied_by(15)True>>>(even|div3).is_satisfied_by(5)FalseNegating specifications - operator~WarningAlways surround the negation with parenthesis>>>(~odd).is_satisfied_by(2)True>>>(~div5).is_satisfied_by(25)False>>>(~div5).is_satisfied_by(11)True>>>(~(odd|div5)).is_satisfied_by(6)True>>>(~(odd|div5)).is_satisfied_by(7)FalseComposing a list of specifications with&- class methodSpecification.all(specs)>>>all_spec=Specification.all([~even,div3,div5])>>>all_spec.is_satisfied_by(15)True>>>all_spec.is_satisfied_by(30)False>>>all_spec.is_satisfied_by(25)False>>>all_spec.is_satisfied_by(6)FalseComposing a list of specifications with|- class methodSpecification.any(specs)>>>div15=DivisibleBy(3)&DivisibleBy(5)>>>any_spec=Specification.any([div15,even])>>>any_spec.is_satisfied_by(2)True>>>any_spec.is_satisfied_by(15)True>>>any_spec.is_satisfied_by(30)True>>>any_spec.is_satisfied_by(3)False>>>any_spec.is_satisfied_by(5)False
Package: simple-spell-checker
simple_spell_checkerSimple Spell Checker is a spell checker based on prefix tree search. It find nearest to input word from known words (from input list).
The algorithm finds mistakes in a word (insertions, deletions, replacements).Installationpip install simple-spell-checkerQuickstartfromsimple_spell_checker.spell_checkerimportSpellCheckercities=["Kyiv","Kharkiv","Odesa","Dnipro","Donetsk","Zaporizhzhia","Lviv","Kryvyi Rih","Mykolaiv","Luhansk","Vinnytsia","Simferopol","Chernihiv","Kherson","Poltava","Khmelnytskyi","Cherkasy","Chernivtsi","Zhytomyr","Sumy","Rivne","Ivano-Frankivsk","Ternopil","Kropyvnytskyi","Lutsk","Uzhhorod"]spell_checker=SpellChecker(max_corrections_relative=.5)spell_checker.add_words(cities)spell_checker.correction('Kiev')# [{'word': 'Kyiv',#   'corrections': [{'mistake_type': 'missing symbol "y"', 'position': 1},#    {'mistake_type': 'extra symbol "e"', 'position': 2}]}]spell_checker.correction('odessa')# [{'word': 'Odesa',#   'corrections': [{'mistake_type': 'wrong symbol "o": replaced on "O"',#     'position': 0},#    {'mistake_type': 'extra symbol "s"', 'position': 4}]}]spell_checker.correction('Hmelnitskiy',max_corrections_relative=.5)# [{'word': 'Khmelnytskyi',#   'corrections': [{'mistake_type': 'missing symbol "K"', 'position': 0},#    {'mistake_type': 'wrong symbol "H": replaced on "h"', 'position': 0},#    {'mistake_type': 'wrong symbol "i": replaced on "y"', 'position': 5},#    {'mistake_type': 'missing symbol "y"', 'position': 9},#    {'mistake_type': 'extra symbol "y"', 'position': 10}]}]spell_checker.correction('Kharkiv')# [{'word': 'Kharkiv', 'corrections': []}]
Package: simple-spiders
_                 _         _____       _     _
    (_)               | |       / ____|     (_)   | |
 ___ _ _ __ ___  _ __ | | ___  | (___  _ __  _  __| | ___ _ __
/ __| | '_ ` _ \| '_ \| |/ _ \  \___ \| '_ \| |/ _` |/ _ \ '__|
\__ \ | | | | | | |_) | |  __/  ____) | |_) | | (_| |  __/ |
|___/_|_| |_| |_| .__/|_|\___| |_____/| .__/|_|\__,_|\___|_|
                | |                   | |
                |_|                   |_|中文OverviewA simple web crawling
framework.DocumentGetting Startedpip installsimple-spidersYou should construst project.py to suit your needsfrom crawler.spider import Spider
from crawler.writter import DataWriter

spider = Spider(
    'https://movie.douban.com/subject/26810318/comments?start=0&limit=20&sort=new_score&status=P')
spider.start_crawl()python project.pyCtrl-Cto stopReferenced LibrariesUsingrequestsas
htmlDownloaderUsinglxmlas default htmlParserUsingcsvprovide feature that export
file as csv typeUsingxlwtprovide feature that
export file as excel typeUsingxlsxwriterprovide
feature that export file as xexcel typeUsageProject structure- crawler/
    - __init__.py
    - test/
      - htmlDownloder_test
      - htmlParser_test
      - requestManager_test
      - writter_test
      - logger_test
      - spider_test

    - htmlDownloder
    - htmlParser
    - requestManager
    - writter
    - logger
    - spider

- main.pyLicenseThis project is published open source under [] agreement.
Please maintain the open source release after modification and sign the
name of the original author. Thank you for your respectIf you need to apply this project for commercial purposes, please
contact me(@pengr) separately to
obtain commercial authorization
Package: simple-spider-tool
simple spider tool在实际工作中，沉淀的一些简易、好用的爬虫工具，减少重复代码与文件冗余，希望一样能为使用者带来益处。如果您也想贡献好的代码片段，请将代码以及描述，通过邮箱（xingcys@gmail.com）发送给我。代码格式是遵循自我主观，如存在不足敬请指出！安装pipinstallsimple-spider-tool简单使用fromsimple_spider_toolimportformat_json,jsonpathdata={"code":200,"data":[{"id":1,"username":"admin","level":"boss"},{"id":2,"username":"user","level":"staff"}]}boss_name=jsonpath(data,'$.data[?(@.level=="boss")].username',first=True)all_user_info=jsonpath(data,'$.data[*].username')print(boss_name)print(format_json(all_user_info))兼容使用在0.0.18对包目录发生改变，由simple_spider_tools更改为simple_spider_tool，如有使用过低于0.0.18版本，请通过安装兼容扩展包以达到兼容使用pipinstallsimple-spider-tool[seventeen]链接Github：https://github.com/xingcweb/simple-spider-tool在线文档：https://simple-spider-tool.xingc.top/
Package: simple-spider-tool17
simple-spider-tool17simple-spider-tool0.0.18及后续版本兼容之前版本使用的可选扩展包安装pipinstallsimple-spider-tool[seventeen]简单使用fromsimple_spider_toolsimportformat_json,jsonpathdata={"code":200,"data":[{"id":1,"username":"admin","level":"boss"},{"id":2,"username":"user","level":"staff"}]}boss_name=jsonpath(data,'$.data[?(@.level=="boss")].username',first=True)all_user_info=jsonpath(data,'$.data[*].username')print(boss_name)print(format_json(all_user_info))
Package: simple-spinner
Simple SpinnerIt is a way to print a spinning cursor in terminal using Python.I referredthis document."It's just Simple Spinning Cursor."downloadpipinstallsimple_spinnerhow to use?usestart, endmethodfromsimple_spinner.spinnerimportSpinnerspinner=Spinner()spinner.start(desc='test')time.sleep(3)spinner.stop()usewithreserved wordfromsimple_spinner.spinnerimportSpinnerwithSpinner(desc='test'):time.sleep(3)
Package: simple-spotify
Simple-SpotifyPure Python wrapper library for Spotify Web API.Installationpip install simple-spotifyQuick Startfromsimple_spotify.apiimportSpotifyfromsimple_spotify.authorizationimportClientCredentialsFlowres=ClientCredentialsFlow.token_request('YOUR CLIENT ID','YOUR CLIENT SECRET')auth=ClientCredentialsFlow(**res)sp=Spotify(auth)result=sp.search(q='sora tob sakana')foralbuminresult.albums.items:print(album.name)sora tob sakana
cocoon ep
yozora wo zenbu
mahou no kotobaIf you execute endpoint which need AutotizationCodeFlow on your local envirnoment tempolary,authcode-fetchwill be help you.$ authcode-fetch

    =============================================
                    Simple-Spotify
        Authorization Code Flow Support Tool
    =============================================

    Fetch authorization code from https://accounts.spotify.com/authorize.
    Output json file named simple-spotify_code.json.
    This json file includes client_id, client_secret, authorization code, redirect uri.
    Format of json file as follows.
    {
        'client_id': client_id,
        'client_secret': client_secret,
        'code': authorization code,
        'redirect_uri': redirect_uri
    }

Enter the your Client ID : YOUR CLIENT ID
Enter the your Client Secret : YOUR CLIENT SECRET
Enter the redirect URI :http://127.0.0.1:8080/
Enter the scopes
Scope :user-read-birthdate
Add more scope ?(y/n) :n
# Open your default browser. Log in, authorize access
Enter the redirected URL : REDIRECTED URLThen, simple-spotify_code.json generate on your current directory.importjsonfromsimple_spotify.apiimportSpotifyfromsimple_spotify.authorizationimportAuthorizationCodeFlowwithopen('simple-spotify_code.json')asf:auth_dict=json.load(f)res=AuthorizationCodeFlow.token_request(**auth_dict)auth=AuthorizationCodeFlow(**res)sp=Spotify(auth)current_user=sp.get_current_user_profile()Versionv.0.1.0(May 09, 2019): Initial release:v.0.1.1(May 10, 2019): Create sample web app, fix authorization.pyv.0.1.2(May 10, 2019): Upload to PyPIv.0.1.3(May 11, 2019): Bugfix on simple_spotify.apiv.0.1.4(May 17, 2019): Added keyword argumentmarketto following methods.get_album,get_albums,get_track,get_tracks
Package: simple-sqla-timer
DescriptionProvides a simple way to find slow SQL queries when using SQLAlchemy.Hooks into the SQLAlchemy events system to find when queries start and finish.
Note that this is not meant to serve as a profiler and will not explain why your queries are slow,
just tell you which ones are.
SeeSQLAlchemy docs about performancefor profiling if you need to find out how much time a query spends waiting for database response,
fetching the data and ORM operations.InstallationThis is a pure python package, so it can be installed withpip install simple-sqla-timeror any other dependency manager.UsageRun this function at the start of your application:fromsimple_sqla_timerimportsetup_query_timersetup_query_timer()By default, this will log the start of the statements and their durations to thesimple_sqla_timerlogger, withdebuglevel. You can override this behaviour by specifying a custom logging function:importloggingfromsimple_sqla_timerimportsetup_query_timerdefmy_log_function(statement:str,duration:float)->None:logging.info("Query:%s\nDuration:%f",statement,duration)setup_query_timer(my_log_function)Important: The query timermustbe set upbeforethe application opens SQLAlchemyEngineconnections. Any
connections opened before setting up the timer will not have their statements logged.DevelopmentThis library uses thepoetrypackage manager, which has to be installed before installing
other dependencies. Afterwards, runpoetry installto create a virtualenv and install all dependencies.Blackis used (and enforced via workflows) to format all code. Poetry will install it
automatically, but running it is up to the user. To format the entire project, runblack ..ContributingThis project uses the Apache 2.0 license and is maintained by the data science team @ Barbora. All contributions are
welcome in the form of PRs or raised issues.
Package: simpleSQLBuilder
simpleSQLBuilderExamplefromsimpleSQLBuilder.QueryBuilderimportQueryBuilderprint(QueryBuilder().from_('users').select('id').select('name','email').where('id < 3').build().result)# 'SELECT id,name,email FROM users WHERE id < 3'print(QueryBuilder().from_('users').where('id < 3').where('coin > 100').build().result)# 'SELECT * FROM users WHERE id < 3 AND coin > 100'
Package: simple-sqlite
simple_sqliteIt is a fast and convenience package that can help you using sqlite3 library much easier and faster.InstallationUse the package managerpipto install simple_sqlite.pip install simple-sqliteUsageThis example shows how you can use this library to create database.fromsimple_sqliteimportSimpleSqlitessql=SimpleSqlite('basic.db')result,message=ssql.create_database()ContributingAlways suggest creating new methods. Open an issue first to discuss what you would like to add.