Saravanan666/pypi-org huggingface dataset:
Package: runtime-context
***************runtime-context***************.. code-block:: shellpip install runtime-context--------------------------``RuntimeContextWrapper`` Example--------------------------.. code-block:: pythonfrom runtime_context import RuntimeContextWrapperruntime_context = RuntimeContextWrapper()def do_something(i):if runtime_context.dry_run:print('{} - dry run'.format(i))else:print('{} - for real'.format(i))with runtime_context(dry_run=False):do_something(1)  # for realwith runtime_context(dry_run=True):do_something(2)  # dry runruntime_context.dry_run = Falsedo_something(3)  # for realwith runtime_context():do_something(4)  # for realruntime_context.dry_run = Truedo_something(5)  # dry rundo_something(6)  # for real-------------------------------``runtime_context_env`` Example-------------------------------.. code-block:: pythonimport jsonfrom typing import Union  # noqafrom runtime_context import EnvBase, runtime_context_env  # noqa@runtime_context_envclass YourApp:dry_run = Falsedb_name = Noneconfig_file = Noneenv = YourApp()  # type: Union[YourApp, EnvBase]@env.context_var_set.listener(predicate=lambda name: name == 'config_file')def reload_config():if not env.config_file:returnprint('Reloading config from {}'.format(env.config_file))with open(env.config_file) as f:config = json.load(f)for k, v in config.items():env.set(k, v)with env():assert env.dry_run is Falseassert env.db_name is Noneenv.config_file = 'config.json'  # prints 'Reloading config from config.json'assert env.db_name == 'products'  # read from config.json filewith env(dry_run=True):assert env.dry_run is True
Package: runtime-environment-capture
Runtime Environment CaptureThis project aims to create a lightweight wrapper around scripts/commands in order to capture details about the program being run for later reproducibility.Supported Runtime OptionsCLIShell (bash, zsh, etc)SlurmSGEInstaling RECREC supports Linux and MacOS, but is primarily geared towards job launchers that are predominantly available on Linux. That being said, some launchers such as Slurm and SGE are not available on MacOS. If you're using a Mac, this likely doesn't mean much to you, but it's worth mentioning.Installing using Pippipinstallruntime-environment-captureRunning RECTo run REC, issue the following command:rec[COMMAND]By default, REC assumes that you will be running and capturing information about a shell command. Thesimplestway to run REC would be as follows:rececho"Hello World"This will run the commandecho "Hello World"as a shell command and will capture information about that command.Changing LauncherTo change the desired launcher from recording a command to recording a more complex job, REC accepts a--launcher/-lflag.
Using this flag, REC can perform launcher specific capture options for supported launchers.
If the job was a Slurm job, REC would launch the job, capture information about the job, and collect information about Slurm itself.
Package: runtime-final
runtime-finalDeclare final Python classes and methods at runtime.This module provides a decorator based interface to declare final
classes and methods. This module is inspired by and is compatible withtyping.final.
SeePEP-591for more
details on this topic.InstallationPython 3.6 or higher is required.You can simply install this module frompip.python -m pip install runtime-finalUsageThe main component of this module is thefinaldecorator that
can be used to decorate classes and methods inside a class. As
such:Classes decorated with @final cannot be subclassed.Methods decorated with @final cannot be overriden in subclasses.For example with classes:fromruntime_finalimportfinal@finalclassFoo:...classBar(Foo):# Raises RuntimeError...And with methods:fromruntime_finalimportfinalclassUser:@finaldefedit(self):...classAnotherUser(User):defedit(self):# Raises RuntimeError...DocumentationFor more details, see thedocumentation
Package: runtime-generics
runtime_genericsHighly into type-safe Python code?runtime_genericsis a niche Python library that allows you to reuse type arguments explicitly passed at runtime
to generic classes before instantiation.The library does three things:makes it possible to retrieve the type arguments passed to the generic class at runtime
before the class was instantiated;given a parametrized generic class (generic alias),
it makes every class method use generic aliasclsinstead of the origin class;offers facilities to find how parent classes are parametrized,
so e.g. ifFoo[T]inherits fromDict[str, T],
find thatDict[str, int]is a parent forFoo[int].A simple example3.12+ (PEP 695syntax):fromruntime_genericsimportget_type_arguments,runtime_generic@runtime_genericclassMyGeneric[T]:type_argument:type[T]def__init__(self)->None:(self.type_argument,)=get_type_arguments(self)@classmethoddefwhoami(cls)->None:print(f"I am{cls}")my_generic=MyGeneric[int]()assertmy_generic.type_argumentisintmy_generic.whoami()# I am MyGeneric[int]3.8+:from__future__importannotationsfromtypingimportGeneric,TypeVarfromruntime_genericsimportget_type_arguments,runtime_genericT=TypeVar("T")@runtime_genericclassMyGeneric(Generic[T]):type_argument:type[T]def__init__(self)->None:(self.type_argument,)=get_type_arguments(self)@classmethoddefwhoami(cls)->None:print(f"I am{cls}")my_generic=MyGeneric[int]()assertmy_generic.type_argumentisintmy_generic.whoami()# I am MyGeneric[int]InstallationYou might simply install it with pip:pipinstallruntime-genericsIf you usePoetry, then you might want to run:poetryaddruntime-genericsFor contributors[!Note]
If you use Windows, it is highly recommended to complete the installation in the way presented below throughWSL2.Fork theruntime_generics repositoryon GitHub.Install Poetry.Poetry is an amazing tool for managing dependencies & virtual environments, building packages and publishing them.
You might usepipxto install it globally (recommended):pipxinstallpoetryIf you encounter any problems, refer tothe official documentationfor the most up-to-date installation instructions.Be sure to have Python 3.8 installed—if you usepyenv, simply run:pyenvinstall3.8Clone your fork locally and install dependencies.gitclonehttps://github.com/your-username/runtime_genericspath/to/runtime_genericscdpath/to/runtime_generics
poetryenvuse$(cat.python-version)poetryinstallNext up, simply activate the virtual environment and install pre-commit hooks:poetryshell
pre-commitinstallFor more information on how to contribute, check outCONTRIBUTING.md.Always happy to accept contributions! ❤️Legal info© Copyright by Bartosz Sławecki (@bswck).This software is licensed under the terms ofMIT License.
Package: runtime-keypath
Python Key-pathSupports runtime key-path recording/accessing for Python.from__future__importannotationsfromruntime_keypathimportKeyPath,KeyPathSupportingclassA(KeyPathSupporting):def__init__(self)->None:self.__b=B()@propertydefb(self)->B:returnself.__bclassB(KeyPathSupporting):def__init__(self)->None:self.__c=C()@propertydefc(self)->C:returnself.__cclassC:passa=A()key_path=KeyPath.of(a.b.c)assertkey_path.targetisaandkey_path.keys==("b","c")assertkey_path()isa.b.c
Package: runtimeponyo
Runtime Ponyoalexh212- Alex Hmittias13909- Aaron SteinRafinator123- Rafael Nadal-Scalajk021227- Jhon KimTimes the execution of functions while providing users to save and display recorded runtimes.InstallationImport the provided functions frommain.pyinto your Python script.from  package_main.main  import  *Functionalities@trackerWhen this decorator is applied to a function, Runtime Ponyo begins to time that functions execution.@tracker_printWhen this decorator is applied to a function, Runtime Ponyo begins to time that functions executionanddisplays the runtime upon completion.'print_all_runtimes()'All runtimes recorded are displayed.This only print the runtimes of functions that have been completed and trackedpriorto the call of this  function.save_to_file(file.txt)This function saves the recorded runtimes to a specified file. If the file doesn't exist, it will be created with the given name, and the runtime data will be written to it.'entire_runtime()'Calculates and prints the total runtime of the entire program.UsageTo use@tracker_print,  apply the decorator to a  function.@tracker
def  example_function():
	for  i  in  range(1000):
		i  +=  1To use@tracker_print,  apply the decorator to a function.@tracker_print
