Saravanan666/pypi-org huggingface dataset:
Package: falcon-rpc
Falcon RPCBackgroundA wrapper that utilizes theFalcon Frameworkto create a HTTP RPC API.The motivation for this API is theSlack Web API.NOTE: I suggest being familiar with Falcon and Slack's APIs on your own, first.I found myself creating lots of APIs for various projects and realized that RESTful APIs are not really useful for the type of stuff I work on.  While there is a certain degree of CRUD operations I usually need to do, a lot of the "resources" I created were for kicking of backend processing jobs, running async analytic workloads, executing complex queries, etc.Most of the things I do just don't fit into REST. Frankly, instead of "bending" REST to fit my will I found API's like Slack that seemed perfect for being flexible enough to fit any use case. However, while I was bending REST for my bidding I became really fond of the Falcon Framework. I 100% understand Falcon is designed for REST but guess what, I can do whatever I want so here we are.QuickstartClone the repo and install.cd falcon_rpc
pip install -I .importfalcon_rpcclassTest:"""``test`` method family """defok(self,req):# /test.okreq.resp_body={'foo':'bar'}deferror(self,req):# /test.error# can raise an error at anytimeraisefalcon_rpc.RPCError('dummy_error_code')deffatal(self,req):# /test.fatalnot_a_dict=1not_a_dict['nope']=2# pylint: disable=unsupported-assignment-operation  # noqadefecho(self,req):# /test.echoreq.resp_body={'you_sent':req.params}defwarn(self,req):# /test.warnreq.resp_body={'data':'mostly good'}# setting a warning even though the request was handledreq.set_warning('some_warning')classAnother:defshow_me(self,req):# req.req is the original Falcon Request objectreq.resp_body={'hello_there':req.req.remote_addr}defstart():rpc=falcon_rpc.RPC()rpc.add_family(Test())rpc.add_family(Another())returnrpc()This can be launched just like you would Falcon:$ gunicorn -b :8000 "app:start()" --workers 2 --log-level DEBUG --reloadMethod Families and MethodsInstead of adding routes to your API, you add method families, which are Python classes here.Your API follows the/METHOD_FAMILY.methodstructure like Slack and the name of your Python class corresponds to the method family, and methods of that class are utilized as the actual method being called.It is important to note that method family names are case insensitive, they will always be cast to lowercase.Method names are case sensitive.Method HandlersMethod handlers take one arg, an instance ofRPCRequest.Theresp_bodyattribute of this object can be set with your response data.Like Slack, if your request could be processed, but you need to add a warning, you can do so by using theset_warningmethod.Tests$ pip install -r test-requirements.txt
$ pytest -s -vv --cov falcon_rpc --cov-report=term-missing tests/
Package: falcon-sentry
falcon-sentry--------------Installation------------.. code:: bashpip install falcon-sentryHow to use------------When creating your Falcon application/API instance.Wrap it with falcon-sentry and pass in your Sentry DSN... code:: pythonapplication = falcon.API()application.add_route('/items', MyResource())dsn = 'https://00000000000000000000000000000000@sentry.io/0000000'application = falcon_sentry(dsn=dsn, app=application)return applicationYou can also use an environment variable to specify the DSN... code:: pythonos.environ['SENTRY_DSN'] = 'https://00000000000000000000000000000000@sentry.io/0000000'application = falcon_sentry(app=application)return applicationYou can specify the Sentry environment.. code:: pythonapplication = falcon_sentry(dsn=dsn, app=application, environment='prod')return applicationIf both the ``dsn`` parameter and the environment variable are missing then falcon-sentry will do nothing and return the application instance... :changelog:Release History---------------0.2.2 (2018-12-06)++++++++++++++++++- Adds logging.0.2.1 (2018-12-05)++++++++++++++++++- Fixes packaging missing wheel.0.2.0 (2018-12-05)++++++++++++++++++- Adds the ability to pass in extra arguments to sentry_sdk.init.0.1.0 (2018-12-05)++++++++++++++++++- Initial release.
Package: falcon-sorting
A small falcon hook to parse sorting elements from the request.UsageThe easiest way to use this hook is the following:classResource:sorting_fields=("foo","bar")# List of fields allowed for sorting@falcon.before(SortingHook())defon_get(self,req,resp,user):# Here req['context']['sort'] is setThe Hook will look in the query parameters for parameters looking likesort=value.The default sorting order is ascending.
To sort in a descending order a minus (-) sign needs to be specified before the value.
i.e.sort=-valueIt is possible to specify multiple sorting values by separating them with a comma.
i.e.sort=-value1,value2It will create a list in the request context accessible atreq.context['sort'].
This list consists of tuples where the first element is the name of the field to sort on
and the second the order to follow (eitherASCorDESC)i.e.[('foo', 'ASC'), ('bar', 'DESC')].Configuration optionsAllowing fields for sortingFor security reasons, the fields allowed for sorting must be specified in
thesorting_fieldsattribute of the resource.All the fields not defined in it will be discarded by the hook.Default sorting orderIt is possible to specify a default sorting order by setting thedefault_sortingattribute in the resource.This attribute must be a string or a tuple that respects the convention we have for the request parameter.The attributes specified as the default order must also be part ofsorting_fields.Examples:default_sorting='-foo'# ordefault_sorting=('foo','-bar')Hook configurationOne parameter can be passed to the hook:sort_query_key : The name of the key used in the query to sort data. Default:sort.Example:@falcon.before(PaginationFromRequestHook(sort_query_key='order',))defon_get(self,req,resp,user):# Get request
Package: falcon-sqla
Falcon Middleware: SQLAlchemy IntegrationThefalcon-sqlapackage provides a middleware component for managingSQLAlchemy sessions.
The manager component can also serve as a base building block or a recipe for
more complex use cases, such as applications leveraging multiple database
binds.Installation$pipinstallfalcon-sqlaUsageThefalcon_sqlasessionManagercan be used in two ways:As aFalcon middleware component.As a context manager to explicitly provide a database session.ConfigurationCreate a SQLAlchemy engine.Pass the engine to theManager()initializer as its first parameter.If using the manager as a middleware component, pass itsmiddlewareproperty to afalcon.App's
middleware list:engine=create_engine('dialect+driver://my/database')manager=falcon_sqla.Manager(engine)app=falcon.App(middleware=[manager.middleware])# The database session will be available as req.context.sessionContext ManagerAfalcon_sqla.Managercan also explicitly provide a database session using
thesession_scope()context manager:# Somewhere inside a responderwithself.manager.session_scope(req,resp)assession:# Use the session# <...>session_scope()can also be used as a standalone session context outside of
the request-response cycle:withself.manager.session_scope()assession:# Use the session# <...>Custom Vertical PartitioningSimple random selection of read- and write- database replicas is supported
out of the box. Use theadd_engine()method to instruct theManagerto
include the provided engines in the runtime bind selection logic:manager=falcon_sqla.Manager(engine)read_replica=create_engine('dialect+driver://my/database.replica')manager.add_engine(read_replica,'r')TheManager.get_bind()method can be overridden to implement custom engine
selection logic for more complex use cases.See also this SQLAlchemy recipe:Custom Vertical Partitioning.About FalconFalconis the minimalist REST API and
microservices framework for Python developers, with a focus on reliability,
correctness, and performance at scale.About SQLAlchemySQLAlchemyis the Python SQL toolkit and
Object Relational Mapper that gives application developers the full power and
flexibility of SQL.
Package: falcon-stats
# Falcon Stats`falcon-stats` is a simple usage statistics middleware for the [Falcon REST framework](https://falconframework.org/). It should primarily enable later analysis that separately gets relevant data from the DB.## Data Collection*Falcon Stats* gathers data on incoming requests and their processed responses. Currently the following features are saved:- Response Timestamp- Processing Time between Request and Response- Request Method- User Agent- Request URI (domain, endpoint and query string)- Remote IP (closest to the server)- Request Content-Type- Response Status- Request Content LengthNote that logging and database access add overhead to the processing time. Furthermore it will add a few milliseconds on every response.## Installation... is as easy as```pip install falcon-stats```Installation assumes you have the packages found in *requirements.txt* installed. Please note the development build of SQLAlchemy that is pulled from the official git repository.## UsageIn your main falcon file import the `FalconStatsMiddleware` and add it to the middleware list of your API instance. That's it.```pythonfrom falconstats import FalconStatsMiddleware...fsm = FalconStatsMiddleware(db_user="root",db_pass="my-secret-pw",db_addr="localhost:3306",db_name="stats")app = falcon.API(middleware=[fsm])```This will connect to the given MySQL database and start to add request-response data. For now only MySQL is supported - *PRs welcome*!## CompatibilityThe middleware is used with Python 3.5 and 3.6. I don't plan on supporting Python 2.7 but it still might work.
Package: falcon-swagger
[![Build Status](https://travis-ci.org/dutradda/falcon-swagger.svg?branch=master)](https://travis-ci.org/dutradda/falcon-swagger)[![Coverage Status](https://coveralls.io/repos/github/dutradda/falcon-swagger/badge.svg?branch=master)](https://coveralls.io/github/dutradda/falcon-swagger?branch=master)# falcon-swaggerA Falcon Framework (http://falconframework.org) Extension.Features:- Supports Swagger Schema 2.0 (OpenAPI 2.0);- Provides SQLAlchemy models base classes (with Redis integration, if you want);- Provides Redis models base classes (without SQLAlchemy).Usage Example:```pythonfrom falconswagger import SwaggerAPI, ModelHttpMetaclass HelloModelMeta(ModelHttpMeta):__schema__ = {'/hello/you/{name}': {'get': {'parameters': [{'name': 'name','in': 'path','required': True,'type': 'string'}],'operationId': 'get_hello_you','responses': {'200': {'description': 'Got you'}}}},'/hello/world': {'get': {'operationId': 'get_hello_world','responses': {'200': {'description': 'Got hello'}}}}}def get_hello_you(cls, req, resp):you = req.context['parameters']['path']['name']resp.body = 'Hello {}!\n'.format(you)def get_hello_world(cls, req, resp):resp.body = 'Hello World!\n'class HelloModel(metaclass=HelloModelMeta):passapi = SwaggerAPI([HelloModel], title='Hello API')``````bashgunicorn hello_word_api:api``````bashcurl -i localhost:8000/hello/world``````textHTTP/1.1 200 OKServer: gunicorn/19.6.0Connection: closecontent-length: 13content-type: application/json; charset=UTF-8Hello World!``````bashcurl -i localhost:8000/hello/you/Diogo``````textHTTP/1.1 200 OKServer: gunicorn/19.6.0Connection: closecontent-length: 13content-type: application/json; charset=UTF-8Hello Diogo!``````bashcurl -i localhost:8000/swagger.json``````jsonHTTP/1.1 200 OKServer: gunicorn/19.6.0Connection: closecontent-length: 672content-type: application/json; charset=UTF-8{"swagger": "2.0","paths": {"/hello/world": {"get": {"operationId": "HelloModel.get_hello_world","responses": {"200": {"description": "Got hello"}}}},"/hello/you/{name}": {"get": {"operationId": "HelloModel.get_hello_you","responses": {"200": {"description": "Got you"}},"parameters": [{"in": "path","type": "string","required": true,"name": "name"}]}}},"info": {"title": "Hello API","version": "1.0.0"}}```
Package: falcon-swagger-ui
Simple Falcon application for addingSwagger UIto your falcon
application.Included Swagger UI version: v3.38.0Support Falcon 3.0.0Installationpip installfalcon-swagger-uiUsageExample application:importfalconfromfalcon_swagger_uiimportregister_swaggerui_appapp=falcon.API()SWAGGERUI_URL='/swagger'# without trailing slashSCHEMA_URL='http://petstore.swagger.io/v2/swagger.json'### For developer environment you can expose a static endpoint like:# import pathlib## SCHEMA_URL = '/static/v1/swagger.json'# STATIC_PATH = pathlib.Path(__file__).parent / 'static'## @see: http://falcon.readthedocs.io/en/stable/api/api.html#falcon.API.add_static_route# app.add_static_route('/static', str(STATIC_PATH))#page_title='Falcon Swagger Doc'favicon_url='https://falconframework.org/favicon-32x32.png'register_swaggerui_app(app,SWAGGERUI_URL,SCHEMA_URL,page_title=page_title,favicon_url=favicon_url,config={'supportedSubmitMethods':['get'],})Running the example application:pipinstallfalcongunicornjinja2gunicornexample:appConfigurationThe application supports overloading all Swagger UI configuration
options that can be JSON serialized. Seehttps://github.com/swagger-api/swagger-ui#parametersfor options.In addition, some of the OAuth fields are exposed to special variables
that will be rendered into the relevant function.Application defaults are listed below (should match SwaggerUI defaults).{# OAuth related'app_name':'null','client_realm':'null','client_id':'null','client_secret':'null',# SwaggerUI base configuration, see https://github.com/swagger-api/swagger-ui#parameters'docExpansion':"none",'jsonEditor':False,'defaultModelRendering':'schema','showRequestHeaders':False,'supportedSubmitMethods':['get','post','put','delete','patch']}
Package: falcon-telegraf-middleware
falcon-telegraf-middlewareWhat is this?Package to ease gathering metrics fromFalconAPIs into InfluxDB via a Telegraf.
By use of middlewares this orthogonal functionality is added in a hassle-free way minimizing required work. Sane defaults make quickstart really quick 👍How?Inject the middleware (or couple of them) when creatingApiinstance:fromfalcon_telegrafimportLogHits,Timertelegraf_client=TelegrafClient('localhost',8094)app=falcon.API(middleware=[LogHits(telegraf_client),Timer(),])Note that passingtelegraf_clientis totally optional.
Measurement names can be set when creating middleware, prefixed or autogenerated.MiddlewaresLogHitsCreates a metric named hits-path/to/endpoint with one fields calledhitswith value 1.
Executesafteron-*method was called. Because of this you can add custom tags and values.
Example:defon_get(self,request,response,some_path_variable):request.context['telegraf_tags']['my_new_tag']='this_tags_value'request.context['telegraf_values']['some_path_variable']=some_path_variable...TimerReports time in ms elapsed between registering response and registering request. Default metric prefix istime-.
Other things in processing pipeline can affect it's readings so take them with a grain of salt.Testingpipinstall-e.
pytestDeployFirst bump version insetup.pyin master branch via merge request. Afterwards push a version tag and wait.gittag`date+"%Y.%-m.%-d.1"`gitpush--tags
Package: falcontool
Falcontool: a simple utility to create and work with Falcon-based projectsFalcontool is an attempt to provide tooling for quickly and easily starting a Falcon-based project.It is inspired by Django'sdjango-adminand Flask'sflask.Falcontool does the following:Creates a project repository given aproject_nameSets up the basic project scaffolding, including:Creates atestssubdirectoryCreates asrcsubdirectoryCreates an emptysrc/api.pyCreates an emptyrequirements.txtfile in the root directoryCreates an emptyREADME.mdfile in the root directoryCreates an emptyCODEOWNERSfile in the root directoryCreates additional resources if specified by flags:--dockerfilecreates an emptyDockerfilein the root directory--modelsfilecreates an emptymodels.pyinsrc/apidirectory--dbfilecreates an emptydb.pyinsrc/apidirectory--resourcesfilecreates an emptyresources.pyinsrc/apidirectory'--tox' creates an emptytox.iniin the root directoryProvides theshellcommand to get a Python console (support IPython if installed)Provides theruncommand to start the API serverInstallation$>pipinstallfalcontoolUsage$>falconcreatefoo
createddirectoryfoo
createddirectorytests
createddirectorysrc
createdfilerequirements.txt
createdfileREADME.md
createdfilesrc/api.py
createdfileCODEOWNERS

$>cdfoo
$>ll-a./*
-rw-r--r--1tjbtjb40Sep2920:23./CODEOWNERS
-rw-r--r--1tjbtjb40Sep2920:23./README.md
-rw-r--r--1tjbtjb40Sep2920:23./requirements.txt

./src:
total12drwxr-xr-x2tjbtjb4096Sep2920:23./
drwxr-xr-x4tjbtjb4096Sep2920:23../
-rw-r--r--1tjbtjb40Sep2920:23api.py

./tests:
total8drwxr-xr-x2tjbtjb4096Sep2920:23./
drwxr-xr-x4tjbtjb4096Sep2920:23../

$>falconshell
CannotfindIPython.FallingbacktoPythonconsole.
Python3.7.4(default,Aug192019,22:20:25)[GCC8.3.0]onlinux
Type"help","copyright","credits"or"license"formoreinformation.(InteractiveConsole)>>>$>falconrun[2019-09-3018:15:25-0400][17047][INFO]Startinggunicorn19.9.0[2019-09-3018:15:25-0400][17047][INFO]Listeningat:http://127.0.0.1:8000(17047)[2019-09-3018:15:25-0400][17047][INFO]Usingworker:sync[2019-09-3018:15:25-0400][17050][INFO]Bootingworkerwithpid:17050
Package: falcontyping
Falcon typingUse type hints to specify request parameters with Marshmallow and Pydantic support.**UsestypedjsonExample"""API."""fromtypingimportOptional,UnionfrompydanticimportBaseModelasPydanticModelfromfalcontypingimportTypedAPI,TypedResourceclassUserV1(PydanticModel):username:strclassUserV2(PydanticModel):username:strbalance:floatclassUsersResource(TypedResource):defon_post(self,request,response,user:Union[UserV2,UserV1])->Union[UserV2,UserV1]:ifisinstance(user,UserV2):returnUserV2(username=user.username,balance=user.balance)else:returnUserV1(username=user.username)classUserDetailsResource(TypedResource):defon_get(self,request,response,user_id:int)->Optional[Union[UserV2,UserV1]]:ifuser_id==2:returnUserV2(username='user',balance=0.0)ifuser_id==1:returnUserV1(username='user')returnNoneAPI=TypedAPI()API.add_route('/users',UserResource())API.add_route('/users/{user_id}',UserDetailsResource())How to installpip install falcontyping
Package: falcon-vue
Falcon VueFalcon Vue is a plugin for theFalcon Web Framework.falcon-vue is a plug-in for distributing static files built by vue.js (vue-cli) on falcon.Descriptionfalcon-vue is a plug-in for distributing static files built by vue.js (vue-cli) on falcon.
To use this plugin, you need to install vue-cli and build it to generate a static file.Installpip3installfalcon-vueUsageimportosimportsysimportfalconfromwsgirefimportsimple_serverfromfalcon_vueimportregister_vue_appapp=falcon.API()app=register_vue_app(app,api_url="/dist",src_path="./test_project/dist")if__name__=='__main__':httpd=simple_server.make_server('127.0.0.1',8000,app)httpd.serve_forever()LicenceMIT
Package: falconx
OverviewThis is the official python client for the FalconX API.API Documentation:http://docs.falconx.ioInstallationpipinstallfalconxQuickstartfromfalconximportFalconxClientclient=FalconxClient(key=KEY,secret=SECRET,passphrase=PASSPHRASE)quote=client.get_quote('BTC','USD',5,'two_way')result=client.execute_quote(quote['fx_quote_id'],'buy')About FalconXFalconX is an institutional digital asset brokerage.
Package: falconx-py
OverviewThis is the official API client for the FalconX API.API Documentation:http://docs.falconx.ioQuickstartfromfalconx_pyimportFalconxClientfnx=FalconxClient(key=KEY,secret=SECRET,passphrase=PASSPHRASE)quote=fnx.get_quote('BTC','USD',5,'two-way')result=fnx.execute_quote(quote['fx_quote_id'],'buy')Installationpipinstallfalconx-pyAbout FalconXFalconX is an institutional digital asset brokerage.
Package: falconz
FalconZ is a robust and comprehensive Python package that offers a simplified approach to PET (Positron Emission Tomography) motion correction. The software is equipped to handle both head and total-body scans, ensuring high-accuracy results in diverse settings. Built around the potent greedy registration toolkit, FalconZ serves as an efficient engine for registration tasks, providing precise alignment in PET imaging. The package has been designed with user-friendliness in mind, streamlining the implementation process of motion correction. Whether you are a researcher, healthcare professional, or an individual working with PET scans, FalconZ provides a seamless solution to your needs. It integrates effortlessly into your existing Python environment, and its straightforward usability makes it an indispensable tool for accurate PET scan analysis.
Package: falguard
Falguard is a Python library that provides request validation helpers forFalconweb framework. Falguard relies on Yelp’sbravado-corelibrary.FeaturesValidation ofOpenAPI (Swagger)schemaError serialization compliant withJSON:APIspecificationValidator may be used either as a hook or a middleware componentInstallation$pipinstallfalguardUsageInstantiate Validator with the path to OpenAPI specification (both json and yaml are supported)…importfalguardvalidator=falguard.Validator('spec.json')…and use it as the hook on the responder…classResource:@falcon.before(validator)defon_get(self,request,response,**validated):pass…or the hook on the whole resource…@falcon.before(validator)classResource:pass…or globally, as the middleware component.importfalconapi=falcon.API(middleware=validator)All validated parameters (path, query, body) are injected back to the responder
so it MUST accept relevant number of arguments, eg.classResource:defon_put(self,request,response,resource_id,data):passdefon_post(self,request,response,**validated):pass