Saravanan666/pypi-org huggingface dataset:
Package: litestar-aiosql
Litestar Aiosql[!IMPORTANT]
This plugin currently contains minimal features and is a work-in-progressInstallationpipinstalllitestar-aiosqlUsageHere is a basic application that demonstrates how to use the plugin.from__future__importannotationsfromlitestarimportLitestarfromlitestar_aiosqlimportAiosqlPlugin,AiosqlConfigaiosql=AiosqlPlugin(config=AiosqlConfig())app=Litestar(plugins=[aiosql])
Package: litestar-asyncpg
Litestar asyncpgInstallationpipinstalllitestar-asyncpgUsageHere is a basic application that demonstrates how to use the plugin.from__future__importannotationsfromtypingimportTYPE_CHECKINGfromlitestarimportController,Litestar,getfromlitestar_asyncpgimportAsyncpgConfig,AsyncpgPlugin,PoolConfigifTYPE_CHECKING:fromasyncpgimportConnectionclassSampleController(Controller):@get(path="/sample")asyncdefsample_route(self,db_connection:Connection)->dict[str,str]:"""Check database available and returns app config info."""result=awaitdb_connection.fetch("select 1")return{"select_1":str(result)}asyncpg=AsyncpgPlugin(config=AsyncpgConfig(pool_config=PoolConfig(dsn="postgresql://app:app@localhost:5432/app")))app=Litestar(plugins=[asyncpg],route_handlers=[SampleController])
Package: litestar-granian
Litestar Granian PluginInstallationpipinstalllitestar-granianUsageHere is a basic application that demonstrates how to use the plugin.from__future__importannotationsfromlitestarimportController,Litestar,getfromlitestar_granianimportGranianPluginclassSampleController(Controller):@get(path="/sample")asyncdefsample_route(self)->dict[str,str]:"""Sample Route."""return{"sample":"hello-world"}app=Litestar(plugins=[GranianPlugin()],route_handlers=[SampleController])Now, you can use the standard Litestar CLI and it will run with Granian instead of Uvicorn.❯litestar--appexamples.basic:apprun
UsingLitestarappfromenv:'examples.basic:app'Startinggranianserverprocess──────────────────────────────────────────────
┌──────────────────────────────┬──────────────────────┐
│Litestarversion│2.1.1│
│Debugmode│Disabled│
│PythonDebuggeronexception│Disabled│
│CORS│Disabled│
│CSRF│Disabled│
│OpenAPI│Enabledpath=/schema│
│Compression│Disabled│
└──────────────────────────────┴──────────────────────┘[INFO]Startinggranian[INFO]Listeningat:127.0.0.1:8000[INFO]Spawningworker-1withpid:2719082[INFO]Startedworker-1[INFO]Startedworker-1runtime-1
Package: litestar-mqtt
litestar-mqttLitestar-mqtt is porting ofFastapi-mqttfor theLitestar framework.For more information about MQTT, please refer to theFastapi-mqtt MQTTdocumentation.As Fastapi-mqtt, Litestar-mqtt wraps aroundgmqttmodule.Features:Litestar-mqtt implements the same feature of Fastapi-mqtt and also:Load configurations via.envfileMQTT_HOST="mqtt-dashboard.com"Installation:$pipinstalllitestar-mqttor$poetryaddlitestar-mqttDifferences:Litestar-mqtt must be hooked to theon_startupandon_shutdownhandlers.app=Litestar(route_handlers=[test_func],on_startup=[lite_mqtt.startup],on_shutdown=[lite_mqtt.shutdown],)
Package: litestar-piccolo
Litestar PiccoloInstallationpipinstalllitestar-piccoloorpipinstalllitestar[piccolo]UsageHere is a basic application that demonstrates how to use the plugin.from__future__importannotationsfromlitestarimportLitestarfromlitestar_piccoloimportPiccoloPluginpiccolo=PiccoloPlugin()app=Litestar(plugins=[piccolo])
Package: litestar-saq
Litestar SAQ[!IMPORTANT]
This plugin currently contains minimal features and is a work-in-progressInstallationpipinstalllitestar-saqUsageHere is a basic application that demonstrates how to use the plugin.from__future__importannotationsfromlitestarimportLitestarfromlitestar_saqimportQueueConfig,SAQConfig,SAQPluginsaq=SAQPlugin(config=SAQConfig(redis_url="redis://localhost:6397/0",queue_configs=[QueueConfig(name="samples")]))app=Litestar(plugins=[saq])You can start a background worker with the following command now:litestar--app-dir=examples/--appbasic:appworkersrun
UsingLitestarappfromenv:'basic:app'StartingSAQWorkers──────────────────────────────────────────────────────────────────
INFO-2023-10-0417:39:03,255-saq-worker-Workerstarting:Queue<redis=Redis<ConnectionPool<Connection<host=localhost,port=6397,db=0>>>,name='samples'>
INFO-2023-10-0417:39:06,545-saq-worker-Workershuttingdown
Package: litestar-socketify
Litestar Socketify Plugin[!WARNING]
Socketify currently has an issue withASGI lifespans. This plugin should be considered experimental.Installationpipinstalllitestar-socketifyUsageHere is a basic application that demonstrates how to use the plugin.from__future__importannotationsfromlitestarimportController,Litestar,getfromlitestar_socketifyimportSocketifyPluginclassSampleController(Controller):@get(path="/sample")asyncdefsample_route(self)->dict[str,str]:"""Sample Route."""return{"sample":"hello-world"}app=Litestar(plugins=[SocketifyPlugin()],route_handlers=[SampleController])Now, you can use the standard Litestar CLI and it will run with Socketify instead of Uvicorn.❯litestar--appexamples.basic:apprun
UsingLitestarappfromenv:'examples.basic:app'Startingsocketifyserverprocess──────────────────────────────────────────────
┌──────────────────────────────┬──────────────────────┐
│Litestarversion│2.1.1│
│Debugmode│Disabled│
│PythonDebuggeronexception│Disabled│
│CORS│Disabled│
│CSRF│Disabled│
│OpenAPI│Enabledpath=/schema│
│Compression│Disabled│
└──────────────────────────────┴──────────────────────┘
...
Package: litestar-svcs
Litestar SvcsA plugin to integratelitestarwithsvcs.Basic UsagefromlitestarimportLitestarfromlitestarimportgetfromlitestar_svcsimportSvcsPlugin,SvcsPluginConfigfromsvcsimportContainer,Registry@get("/",sync_to_thread=False)defget_user(svcs_container:Container)->int:returnsvcs_container.get(int)registry=Registry()registry.register_factory(int,lambda:10)svcs_plugin_config=SvcsPluginConfig(registry=registry)svcs_plugin=SvcsPlugin(svcs_plugin_config)app=Litestar([get_user],plugins=[svcs_plugin])ConfiguringYou can pass in theregistryinstance, as in the example, to the config or you can give it a callable (sync or async) and it will be used to create the registry when the app is starting.You can give a custom name to the name of the kwarg for injecting the containers by setting a different value forcontainer_dependency_key(default issvcs_container).NOTE: Youcannotconfigure the name of the kwarg which injects the registry (the kwarg name issvcs_registry).
Package: litestar-users
litestar-usersEffortlessly add secure authentication to yourLitestarapplication.FeaturesSession, JWT and JWTCookie authentication backendsCustomizable pre- and post-operation hooksOptional RBAC (Role based access control)Pre-configured route handlers for:AuthenticationRegistration and verificationPassword recoveryAdministrative user and role managementGetting startedInstallationpip install litestar-usersDocumentationRead the documentationOtherwisecheck out the examples
Package: litestar-utils
litestar-utilsUtilities for theLitestar framework.Source Code:https://github.com/Alurith/litestar-utilsFeatures:This package include some utilities I generaly use in my projects:Timing Middleware: Basic timing for each requestSlugify: Basic slugify function with customizable optionsInstallation:$pipinstalllitestar-utilsor$poetryaddlitestar-utilsUsage:Timing Middleware:Use thecreate_timing_middlewarefunction to create the middleware, the only required argument isemit.emitmust be a callable that accept 2 arguments aRequestand afloatfromlitestarimportLitestar,getfromlitestar_utilsimportcreate_timing_middleware@get("/")asyncdefhello_world()->str:return"Hello, world!"@get("/base",exclude_timing=True)asyncdefbase_all()->str:return"All your base are belong to us"app=Litestar([hello_world,base_all],middleware=[create_timing_middleware(emit=print)],)Slugify:Use theSlugifyOptionsclass to customize the behaviour.classSlugifyOptions(BaseModel):collapse_whitespace:bool=Truedisallowed_characters:str=r"[^\w\s-]"separator:str="-"replacements:List=[]Simple example:fromlitestar_utilsimportslugify,SlugifyOptionsexpected="this-is-easy"input_string="this is easy"assertslugify(input_string)==expectedDon't collaps whitespaces (default toTrue):fromlitestar_utilsimportslugify,SlugifyOptionsexpected="should--not---collapse----whitespaces"input_string=" should  not   collapse    whitespaces  "options=SlugifyOptions(collapse_whitespace=False)assertslugify(input_string,options=options)==expectedCustom separator (default to-):fromlitestar_utilsimportslugify,SlugifyOptionsexpected="this.is.easy"input_string="this is easy"options=SlugifyOptions(separator=".")assertslugify(input_string,options=options)==expectedReplacements:fromlitestar_utilsimportslugify,SlugifyOptionsexpected="emailatexmapledotcom"input_string="email@exmaple.com"options=SlugifyOptions(replacements=[("@","at"),[".","dot"]])assertslugify(input_string,options=options)==expectedHTTPS Redirect Middleware:Use theHTTPSRedirectMiddlewaremiddleware to redirect all the incoming requests fromhttporwstohttpsorwss.Ported fromstarlette HTTPSRedirectMiddlewarefromlitestarimportLitestar,getfromlitestar_utilsimportHTTPSRedirectMiddleware@get("/")asyncdefhello_world()->str:return"Hello, world!"@get("/base",exclude_timing=True)asyncdefbase_all()->str:return"All your base are belong to us"app=Litestar([hello_world,base_all],middleware=[HTTPSRedirectMiddleware],)
Package: litesvg
litesvg packageThis package provides tools to make svg objects (file or in a web page) with rectangles, ellipses, polygons and texts.Installationpip install litesvgFirst programfromlitesvgimportLiteSvg,Rectangle,Textsvg=LiteSvg(width=500,height=200)rect=Rectangle(x=50,width=400,y=50,height=100,rx=8)rect.style.set(fill='#FFB030',stroke='#0060FF',stroke_width=10)svg.add(rect)text=Text(x=250,y=130,text='LITESVG')text.style.set(font_size=80,font_weight='bold',text_anchor='middle',fill='#0060FF')svg.add(text)print(svg.render())This program should print<?xml version="1.0" encoding="UTF-8" standalone="no"?><svgwidth="500mm"height="200mm"viewBox="0 0 500 200"><rectx="50"y="50"rx="8"ry="8"width="400"height="100"style="fill:#FFB030;stroke:#0060FF;stroke-width:10"/><textx="250"y="130"id="text"style="fill:#0060FF;stroke:none;stroke-width:0.1;text-anchor:middle;font-family:sans-serif;font-weight:bold;font-size:80">LITESVG</text></svg>and if you replace the last line of the program bysvg.render('first_program.svg')A file namedfirst_program.svgis created containing the xml text above.By opening it with Inkscape, for example, you will see the picture below.Second programfromlitesvgimportLiteSvg,Rectanglesvg=LiteSvg(config='litesvg.json',width=400,height=400,y_up=True)Rectangle.set_default(width=44,height=44,anchor='center',rx=8)forjinrange(8):foriinrange(8):r=Rectangle(x=25+50*i,y=25+50*j)r.style.set(fill='#{:02X}{:02X}80'.format(32*i,32*j))svg.add(r)svg.render('colors.svg')
Package: litesync
LiteSync for Python3This is a wrapper library to useLiteSyncon Python 3It is based onpysqlite3Additional features:  (compared to Python's sqlite3 module)User-defined window functions (requires SQLite >= 3.25)Flags and VFS an be specified when opening connectionIncremental BLOB I/O,bpo-24905Improved error messages,bpo-16379Simplified detection of DML statements viasqlite3_stmt_readonly.Sqlite native backup API (also present in standard library 3.7 and newer).InstallationYou must install some LiteSync library for this one to work. It can be either
pre-compiled binaries or you can compile it by yourself. You can start with
thefree version.Installing with pippip install litesyncCloning and BuildingOptionally you can clone the repo and build it:git clone --depth=1 https://gitlab.com/litesync/litesync-python3
cd litesync-python3
python3 setup.py build installUsageimportlitesyncimportjsonimporttimeconn=litesync.connect('file:app.db?node=secondary&connect=tcp://server:port')# check if the db is readywhileTrue:result=conn.cursor().execute("PRAGMA sync_status").fetchone()status=json.loads(result[0])ifstatus["db_is_ready"]:breaktime.sleep(0.250)# now we can use the db connection...
Package: litesync-app
LiteSync for Python3This is a wrapper library to useLiteSyncon Python 3It is based onpysqlite3Additional features:  (compared to Python's sqlite3 module)User-defined window functions (requires SQLite >= 3.25)Flags and VFS an be specified when opening connectionIncremental BLOB I/O,bpo-24905Improved error messages,bpo-16379Simplified detection of DML statements viasqlite3_stmt_readonly.Sqlite native backup API (also present in standard library 3.7 and newer).InstallationYou must install some LiteSync library for this one to work. It can be either
pre-compiled binaries or you can compile it by yourself. You can start with
thefree version.Installing with pippip install litesyncCloning and BuildingOptionally you can clone the repo and build it:git clone --depth=1 https://gitlab.com/litesync/litesync-python3
cd litesync-python3
python setup.py build
Package: lite-tools
lite-tools特别声明: 目前均为测试版本,主要是探索新功能的，不保证稳定性和性能不出意外会在正式版(1.0.0)的时候修复成稳定版本.项目说明有空随缘更新一下python 3.6+   // 什么年代了 该不会还有人还在用3.6及以下叭 0.4.10.0 版本再次兼容了3.6 3.7 版本Installationpipinstalllite-tools命令行指令lite-tools[-h]# 可以获取帮助 我这里就不展示更多了真的懒得写文档 直接看源码 直接点这里__init__.py还有稍微详细的查询工具网站，持续更新的lite-tools或者部分demo见demo.py
Package: litexcnc
Welcome to LiteX-CNC!This project aims to make a generic CNC firmware and driver for FPGA cards which are supported by LiteX. Configuration of the board and driver is done using json-files. The supported boards are the Colorlight boards 5A-75B and 5A-75E, as these are fully supported with the open source toolchain.RV901TAlthough the RV901T is also supported by Litex, the firmware cannot be automatically build with LitexCNC, as it requires the Xilinx-software to compile the Verilog to a bit-stream. LitexCNC can be used to create the Verilog and the driver will work when the bit-stream is loaded on the board. However, there is a gap in the toolchain not covered. There are known issues with the compantibility of Litex with Xilinx.The idea of this project was conceived by ColorCNC byromanetzon the official LinuxCNC and the difficulty to obtain a MESA card.AcknowledgementsThis project would not be possible without:ColorCNC byromanetzlink;HostMot2 (MESA card driver) as the structure of the driver has been adopted.Quick startLitexCNC can be installed using pip:pipinstalllitexcnc[cli]NOTE: Suffix[cli]required!The suffix[cli]is required to install the command-line interface. Without this suffix the scripts referenced below will not work.After installation of LitexCNC the following scripts are available to the user:litexcncinstall_driver
litexcncinstall_litex
litexcncinstall_toolchain
litexcncbuild_driverFor a full overview on how to use the commands, please refer to thedocumentation <https://litex-cnc.readthedocs.io/en/stable/>_.
Package: litex.cxpool
litex.cxpool - a SQLAlchemy pool with native Oracle session poolingCxOracleSessionPool is a subclass of SQLAlchemy’s NullPool, with functionality close
to QueuePool. It’s major selling point is the ability to run in proxy authentication
mode. In this mode, the session pool is constructed with one set of credentials and
individual connections can by acquired from it, authenticated for a different user.It’s being used in Pyramid applications interfacing with an ERP system with all logic,
auditing and security contained in Oracle DB stored procedures.Example usage:>>> from litex.cxpool import CxOracleSessionPool
>>> def get_user():
...     return 'REAL_USER'get_user is a callable returning login of a user we would like to connect as.
To connect to db as currently authenticated user in Pyramid, this
function could look like the one below (prefix is used to find the right type of principals,
and exclude the system. ones e.g. system.Everyone):>>> from pyramid.threadlocal import get_current_request
>>> from pyramid.interfaces import IAuthenticationPolicy
>>> prefix = 'example.'
>>> def get_user():
...     req = get_current_request()
...         auth = req.registry.queryUtility(IAuthenticationPolicy)
...         prc = [pr for pr in auth.effective_principals(req) if pr.startswith(prefix)]
...         if prc:
...             return prc[0].split('.')[-1]
...         else:
...             return NoneHaving the user source, we can construct the pool:>>> pool = CxOracleSessionPool(
...    'oracle://proxy_user:proxy_password@test_server/test',
...    min_sessions=1,
...    max_sessions=5,
...    increment=1,
...    user_source=get_user
... )First parameter is a database URL with proxy user credentials.min_sessions controls, how many sessions are constructed initially (in contrast to SA QueuePool this pool precreates sessions)max_sessions sets the upper cap of constructed sessions count (think about it as QP pool_size + max_overflow)increment sets how many sessions to create when current session count is too low (up to max_sessions)To allow REAL_USER to connect to the db through PROXY_USER, one have to issue the following statement as DBA:sql> alter user REAL_USER grant connect through PROXY_USER;Having the pool ready, we can construct a SQLAlchemy engine>>> from sqlalchemy import create_engine
>>> engine = create_engine('oracle://', pool=pool)and use it as any other SA engine:>>> conn = engine.connect()
>>> res = conn.execute('select user from dual')
<sqlalchemy.engine.base.ResultProxy object at 0x1670b50>
>>> res.fetchone()
(u'REAL_USER',)Changes:1.1Compatibile with SQLAlchemy 1.3Python 3 compatibilitytests are using py.test and tox now1.0.3Handling network problems1.0.2SQLAlchemy 0.7 compatible1.0.1namespace package specificationvarious packaging errors1.0initial release
Package: litex.novitus-xml
litex.novitus_xmlDriver for a Polish fiscal printer with Novitus XML protocolFiscal printeris afiscal memory deviceused to record retail sales in Poland and few other countries in the world (eg. Russia, Czechia).This library implements parts ofXML protocolof one of the major Polish manufacturersNovitus.Printing receipt example (for more, see tests):fromlitex.novitus_xmlimportPrinter# uses USB device autodetection and no checksumming by default# for more url examples, see PySerial documentation# https://pyserial.readthedocs.io/en/latest/url_handlers.htmlprinter=Printer(url='hwgrep://.*Novitus.*')printer.receipt_begin()printer.item(name='First product',quantity=2,quantityunit='pcs',ptu='A',price=4)printer.item(name='Second product',quantity=4,quantityunit='pcs',description='A long description',ptu='A',price=2)printer.receipt_close(total=16.0,systemno='1/TEST/2020',checkout='10',cashier='John Doe')
Package: litexplore
litexploreThe current options to explore remote SQLite databases require running a service
on the remote and make it listen on some port. Another option is SSH'ing to the
remote instance and use the SQLite CLI to explore the database.Litexploreis a
Python web app that lets you explore remote SQLite databases over SSH
connections without having to copy the full DB or manually use the CLI.It works by sending commands over an SSH connection. The connection is
multiplexed and it's reused to send commands. This reduces the overhead of
openning a new SSH connection to send each command.NOTE:litexploreis still in an early beta state. It works and it's usable,
but there may be signficant changes happening.Requirementspython 3.7 or higherpydanticfastapiuvicornJinja2python-multipartInstallationCreate a virtual envpython3-mvenv.venvActivate the venv and install the dependenciessource.venv/bin/activate
python3-mpipinstalllitexploreRun the programlitexploreOpen your browser athttp://127.0.0.1:8000Note: even though the server uses0.0.0.0as the default host, open the browser at127.0.0.1. Otherwise, cookies won't work and they're used to store the user config.Runlitexplore --helpto see other available options.UsingpipxInstalllitexplorepipxinstalllitexploreRun it:litexploreUsageThe main page is a form with 3 inputs.The first input us the SSH host name as defined in your~/.sshconfig`The second input is the path to an SQLite database in the remote hostThe third (optional) input is a path to an SQLite CLI. Some pre-installed sqlite3 CLIs have not been compiled
with support for the-jsonflag, whichlitexploreuses.How it worksSeethis blog postRoadmapSeeroadmap issues
Package: litex.regon
litex.regon - a frontend for Polish REGON databaseSimple, pythonic wrapper for REGON database (web frontend is reachable athttps://wyszukiwarkaregon.stat.gov.pl/appBIR/index.aspx). To access its SOAP
API, one needs an USER_KEY issued by REGON administrators available atRegon_Bir@stat.gov.pl.Usage example below:>>>fromlitex.regonimportREGONAPIREGONAPI accepts one argument: service URL (provided by REGON Administrators).>>>api=REGONAPI(SERVICE_URL)First, one needs to log in (using provided user key)>>>api.login(USER_KEY)After login, one can start querying the database. The search method
accepts the following parameters:regon- single REGON number (either 9 or 14 digits long)krs- single 10 digit KRS numbernip- single NIP (10 digits string)regons- a collection of REGONs (all of them have to be either 14 or 9 digits long)krss- a collection of KRSsnips- a collection of NIPsOnly one parameter is used in the query. If multiple ones are passed, first
from the above list is taken into account.Additionally, adetailedparameter can be passed:detailed=Truecauses search method to
fetch default detailed report.>>>entities=api.search(nip='9999999999')entitiesis a list of LXML objectify objects wrapping the search results (up to 100).
If search was called withdetailed=True, the full report is available as thedetailedattribute.If one knows the REGON of a business entity and an detailed report name, a full report can be fetched
directly:>>>detailed_report=api.full_report('99999999','PublDaneRaportFizycznaOsoba')Summary report with a list of REGONs for the given criteria can be fetched by:>>>summary_report=api.summary_report('2020-01-01','BIR11NowePodmiotyPrawneOrazDzialalnosciOsFizycznych')Report names can be found in the documentation provided by REGON admins.Changes1.0.7compatibility with requests >= 2.28 (thanks to @wolkiewiczk for spotting this)1.0.6more meaningful error messages in search method (thanks @m-ganko)summary reports (also kudos to @m-ganko)1.0.5reworked REGON cleanup logic (in search function, when fetching detailed report)search method now uses DaneSzukajPodmioty (API version 1.1) call instead of DaneSzukaj
(thanks to @kicaj for pull request)1.0.4migration from nose to py.testtox configuration for Python 2 and 3 testingimproved handling of detailed reports (thanks to @miloszsobiczewski for logging an issue)1.0.3Python 3.6 compatibility (thanks to Mariusz Witek)1.0.2CAPTCHA removal -- no longer needed in current API1.0.1detailed report fetching logic reworked1.0.0initial release
Package: litext
litextLightweight and fast full-text search engine. Built on top of SQLite.Why?Installationpip install litextAlternativesExamplesMetaRicardo Ander-Egg Aguilar –@ricardoanderegg–ricardoanderegg.comgithub.com/polyrandlinkedin.com/in/ricardoandereggDistributed under the --- license. SeeLICENSEfor more information.ContributingThe only hard rules for the project are:No extra dependencies allowed