def  example_function():
	for  i  in  range(1000):
		i  +=  1Insert theprint_all_runtimes()function at the desired location in
your program to use it.analyzed_data  = complex_data_analysis(pd.concat(processed_chunks))

print_all_runtimes() # Track and print function runtimes

log_operations(datetime.now())
print(f"Analyzed Data: \n{analyzed_data}")Insert thesave_to_file()function at the desired location in your
program to use it.with ThreadPoolExecutor(max_workers=4) as  executor:
	future_to_chunk  = {executor.submit(advanced_data_transformation, chunk): chunk  for  chunk  in  chunks}


save_to_file(my_runtimes.txt) # Save recorded runtimes to a specified file

processed_data  = [future.result() for  future  in  future_to_chunk]Insert the'entire_runtime()'function at the desired location in
your program to use it.data  = np.random.exponential(scale=1.0, size=(1000, 2))
df  = pd.DataFrame(data, columns=['id', 'values'])

chunks  = np.array_split(df, 4)

entire_runtime() # Print the total runtime of the programContributingHere are the steps you need to take if you would like to contribute to the project.Fork and Clone the project repositoryInstallpipenvif not already.Usepipenvto install all necessary development dependencies.pipenv install --devSet up a new virtual environment using Python.python -m venv envImport the main package and the specific functions you wish to test into your test file (_tests.pylocated inpackage/tests).Execute your tests using pytest within the pipenv environmentDevelopment PolicyPython 2/3 compatibilityPEP8-compliance (with exceptions)Tests should be passingPackage Link in PyPIhttps://pypi.org/project/runtimeponyo/A little exercise to create a Python package, build it, test it, distribute it, and use it. Seeinstructionsfor details.
Package: runtime-stats
# Runtime Stats for FunctionsPython decorator function to track runtime stats on function calls# Example```@runtime_stats()def self_mult(n):sleep(0.2)return n*nprint(self_mult(10)) # => 100print(self_mult(7)) # => 49print(self_mult.get_func_runtime_stats()) # => {'total_time': 401.668, 'avg': 200.834, 'func_uid': 4302206808, 'func_name': 'self_mult', 'min': 200.445, 'max': 201.223, 'total_calls': 2}```# UsageDecorate a function with `@runtime_stats()` to keep track of that function's runtime (min, max, avg, total_calls, and total_time)# CompatibilityTested compatible with Py2.7 and Py3, but this code is provided as is with no warranty or guarantee, implied or explicit.# More InformationPlease see my blog post here: http://garrens.com/blog/2016/10/21/runtime-stats-for-functions-python-decorator/
Package: runtime-type-checker
runtime-type-checkerThis package performs type-check at runtime with help of type annotations.How to use this packageThere are two ways to perform type checks using this package.I provide a few simple examples here. For a complete overview, have a look at the package's unit tests.1- thecheck_typefunctionYou can check an object against a type or an annotation via thecheck_typefunction.The function returnsNoneif the check was successful or raises aTypeErrorin case of error.Note that this function does not check recursively for e.g. the attributes of a class.fromtypingimportList,Sequence,Optional,Mappingfromdataclassesimportdataclassfromruntime_type_checkerimportcheck_typecheck_type("a",str)# OKcheck_type(["a"],List[str])# OKcheck_type(["a",1],Sequence[str])# raises TypeError@dataclassclassFoo:a:intb:Optional[Mapping[str,int]]=Nonecheck_type(Foo(1),Foo)# OKcheck_type(Foo(1),int)# raises TypeError2- The check_types decoratorYou can also type-check classes upon instance creation and functions or methods upon call through thecheck_typesdecorator:fromtypingimportOptional,Mappingfromdataclassesimportdataclassfromruntime_type_checkerimportcheck_typesdefrun_typed(f):returncheck_types(dataclass(f))@check_types@dataclassclassFoo:a:intb:Optional[Mapping[str,int]]=NoneFoo(1)# returns an instance of fooFoo(0,{"a":"b"})# raises TypeError@check_typesdefbar(a:bool,**options:str)->str:returnoptions.get("b","missing")ifaelse"unknown"bar(True,b="1")# returns "1"bar(True,c=1)# raises TypeErrorPackage features and short-comings1- Featuressimplicity: there's only one function and one decorator to keep in mind.robustness: this package relies on thetyping-inspectfor the heavy lifting. This package is maintained by
core contributors to the typing module, which means very little hacks on my side to work with older versions of python.2- Short-comingscoverage: I don't offer coverage for all features of type annotations: for example Protocol, Generators, IO are not
currently supported. Generics are not really well handled.
Package: run-torch-model
run-torch-modelSimple program to run a pytorch compatible model. Includes a tools function which has support for creating dataloader objects required for training/testing/validation.Requirementstorchtorchmetricsscikit-learnInstallInstall using pip:pip install run-torch-modelUsageUse create_dataloader to initiate datasets for training and testing:from run_torch_model import create_dataloader

