Saravanan666/pypi-org huggingface dataset:
Package: light-pipe
Light-Pipe makes data processing pipeline development quick and painless. It is an extensible, light-weight Python framework with zero non-standard dependencies for data pipelines that scale effortlessly. It abstracts away the implementation details of the pipeline itself, meaning that the developer only has to define the transformations performed within the pipeline on individual units of data.Pipelines defined using Light-Pipe scale effortlessly, with native support for all forms of concurrency, allowing for the mixing and matching of asynchronous, multi-threaded, and multi-process operations all within a single pipeline. It’s also super fast and efficient, having been used to perform critical geospatial data processing tasks at least an order of magnitude faster than existing systems.Light-Pipe is released under a BSD-3-Clause License.
Package: light-process
Python multiprocessing.Process that does not need to import __main__.Normally python multiprocessing using the __main__ module to create and initiallize the process. The LightProcess
allows you to change what module is used to create and initialize the process. By default the LightProcess uses
the module that calls LightProcess.start()Example# readme_module.pyimportlight_processaslpimportmultiprocessingasmpdefrun():print('readme_module')defrun_light_process():proc=lp.LightProcess(target=run)proc.start()proc.join()defrun_multiprocessing():proc=mp.Process(target=run)proc.start()proc.join()Multiprocessing works by using the __main__ module to import and seutp the environment for multiprocess. Using the
multiprocessing.Process requires you to put your multiprocessing code in “if __name__ == ‘__main__’:”. This can be shown
in the following example.# readme_main_multiprocessing.pyimportreadme_moduleprint('__main__')if__name__=='__main__':print("if __name__ == '__main__':")readme_module.run_multiprocessing()# Output:# __main__# if __name__ == '__main__':# __main__# readme_module## Note:# '__main__' and 'readme_module' will be printed# '__main__' will be printed twice, because this module is imported in the other processThe main takeaway form this is that the main module is imported twice and requires you to run you multiprocessing code
in the “if __name__ == ‘__main__’:” block.LightProcess was made to remove __main__ from being imported. I have large applications that use multiprocessing. I do
not need to load the entire enviroment for the process. I simply need one small module to be imported and run.
The example below shows how you can run the processes in __main__ and how it doesn’t import __main__ in the new process.# readme_main_light_process.pyimportreadme_moduleprint('__main__')# Do not need "if __name__ == '__main__':"readme_module.run_light_process()# Output:# __main__# readme_module## Note:# '__main__' and 'readme_module' will be printed# '__main__' will only be printed once
Package: light-progress
This is a progress reporting tool for Python.ProgressBar.iteration(range(42),lambdaitem:sleep(0.01))# [▉..............................] 1% (1/42)# [███████████████▉...............] 50% (21/42)# [███████████████████████████████] 100% (42/42)Installationpipinstalllight-progressExamplesImportfromtimeimportsleepfromlight_progressimportProgressBarPattern 1Callstart()forward()andfinish()yourself.n=42progress_bar=ProgressBar(n)progress_bar.start()foriteminrange(n):sleep(0.01)progress_bar.forward()progress_bar.finish()Pattern 2You can execute a iteration withinwithstatement. You don’t have to
callstart()andfinish()explicitly.n=42withProgressBar(n)asprogress_bar:foriteminrange(n):sleep(0.01)progress_bar.forward()Pattern 3Transfer iteration. You don’t have to call anyProgressBarmethods
yourself.ProgressBar.iteration(range(42),lambdaitem:sleep(0.01))Pattern 4Transfer generation. You don’t have to call anyProgressBarmethods
yourself.foriteminProgressBar.generation(range(42)):sleep(0.01)ColorsstatuscolorIn progressBlueSuccessGreenFailureRedCustomizefromlight_progressimportColors,MessageTypecolors={MessageType.COURSE:Colors.YELLOW,MessageType.COMPLETE:Colors.BLUE,}ProgressBar.iteration(range(100),lambdaitem:sleep(0.01),colors=colors)WidgetsProgressBarcan change its display format usingwidget.fromlight_progressimportwidgetwidgets=[widget.Bar(bar='=',tip='-'),widget.Percentage(),widget.Num()]ProgressBar.iteration(range(42),lambdaitem:sleep(0.01),widgets=widgets)# [===============-...............] 50% (21/42)widgets=[widget.Percentage(),widget.Num(),'loading...',widget.Bar(bar='#',tip='>')]ProgressBar.iteration(range(42),lambdaitem:sleep(0.01),widgets=widgets)# 50% (21/42) loading... [###############>...............]Formatsformat_str='{}{}({})'widgets=[widget.Bar(),widget.Percentage(),widget.Num()]ProgressBar.iteration(range(100),lambdaitem:sleep(0.01),widgets=widgets,format_str=format_str)# [███████████████████████████████] 100% (100/100)format_str='{}***{}*** ({})'widgets=[widget.Bar(),widget.Percentage(),widget.Num()]ProgressBar.iteration(range(100),lambdaitem:sleep(0.01),widgets=widgets,format_str=format_str)# [███████████████████████████████] *** 100% *** (100/100)Print textfromlight_progressimportputsforiteminProgressBar.generation(range(42)):sleep(0.01)puts('item{}'.format(item))# ...# item 17# item 18# item 19# [███████████████▉...............] 50% (21/42)
Package: lightprop2d
Light propagationLightprop2d includes class 'Beam2D' to transform intitial field distribution
using fourier transform from x-y field profile to kx-ky spectrum.
You can use both numpy and cupy backends withuse_gpukey of Beam2D class.You can install it as followspip install lightprop2d==1.0.4If you want to usecupyto accelerate calculations, you must install extra packages with a commandpip install lightprop2d[gpu]If you want to usepyfftwto accelerate calculations, you must install extra packages with a commandpip install lightprop2d[fftw]Check out theCode Referencefor details on the 'Beam2D' methods.Example 1: Random beam propagationimportmatplotlib.pyplotaspltfromlightprop2dimportBeam2D,random_round_hole,um,nm# All input data are in cm# XY grid dimensionsnpoints=256# XY grid wideningbeam_radius=25*um# 25 umarea_size=200*um# 200 um# Wavelength in cmwl0=632*nmbeam=Beam2D(area_size,npoints,wl0,init_field_gen=random_round_hole,init_gen_args=(beam_radius,))plt.imshow(beam.iprofile)plt.show()beam.propagate(100*um)plt.imshow(beam.iprofile)plt.show()FundingThis work is supported by the Russian Science
Foundation under grant No. 21-12-00155.
Package: lightprotobuf
lightprotobufIntroductionlightprotobuf is a full Python 3 implementation of the Protocol Buffers as described by Google.DocumentationThe main class to use is lightprotobuf.MessageIt must be the base class of every messages you define. The rest follows the .proto design:This message:enum FooEnum {
   FIELD = 5;
   FIELD2 = 6;
}

message FooMsg {
   required int32 foo_field = 1;
   optional FooEnum foo_enum = 2;
   enum BarEnum {
      FIELD = 5;
      BAR = 6;
   }
   required BarEnum bar_enum = 3;
   repeated string foo_rep = 4;
   repeated int32 foo_pak = 5 [packed=true];
}

message BarMsg {
   required FooMsg.BarEnum bar_enum = 1;
}Is translated in python to:from enum import IntEnum
from lightprotobuf import *
class FooEnum(IntEnum):
     FIELD = 5
     FIELD2 = 6

class FooMsg(Message):
     class BarEnum(IntEnum):
             FIELD = 5
             BAR = 6
     foo_field = Field(1, Int32, Field.REQUIRED, **{})
     bar_enum = Field(3, BarEnum, Field.REQUIRED, **{})
     foo_enum = Field(2, FooEnum, Field.OPTIONAL, **{})

class BarMsg(Message):
     bar_enum = Field(1, FooMsg.BarEnum, Field.REQUIRED, **{})As you can see, the fields follow this template<name> = Field(<tag number>, <type>, Field.<REQUIRED|OPTIONEL|REPEATED>, **{<options as a dict (optional)>}Enums are python’senum.IntEnumNested types are real python nested types referenced just like in .protoAPIThe fields are actually transformed as attributes via descriptors. So you can access fields easily:m = FooMsg()
m.foo_field = 5
m.foo_field # returns 5
m.foo_enum = 5 # Error because it expects a FooEnum object
m.foo_enum = FooEnum.FIELD # OK
m.bar_enum = FooMsg.BarEnum.BAR # OKRepeated fields atc like a list:m.foo_rep = ["a string", "another"] # OK
li = m.foo_rep # Get a reference to the list
li.append("a string") # OK, append the string
li.append(b'a bytes') # TypeError because there is a check to avoid mistakesNote : packed fields are able to decode either data packed either multiple occurence of the field e.g. the test case:class Repeated(Message):
        r = Field(1, Int32, Field.REPEATED, packed="True")
nb = [1,150,1,2,3,150]
b = io.BytesIO(b'\x0C\x08\x01\x08\x96\x01\x0A\x05\x01\x02\x03\x96\x01')
m = Repeated.from_stream(b)
self.assertEqual(list(m.r), nb)
# 0C (12) bytes following
# 08 = 1 << 3 | 0
# varints etc.
# 0A = 1 << 3 | 2
# 05 bytes following
# concatened varints etc.To encode a message, lightprotobuf uses stream objects : each DataType has ato_streamandfrom_streamclass method. Just to call it from a message to encode/decode a message:import io
s = io.BytesIO()
Message.to_stream(s, m)
s.getvalue() # b'\x06\x08\x05\x10\x05\x18\x06'

m = FooMsg()
s = io.BytesIO(b'\x06\x08\x05\x10\x05\x18\x06')
m = Message.from_stream(s)_Note_ : if required field is missing, it raises a FieldNotOptional exceptionRelease Notes1.0.b3WARNING : module moved at top-level. Useimport lightprotobufrather thanfrom lightprotobuf import lightprotobufAdd support for repeated fields, packed and not packed1.0.b2Remove DESCRIPTION.rst because duplicate of README.rst
Package: lightprotobufgen
lightprotobufgenIntroductionlightprotobufgen is a commandline tool based on antlr4.5 to generatelightprotobufcompatible messages from a*.protofile.usagelightprotobufgen <file.proto>The script output on stdout it’s resultCurrent limitationsThe tool is still in developpment and some features of official .proto format are not implemented yet :import : imports statments generates an exception. you still can merge manually different filesglobal options : the global options are not supported yetunique enum : will be implemented in next releaseextends : Message extend are not implemented since it’s mostly usefull with imports and they are not supported yetpackages : Like google official implementation, it won’t be implemented because python use the file paths as modules/packageThe 1.0 release will implement the full .proto specifications.Release notes1.0.dev2Remove DESCRIPTION.rst because duplicate of README.rst1.0.dev1Comments added to the grammarCorrection of the syntax of negated set in the grammar
Package: lightpush
lightpush这是对ServerChan和PushBear服务的一个简单封装，能够通过微信向用户或用户组推送消息提醒。适用的场景有异常警报、事件提醒、消息推送等。之所以做这个封装是因为py里每次调用requests有点丑 :)This is a simple package forServerChanandPushBear.ServerChanandPushBearare free services for you to push notifications to WeChat.lightpushis a simple wrapper for those services.You can install lightpush bypipinstalllightpush--userAnd it is very convenient to use lightpush (like ServerChan)fromlightpushimportlightpushlgp=lightpush()# For ServerChanlgp.set_single_push("Your Key")lgp.single_push("Hello World","This is a msg from lightpush.")# For PushBearlgp.set_group_push("Your Key")lgp.group_push("Hello World","This is a msg from lightpush.")Blog for lightpush
Package: light-qiwi
Light_QiwiLight_Qiwi– Python модуль для написания скриптов для Qiwi (qiwi.com) (API wrapper)ДокументацияПримеры использованияДокументация по APIfromlight_qiwiimportQiwiapi=Qiwi('00000000000000000000000000000000','+70123456789')# Получение ссылки для оплатыprint(api.get_pay_url(100.5,'тут коммент','а тут номер куда переводить, если не передан, то береётся из объекта созданного'))# >>> https://qiwi.com/payment/form/99?extra['account']=..."""Первый параметр - указать интервал обновления (по ум. 3 сек.)Второй параметр - количество операций в 1 запросе (по ум. 25)Третий параметр - тип операции Получение\Отправка денег или Все(по ум. только получение денег)"""@api.bind_check(5,5)defreceive(payment):ifpayment.account=="79000000000":api.pay(payment.account,payment.amount,"Забери свои грязные деньги!")api.start()Установка$ pip install light_qiwiОбновление$ pip install --upgrade light_qiwiАвторВопросы задавать сюда или вissue:VKTelegram
Package: lightqueue
lightqueue is a lightweight job queue that processes jobs (Python
function calls) from a queue located inside a Redis database.To install it:$ pip install lightqueueAfter you have lightqueue (and Redis) installed, you are ready to start queueing jobs.
Say you have a function like this in a module calledmymoduledef myfunc(num):
  print sum([x for x in range(num)])To add the execution of this function as a job into lightqueue:>>> from lightqueue.queue import Queue