dataloader_train, dataloader_test = create_dataloader(features=features, 
                                                      targets=targets,
                                                      batch_size=batch_size,
                                                      train_size=train_size,
                                                      test_size=test_size)To run a model we define the optimizer, its arguments and a criterion, feed into the class and perform a call for training.import torch
from run_torch_model import RunTorchNN

optimizer = 'torch.optim.Adam'  # Must be string, if CUDA we initiate the optimizer after calling .cuda for speed-up
optimizer_args = {'lr': 0.001'} # Initialize some arguments for the optimizer
criterion = torch.nn.MSELoss()

run_model = RunTorchNN(model, # Some pytorch model
                          epochs=100, 
                          optimizer=optimizer,
                          optimizer_args=optimizer_args,
                          dataloaders=(dataloader_train, dataloader_test), 
                          criterion=criterion)
 
run_model() # Executes the trainingTo fetch metrics:R2 = run_model.get_r2score()
loss = run_model.get_average_loss()To evaluate the trained model on a different set of features:predictions, loss = run_model.predict(new_features)To evaluate the model on a validation set:loss, r2 = run_model.evaluate(dataloader_validation)
predictions = run_model.get_predictions()  # To get predictions, if necessary
Package: runviewer
thelabscript suite» runviewerVisualize hardware-timed experiment instructionsrunvieweris a graphical interface for visualising hardware-timed experiments composed using thelabscript suite. runviewer shows you what you have commanded the hardware to do throughout an experiment shot, by plotting annotated, interactive timeseries of outputs and inputs. These traces are reverse engineered (uncompiled) from the hardware instructions produced by labscript, and provide a faithful representation of what the hardware has been commanded to do.Installationrunviewer is distributed as a Python package onPyPIandAnaconda Cloud, and should be installed with other components of thelabscript suite. Please see theinstallation guidefor details.
Package: runway
RunwayRunway is a lightweight integration app designed to ease management of infrastructure tools.Its main goals are to encourage GitOps best-practices, avoid convoluted Makefiles/scripts (enabling identical deployments from a workstation or CI job), and enable developers/admins to use the best tool for any given job.FeaturesCentralized environment-specific configurationAutomatic environment identification from git branchesAutomatic linting/verificationSupport of IAM roles to assume for each deploymentTerraform backend/workspace config management w/per-environment tfvarsAutomatic kubectl/terraform version management per-environmentSupported Deployment ToolsAWS CDKKubectlServerless FrameworkCFNgin (CloudFormation)Static websites (build & deploy to S3+CloudFront)TerraformExampleA typical Runway configuration is unobtrusive -- it just lists the deployment order and locations (regions).deployments:
  - modules:
      - resources.tf  # terraform resources
      - backend.sls  # serverless lambda functions
      - frontend  # static web site
    environments:  # Environments
      dev: "123456789012"  # AWS development Account ID
      prod: "234567890123"  # AWS production Account ID
    regions:
      - us-east-1The example above contains enough information for Runway to deploy all resources, lambda functions and a static website backed by S3 and Cloudfront in either dev or prod environmentsInstallRunway is available via any of the following installation methods. Use whatever works best for your project/team (it's the same application no matter how you obtain it).HTTPS Download (e.g cURL)Use one of the endpoints below to download a single-binary executable version of Runway based on your operating system.Operating SystemEndpointLinuxhttps://oni.ca/runway/latest/linuxmacOShttps://oni.ca/runway/latest/osxWindowshttps://oni.ca/runway/latest/windows$curl-Loni.ca/runway/latest/osx-orunway
$chmod+xrunway
$./runwaynewSuggested use:CloudFormation or Terraform projectsnpm$npmi-D@onica/runway
$npxrunwaynewSuggested use:Serverless or AWS CDK projectspip (or poetry, etc)$pipinstallrunway
$runwaynew# OR$poetryadd--devrunway
$poetryrunrunwaynewSuggested use:Python projectsDocumentationSee thedoc sitefor full documentation.Quickstart documentation, including CloudFormation templates and walkthrough can be foundhere
Package: runway-python
The Runway Model SDK allows you to port new and existing machine learning models to the Runway platform. With a few lines of code, you can modify your Python model to be used and shared by others onRunway.InstallingThe SDK supports Python 3.6+. You can install the module using either pip or pip3 like so:pip3 install runway-pythonNow head over tothe sdk docsto learn how to use the Runway Model SDK.DocsReference and documentation for the Runway Model SDK is hosted atsdk.runwayml.com. These docs provide an overview of how to use the SDK to port your own ML models.TheRunway Model Template repoalso contains a simple example of how to get started porting a model to Runway.See theImporting Models into Runwaytutorialfor a walk-through illustrating how to port a model to Runway.DevelopingIf you'd like to contribute to the development of the Runway Python SDK, you can clone and modify this repository by following the instructions below.gitclonehttps://github.com/runwayml/model-sdkrunway-model-sdkcdrunway-model-sdk## optionally use a virtual environment# virtualenv -p python3 venv && source venv/bin/activate# install dependenciespython3setup.pyinstall# install the dev dependenciesmakedevTestingAutomated tests for the Runway Model SDK are written usingpytestand live in thetests/directory. We also provide support for code coverage viapytest-cov.## Create and activate a python3 virtual environment if you need to.# virtualenv -p python3 venv && source ./venv/bin/activate# make sure you have the development dependencies installedmakedev# run the testsmaketest# by default pytest suppresses stdout and stderr during testing, so run tests# like this if you'd like to see the output from your print() statements during# testingmaketest-debug# to generate coverage statistics while running tests, use this command.# it prints test coverage to the console and also generates a more detailed HTML# report in htmlcov/.makecoverageIf you make a PR against this repo, please be sure to include automated tests to validate that your code works as expected. PRs will be automatically blocked by aCodecovbot if their changes reduce the overall test coverage of the Runway Model SDK package.Building the DocsThe Model SDK documentation is generated from inline source code using docstrings,Sphinx, and a modified Read the Docs HTML theme. The version of Sphinx that we are using (v2.0.1) requires Python 3.## Create and activate a python3 virtual environment if you need to.# virtualenv -p python3 venv && source ./venv/bin/activate# make sure you have the docs dependencies installedmakedev-docs# build the docsmakedocsYour auto-generated HTML docs should now appear indocs/build/html.QuestionsWe have a#model-sdkchannel in our publicSlackworkspace that you can use to ask questions or chat with the Runway team about this Python module. Feel free to open an issue as well!
Package: runweb
RunWebRun web server with one command.Installation$pipinstallrunwebIf you need auto reload, install withreloadextra.$pipinstall"runweb[reload]"UsagewaitressInstall withwaitressextra.$pipinstall"runweb[waitress]"Then run command.$runweb-aapp:wsgiIf you need a multi-process waitress service, just run the following command:$runweb-aapp:wsgi-w4uvicornInstall withuvicornextra.$pipinstall"runweb[uvicorn]"Then run command.$runweb-aapp:asgiIf you need a multi-process uvicorn service, just run the following command:$runweb-aapp:asgi-w4
Package: run-web-pycode
run-web-pycodeA simple package to execute remote python scriptsexample:# run_web_pycode https://raw.githubusercontent.com/AngusWG/run-web-pycode/master/tests/a_script.pypywrunhttps://raw.githubusercontent.com/AngusWG/run-web-pycode/master/tests/a_script.py# set proxypywset_proxyhttphttps://127.0.0.1:9999
pywset_proxyhttp# for unset# get helppyw--help
pywrun--help
pywset_proxy--helppyw is simplified command as run_web_pycodeBlack formatterThis project use black, please setContinuation indent= 4Pycharm - File - Settings - Editor - Code Style - Python - Tabs and IndentsFlake8 lintUse flake8 to check your code style.FeaturesRun code by UrlA simple entry pointpywSet proxypackage to pypiConvert GitHub.com url to <raw.githubusercontent.com> filerun_web_pycode history0.0.0first commit
Package: runwith
This Python library was created to use shell-like input/output direction in a
context where the execution environment doesn’t support shell syntax.  It
provides arunwithexecutable that executes the command of your choice as a
sub-process in an execution environment prepared according to your desires.The original use case is for use ofToxas a task runner.  Since Tox uses a
limited subset of shell capabilities and developers are not interested in
enhancing them (seeCapturing output from commands), I had to wrap some kind
of wrapper script.  I rapidly started reusing in other projects and making it
available onPyPImakes it easy to use like this:[testenv]
deps =
  runwith
commands =
  runwith -o foo.log -- foo
Package: runwsgi
runwsgiA simple runner for Python wsgi application. Like Gunicorn but can run on Windows. It’s to simple, sodo not use at production environment.Installpip install runwsgiUserun command:runwsgi -b 128.0.0.1:8000 -d /home/robin/demo/ -p "robin" demo:appon Windows use:runwsgi.bat -b 128.0.0.1:8000 -d C:\Users\Administrator\Desktop\demo\ -p "robin" demo:appif can’t find runwsgi command, try:python -m runwsgi -b 128.0.0.1:8000 -d /home/robin/demo/ -p "robin" demo:appopen broswer with urlhttp://127.0.0.1:8000Other tips1. -bset bind address2. -dset you wsgi work dir3. -pset environment variable of WSGI_PARAMS, and then you can use "os.environ.get('WSGI_PARAMS')" to get the parameter.4. wsgi applicationmodel:applicationCHANGES0.0.1init version.0.0.2first useable version.