>>> from mymodule import myfunc
>>> q = Queue()
>>> q.enqueue(myfunc, 9999) # add the job myfunc(9999) to the queue
>>> q.enqueue(myfunc, 1234567) # add the job myfunc(1234567) to the queueTo start processing these jobs, type this in a shell prompt:$ lightqueue startChange db serverBy default, lightqueue adds jobs to and processes jobs from the Redis server
located at localhost:6379 on db=0.  To change any of these settings:>>> Queue q = Queue(host='myredishost', port=7323, db=4)Then give the lightqueue process the same settings:$ lightqueue start -host myredishost -port 7323 -db 4Parallel ProcessingBy default, lightqueue processes one job from the queue at a time.
To process more than one job at once (let’s say 4), start up lightqueue
with the following command-line args:$ lightqueue start -e parallel -workers 4This uses the Python multiprocessing module so be aware of all of the usual
caveats of parallel processing.
Package: lightrail-jupyterlab
lightrail_jupyterlabConnect JupyterLab to Lightrail AIRequirementsJupyterLab >= 4.0.0InstallTo install the extension, execute:pipinstalllightrail_jupyterlabUninstallTo remove the extension, execute:pipuninstalllightrail_jupyterlabContributingDevelopment installNote: You will need NodeJS to build the extension package.Thejlpmcommand is JupyterLab's pinned version ofyarnthat is installed with JupyterLab. You may useyarnornpmin lieu ofjlpmbelow.# Clone the repo to your local environment# Change directory to the lightrail_jupyterlab directory# Install package in development modepipinstall-e"."# Link your development version of the extension with JupyterLabjupyterlabextensiondevelop.--overwrite# Rebuild extension Typescript source after making changesjlpmbuildYou can watch the source directory and run JupyterLab at the same time in different terminals to watch for changes in the extension's source and automatically rebuild the extension.# Watch the source directory in one terminal, automatically rebuilding when neededjlpmwatch# Run JupyterLab in another terminaljupyterlabWith the watch command running, every saved change will immediately be built locally and available in your running JupyterLab. Refresh JupyterLab to load the change in your browser (you may need to wait several seconds for the extension to be rebuilt).By default, thejlpm buildcommand generates the source maps for this extension to make it easier to debug using the browser dev tools. To also generate source maps for the JupyterLab core extensions, you can run the following command:jupyterlabbuild--minimize=FalseDevelopment uninstallpipuninstalllightrail_jupyterlabIn development mode, you will also need to remove the symlink created byjupyter labextension developcommand. To find its location, you can runjupyter labextension listto figure out where thelabextensionsfolder is located. Then you can remove the symlink namedlightrail-jupyterlabwithin that folder.Packaging the extensionSeeRELEASE
Package: lightRaven
lightRaven -- Offline RL with Maximum SpeedThis library provides convenient tools for people to create their own seldonian algorithms with optimum performance. A detailed example is also included indynamic_training.ipynb. Performance test is inci_performance.ipynb.Dependenciesgym==0.17.3numpy==1.19.1scipy==1.5.2numba == 0.51.2Supplementary MaterialsDefinition of Seldonian FrameworkPreventing undesirable behavior of intelligent machinesHigh Confidence Policy ImprovementDefinition of different Importance Sampling estimatorsHigh Confidence Off-Policy EvaluationDefinition of the new concentration boundA New Confidence Interval for the Mean of a Bounded Random Variable
Package: light-rest-client
# light_rest_client [![Build Status](https://travis-ci.org/mediascopegroup/light_rest_client.svg?branch=master)](https://travis-ci.org/mediascopegroup/light_rest_client)A very lightweight REST client for Python.## Example```pythonfrom light_rest_client.client import Clientfrom light_rest_client.parsers import JSONParserfrom light_rest_client.exceptions import HTTPClientException, HTTPServerExceptiontry:client = Client(url="https://jsonplaceholder.typicode.com", parser=JSONParser())print(client.get("todos/1"))except HTTPClientException:# codeexcept HTTPServerException:# code```## Installation```shellpip install -e git://github.com/mediascopegroup/light_rest_client.git@1.0.2```## License[CDDL](LICENSE)
Package: lightridge
LightRidge is an open-source framework for end-to-end optical machine learning (ML) compilation, which connects physics to system. It is specifically designed for diffractive optical computing, offering a comprehensive set of features (Check out our ASPLOS’23 athttps://arxiv.org/abs/2306.11268): (1) Precise and differentiable optical physics kernels: LightRidge empowers researchers and developers to explore and optimize diffractive optical neural network (DONN) architectures. With built-in, accurate, and differentiable optical physics kernels, users can achieve complete and detailed analyses of DONN performance. (2) Accelerated optical physics computation kernel streamlines the development process and boosts the efficiency of optical ML workflows. (3) Versatile and flexible optical system modeling: LightRidge provides a rich set of tools for modeling and simulating optical systems. Researchers can create complex optical setups, simulate light propagation, and analyze system behavior using LightRidge’s versatile capabilities. (4) User-friendly domain-specific language (DSL): LightRidge includes a user-friendly DSL, enabling users to describe and configure diffractive optical networks easily. The DSL simplifies the implementation process and facilitates rapid prototyping of novel optical ML models. LightRidge website ishttps://lightridge.github.io/lightridge
Package: light-s3-client
PurposeThe AWS Boto3 Client is quite heavy, and usually specific functionality is needed. This module only implements needed functionality uses the requests library and the S3 Resp API.Reference doc used for this creation:https://docs.aws.amazon.com/AmazonS3/latest/API/sig-v4-authenticating-requests.html#signing-request-introNote: The parameter names and function names were copied from the Boto3 S3 Client. It does necessarily have all the options for the functionSupported FunctionsClient.download_file(Bucket, Key, Filename)Download an S3 object to a fileUsage:fromlight_s3_clientimportClients3=Client(region="us-west-1",access_key="REPLACE_ME",secret_key="REPLACE_ME")s3.download_file("mybucket","hello.txt","/tmp/hello.txt")PARAMETERS:Bucket (str)– The name of the bucket to download from.Key (str)– The name of the key to download from.Filename (str)– The path to the file to download to.Client.upload_fileobj(Fileobj, Bucket, Key)Upload a File Object to S3Usage:fromlight_s3_clientimportClientimportjsondefget_file_contents(file_name)->bytes:file_handle=open(file_name,"r")content=json.load(file_handle)str_content=json.dumps(content)file_handle.close()data=str_content.encode("utf-8")returndatas3=Client(region="us-west-1",access_key="REPLACE_ME",secret_key="REPLACE_ME")upload_data=get_file_contents("example.json")s3.upload_fileobj(upload_data,"example-bucket","path/example.json")PARAMETERS:Fileobj (a file-like object)– A file-like object to upload. At a minimum, it must implement the read method, and must return bytes.Bucket (str)– The name of the bucket to upload to.Key (str)– The name of the key to upload to.Client.delete_object(Bucket, Key)Delete a S3 objectUsage:fromlight_s3_clientimportClients3=Client(region="us-west-1",access_key="REPLACE_ME",secret_key="REPLACE_ME")s3.delete_file("example-bucket","path/example.json")PARAMETERS:Bucket (str)– The name of the bucket to upload to.Key (str)– The name of the key to upload to.(Fileobj, Bucket, Key)Client.list_objects(Bucket, Prefix)Lists all keys in an objectUsage:fromlight_s3_clientimportClients3=Client(region="us-west-1",access_key="REPLACE_ME",secret_key="REPLACE_ME")keys=s3.list_objects("example-bucket","prefix")PARAMETERS:Bucket (str)– The name of the bucket to upload to.Prefix (str)– The prefix to use as the search for getting keys from the bucketClient.get_object(Bucket, Key)Returns if an object exists or notUsage:fromlight_s3_clientimportClients3=Client(region="us-west-1",access_key="REPLACE_ME",secret_key="REPLACE_ME")keys=s3.get_object("example-bucket","path/file.txt")PARAMETERS:Bucket (str)– The name of the bucket to upload to.Key (str)– The key to check if it exists in the bucketClient ParameterspropertyRequiredtypedescriptionregionTruestringThe S3 region being used. This ends up as part of the Server URLaccess_keyTruestringThe AWS Access Key for API Accesssecret_keyTruestringThe AWS Secret Key for API AccessserverFalsestringAn override of the HTTPS URL to use. When used thenregionis not used
Package: light-size-constrained-clustering
Size Constrained Clustering SolverImplementation of Deterministic Annealing Size Constrained Clustering.
Size constrained clustering can be treated as an optimization problem. Details could be found in a set of reference paper.This is a fork ofhttps://github.com/jingw2/size_constrained_clusteringthat solves installation issues. And mantains only the Determinstic Annealing clustering.InstallationRequirement Python >= 3.6, Numpy >= 1.13install from PyPIpipinstalllight-size-constrained-clusteringMethodsDeterministic Annealling Algorithm: Input target cluster distribution, return correspondent clustersUsage:Deterministic Annealing# setupfromlight_size_constrained_clusteringimportdaimportnumpyasnpn_samples=40# number cells in spotn_clusters=4# distinct number of cell typesdistribution=[0.4,0.3,0.2,0.1]# distribution of each cell type (form deconv)seed=17print(np.sum(distribution))np.random.seed(seed)X=np.random.rand(n_samples,2)# distribution is the distribution of cluster sizesmodel=da.DeterministicAnnealing(n_clusters,distribution=distribution,random_state=seed)model.fit(X)centers=model.cluster_centers_labels=model.labels_print("Labels:")print(labels)print("Elements in cluster 0: ",np.count_nonzero(labels==0))print("Elements in cluster 1: ",np.count_nonzero(labels==1))print("Elements in cluster 2: ",np.count_nonzero(labels==2))print("Elements in cluster 3: ",np.count_nonzero(labels==3))In case of provided distributions not being respected due to lack of convergence, distribution can
be nforced by using the parameterenforce_cluster_distributionmodel.fit(X, enforce_cluster_distribution=True)Cluster size: 16, 12, 8 and 4 in the figure above, corresponding to distribution [0.4, 0.3, 0.2, 0.1]CopyrightCopyright (c) 2023 Jing Wang & Albert Pla. Released under the MIT License.Third-party copyright in this distribution is noted where applicable.ReferenceClustering with Capacity and Size Constraints: A Deterministic
ApproachDeterministic Annealing, Clustering and OptimizationDeterministic Annealing, Constrained Clustering, and OpthiieationShrinkage ClusteringClustering with size constraintsData Clustering with Cluster Size Constraints Using a Modified k-means AlgorithmKMeans Constrained Clustering Inspired by Minimum Cost Flow ProblemSame Size Kmeans Heuristics MethodsGoogle's Operations Research tools'sSimpleMinCostFlowCluster KMeans Constrained