Saravanan666/pypi-org huggingface dataset:
Package: reactpy-django
ReactPy DjangoReactPy-Djangois used to add used to addReactPysupport to an existingDjango project. This package also turbocharges ReactPy with features such as...SEO compatible renderingSingle page application (SPA) capabilitiesDistributed computingPerformance enhancementsCustomizable reconnection behaviorCustomizable disconnection behaviorMultiple root componentsCross-process communication/signaling (Channel Layers)Django view to ReactPy component conversionDjango static file accessDjango database accessWhat is ReactPy?ReactPyis a library for building user interfaces in Python without Javascript. ReactPy interfaces are made from components that look and behave similar to those found inReactJS. Designed with simplicity in mind, ReactPy can be used by those without web development experience while also being powerful enough to grow with your ambitions.Supported BackendsBuilt-inExternalFlask, FastAPI, Sanic, TornadoDjango,Jupyter,Plotly-DashAt a Glancemy_app/components.pyYou will need a file to define yourReactPycomponents. We recommend creating acomponents.pyfile within your chosenDjango appto start out. Within this file, we will create a simplehello_worldcomponent.fromreactpyimportcomponent,html@componentdefhello_world(recipient:str):returnhtml.h1(f"Hello{recipient}!")my_app/templates/my-template.htmlIn yourDjango app's HTML template, you can now embed your ReactPy component using thecomponenttemplate tag. Within this tag, you will need to type in the dotted path to the component.Additionally, you can pass inargsandkwargsinto your component function. After reading the code below, pay attention to how the function definition forhello_world(from the previous example) accepts arecipientargument.{%loadreactpy%}<!DOCTYPE html><html><body>{%component"example_project.my_app.components.hello_world"recipient="World"%}</body></html>ResourcesFollow the links below to find out more about this project.Try ReactPy (Jupyter Notebook)DocumentationGitHub DiscussionsDiscordContributor GuideCode of Conduct
Package: reactpy-flake8
reactpy-flake8A Flake8 plugin that enforces the"rules of hooks"forReactPy.The implementation is based on React's own ESLintplugin for hooks.Installpipinstallreactpy-flake8Developer Installationpipinstall-rrequirements.txt
pipinstall-e.Run the testsnox-stestErrorsCodeMessageREACTPY100Hook is defined as a closureREACTPY101Hook was used outside component or hook definitionREACTPY102Hook was used inside a conditional or loop statementREACTPY103Hook was used after an early returnREACTPY200A hook's dependency is not destructured - dependencies should be refered to
            directly, not via an attribute or key of an objectREACTPY201Hook dependency args should be a literal list, tuple or NoneREACTPY202Hook dependency is not specifiedOptionsAll options my be used as CLI flags where_characters are replaced with-. For
example,exhaustive_hook_depswould become--exhaustive-hook-deps.OptionTypeDefaultDescriptionexhaustive_hook_depsBooleanFalseEnableREACTPY2**errors (recommended)component_decorator_patternRegex^(component|[\w\.]+\.component)$The pattern which should match the component decorators. Useful if
            you import the@componentdecorator under an alias.hook_function_patternRegex^_*use_\w+$The pattern which should match the name of hook functions. Best used if you
            have existing functions withuse_*names that are not hooks.
Package: reactpy-github-buttons
reactpy-github-buttonsMinimalReactPywrapper forgithub-buttons.Usagepip install reactpy-github-buttonsExamplesSeveral examples of usage are in the./examplesfolder.Minimal./examples/single.pyfrom reactpy import component, html, run
from reactpy_github_buttons import StarButton

@component
def AppMain():
    return StarButton(user='reactive-python', repo='reactpy')

if __name__ == "__main__":
    run(AppMain)With Color Scheme./examples/color_scheme.pyfrom reactpy import component, html, run
from reactpy_github_buttons import StarButton, make_color_scheme, ColorScheme

@component
def AppMain():
    return StarButton(user='reactive-python', repo='reactpy',
        show_count=True,
        color_scheme=make_color_scheme(
            no_preference=ColorScheme.LIGHT_HIGH_CONTRAST,
            light=ColorScheme.LIGHT,
            dark=ColorScheme.DARK_HIGH_CONTRAST,
        )
    )

if __name__ == "__main__":
    run(AppMain)Buttons PlaygroundTheButtons Playgroundapplication has been implemented
as a RectPy demonstrator.python -m examples.button_playground
Package: reactpy-jupyter
reactpy-jupyterA client forReactPyimplemented using Jupyter widgetsTry It Now!Check out some live examples by clicking the badge below:Getting StartedTo install usepip:pip install reactpy_jupyterThen, before anything else, do one of the following:At the top of your notebook runimportreactpy_jupyterRegisterreactpy_jupyteras a permanant IPython extension inyour config file:c.InteractiveShellApp.extensions=['reactpy_jupyter']UsageOnce you're donegetting started, you can author and display ReactPy
layouts natively in your Jupyter Notebook:importreactpy@reactpy.componentdefClickCount():count,set_count=reactpy.hooks.use_state(0)returnreactpy.html.button({"onClick":lambdaevent:set_count(count+1)},[f"Click count:{count}"],)ClickCount()You can also turn anreactpyelement constructor into one that returns anipywidgetwith
thereactpy_juptyer.widgetizefunction. This is useful if you wish to use ReactPy in combination
with other Jupyter Widgets as in the following example:ClickCountWidget=reactpy_jupyter.widgetize(ClickCount)ipywidgets.Box([ClickCountWidget(),ClickCountWidget(),])Alternatively just wrap anreactpyelement instance in anreactpy_jupyter.LayoutWidget:ipywidgets.Box([reactpy_jupyter.LayoutWidget(ClickCount()),reactpy_jupyter.LayoutWidget(ClickCount()),])For a more detailed introduction check out this live demo here:Development InstallationFor a development installation (requiresNode.jsandYarn version 1),$ git clone https://github.com/reactive-python/reactpy-jupyter.git
$ cd reactpy-jupyter
$ pip install -e .To automatically re-build and refresh Jupyter when making changes start a Vite dev server:$ npx viteThen, before importingreactpy_jupyterset the following environment variable:importosos.environ["REACTPY_JUPYTER_DEV"]="1"importreactpy_jupyter
Package: react-ssr
React SSR (Backend)A view for server-side render react apps from Django. Expected to be used in
combination withReact SSR (Frontend)Installationpipinstallreact-ssrExamples<!-- index.html -->{% extends "react_ssr/base.html" %}

{% load render_bundle from webpack_loader %}
{% load static %}

{% block head %}<script>window.__STATE__=={{state|safe}};</script>{% endblock %}

{% block body %}<mainrole="main">{{ html | safe }}</main>{% render_bundle "runtime" %}
    {% render_bundle "vendors" %}
    {% render_bundle "client" %}
{% endblock %}# urls.pyfromdjango.conf.urlsimporturlfrom.importviewsurlpatterns=[...url(r"^$"views.HomePageView.as_view(),name="home-page"),...]# views.pyfromreact_ssr.viewsimportReactViewclassReactViewBase(ReactView):included_context=["title","meta"]classHomePageView(ReactViewBase):page_path="site/pages/home"page_state_path="site.pages.home"
Package: reacttrs
reacttrsReactive attributes extracted out fromTextual.fromreacttrsimportreactiveclassFoo:name=reactive("Paul")age=reactive(33)birth=reactive(1990)defwatch_name(self,old,new):print(f"{old=},{new=}")defvalidate_name(self,name):ifname=="John":print("Hey John!")returnnamedefcompute_age(self)->int:age=2023-self.birthprint(f"{age=}")returnagefoo=Foo()foo.name="John"foo.name="Steve"foo.agefoo.birth=1991foo.age
Package: read5
InstallationPypi/pippipinstallread5CondaPod5 is now available viaconda(19.07.2023).condainstallmambamambacreate-nread5-cjannesspread5condaactivateread5Alternatively you can create the environment using theconda.recipe/env.ymlfile.condainstallmambamambaenvcreate-fconda.recipe/env.ymlcondaactivateread5UsageClick here to see a full documentation about the classes and
function.my_filecan be a fast5, slow5, blow5 or pod5 file. The wrapper detects
the file format depending on the file extension.Small example:fromread5importread# or from read5.Reader import readr5=read(my_file)# file with on of these extensions: .fast5, .slow5, .blow5, .pod5forreadidinr5:signal=r5.getSignal(readid)# returns raw integer values stored in the filepA_signal=r5.getpASignal(readid)# returns pA signalnorm_signal=r5.getZNormSignal(readid)# returns normalised read signal: norm_signal = (signal - median(signal)) / mad(signal)channel=r5.getChannelNumber(readid)sampleid=r5.getSampleID(readid)runid=r5.getRunID(readid)readid_list=r5.getReads()File Reader ClassesIf you want to use the file readers you can import the corresponding
class like this:fromread5.Fast5ReaderimportFast5Reader# contains the Fast5 Reader classfromread5.Slow5ReaderimportSlow5Reader# contains the Slow5 Reader classfromread5.Pod5ReaderimportPod5Reader# contains the Pod5 Reader classAbstract File Reader Classfromread5.AbstractFileReaderimportAbstractFileReaderPossible Exceptionsfromread5.ExceptionsimportUnknownFileFormatException,UnknownNormalizationModeUnknownFileFormatException: is raised, when the file extension does
not match one of [‘.fast5’, ‘.slow5’, ‘.blow5’, ‘pod5’]UnknownNormalizationMode: is raised, when an unknown mode is provided
for the signal normalization functionFull DocumentationCreated withpdoc3. Can be foundhere.
Package: read5-ont
InstallationPypi/pippipinstallread5_ontCondaPod5 is now available viaconda(19.07.2023).condainstallmambamambacreate-nread5_ont-cjannesspread5_ontcondaactivateread5_ontAlternatively you can create the environment using theconda.recipe/env.ymlfile.condainstallmambamambaenvcreate-fconda.recipe/env.ymlcondaactivateread5_ontUsageClick here to see a full documentation about the classes and
function.my_filecan be a fast5 or pod5 file. The wrapper detects
the file format depending on the file extension.Small example:fromread5importread# or from read5.Reader import readr5=read(my_file)# file with on of these extensions: .fast5, .pod5forreadidinr5:signal=r5.getSignal(readid)# returns raw integer values stored in the filepA_signal=r5.getpASignal(readid)# returns pA signalnorm_signal=r5.getZNormSignal(readid)# returns normalised read signal: norm_signal = (signal - median(signal)) / mad(signal)channel=r5.getChannelNumber(readid)sampleid=r5.getSampleID(readid)runid=r5.getRunID(readid)readid_list=r5.getReads()File Reader ClassesIf you want to use the file readers you can import the corresponding
class like this:fromread5.Fast5ReaderimportFast5Reader# contains the Fast5 Reader classfromread5.Pod5ReaderimportPod5Reader# contains the Pod5 Reader classAbstract File Reader Classfromread5.AbstractFileReaderimportAbstractFileReaderPossible Exceptionsfromread5.ExceptionsimportUnknownFileFormatException,UnknownNormalizationModeUnknownFileFormatException: is raised, when the file extension does
not match one of [‘.fast5’, ‘.pod5’]UnknownNormalizationMode: is raised, when an unknown mode is provided
for the signal normalization functionFull DocumentationCreated withpdoc3. Can be foundhere.
Package: readability-api
readability-apireadability-api is the official python client for Readability. It provides
access to both the Parser API and the Reader API.The latest version can be installed via pip:pipinstallreadability-apiPlease refer to theofficial docsfor more
information and examples.TestsValid Parser, Reader, username, and password must be set as environment
variables before running the tests. This test suit runs agains the live
Readability API and also serves as integration tests. We recommend creating a
seperate testing user account on Readability to avoid disturbing your reading
list.Note:These tests do reset the bookmarks library of the provided user
when complete. They shouldnotbe run on your primary user account!# If you don't have itpipinstalltoxexportREADABILITY_CONSUMER_KEY='...'exportREADABILITY_CONSUMER_SECRET='...'exportREADABILITY_PARSER_TOKEN='...'exportREADABILITY_USERNAME='...'exportREADABILITY_PASSWORD='...'toxAPI Keys and AccessDon’t have Readability API keys? You can find them onyour Readability account
settings page.LicensingThe code for readability-api is licensed under theMIT License
Package: readability-dig
This code is under the Apache License 2.0.http://www.apache.org/licenses/LICENSE-2.0This is a modfied for higher recall rate of famous python port(https://github.com/buriy/python-readability) a ruby port of arc90’s readability projecthttp://lab.arc90.com/experiments/readability/https://github.com/buriy/python-readabilityIn few words,
Given a html document, it pulls out the main body text and cleans it up.
It also can clean up title based on latest readability.js code.Based on:Latest readability.js (https://github.com/MHordecki/readability-redux/blob/master/readability/readability.js)Ruby port by starrhorne and iterationlabsPython port by gfxmonk (https://github.com/gfxmonk/python-readability, based on BeautifulSoup )Python port by buriy (https://github.com/buriy/python-readability)Decruft effort to move to lxml (http://www.minvolai.com/blog/decruft-arc90s-readability-in-python/)“BR to P” fix from readability.js which improves quality for smaller texts.Github users contributions.Installation:pip install readability-digUsage:from readability.readability import Document
import urllib
html = urllib.urlopen(url).read()
readable_article = Document(html).summary()
readable_title = Document(html).short_title()Command-line usage:python -m readability.readability -u http://pypi.python.org/pypi/readability-digTo open resulting page in browser:python -m readability.readability -b -u http://pypi.python.org/pypi/readability-digUsing positive/negative keywords example:python -m readability.readability -p intro -n newsindex,homepage-box,news-section -u http://python.orgDocument() kwarg options:attributes:debug: output debug messagesmin_text_length:retry_length:url: will allow adjusting links to be absolutepositive_keywords: the list of positive search patterns in classes and ids, for example: [“news-item”, “block”]negative_keywords: the list of negative search patterns in classes and ids, for example: [“mysidebar”, “related”, “ads”]
Package: readability-lxml
python-readabilityGiven a html document, it pulls out the main body text and cleans it up.This is a python port of a ruby port ofarc90’s readability
project.InstallationIt’s easy usingpip, just run:$pipinstallreadability-lxmlUsage>>>importrequests>>>fromreadabilityimportDocument>>>response=requests.get('http://example.com')>>>doc=Document(response.text)>>>doc.title()'Example Domain'>>>doc.summary()"""<html><body><div><body id="readabilityBody">\n<div>\n    <h1>Example Domain</h1>\n
<p>This domain is established to be used for illustrative examples in documents. You may
use this\n    domain in examples without prior coordination or asking for permission.</p>
\n    <p><a href="http://www.iana.org/domains/example">More information...</a></p>\n</div>
\n</body>\n</div></body></html>"""Change Log0.8.1 Fixed processing of non-ascii HTMLs via regexps.0.8 Replaced XHTML output with HTML5 output in summary() call.0.7.1 Support for Python 3.7 . Fixed a slowdown when processing documents with lots of spaces.0.7 Improved HTML5 tags handling. Fixed stripping unwanted HTML nodes (only first matching node was removed before).0.6 Finally a release which supports Python versions 2.6, 2.7, 3.3 - 3.60.5 Preparing a release to support Python versions 2.6, 2.7, 3.3 and 3.40.4 Added Videos loading and allowed more images per paragraph0.3 Added Document.encoding, positive_keywords and negative_keywordsLicensingThis code is underthe Apache License
2.0license.Thanks toLatestreadability.jsRuby port by starrhorne and iterationlabsPython portby gfxmonkDecruft effort <http://www.minvolai.com/blog/decruft-arc90s-readability-in-python/>to move to lxml“BR to P” fix from readability.js which improves quality for smaller textsGithub users contributions.
Package: readability-metrics
Readability MetricsThis project is based extremely heavily onmmautner's package. Modifications were made to support the analysis of large documents.InspirationWhen using mmautner's package, the entire document needed to be passed in at once:large_str="...."rd=Readability(large_str)print('ARI: ',rd.ARI())However, while doing an analysis of Supreme Court transcripts since 1956 across various metrics, my personal computer was not able to load and the needed documents all at once. In order to account for this, I created this package, which allows for pieces of documents to be passed in. Furthermore, the text is not stored, only the resulting calculations. Lastly, all metrics are calculated and returned each time, so individual calculations don't need to be performed.InstallationReadability metrics can be installed from PyPi:$ pip3 install readability-metricsUsageReadability metrics can be used as follows:importmetrics# import packagerdm=Readability()rdm.analyze_text("This is a sentence.")rdm.analyze_text("This is part of the same document.")rdm.analyze_text("This is also part of the same document.")rdm.get_results()# can further modifyrdm.analyze_text("This is also part of the same document.")rdm.get_results()# can clear and start new analysisrdm.clear()rdm.analyze_text("This is also part of the same document.")rdm.get_results()You can also calculate readability metrics across multiple categories. For instance, if you had a transcript, you could calculate metrics for all speakers at once:importmetricsfromcollectionsimportdefaultdictlettranscript=[('John George','Words said by John George'),('Apple Dunkin','Words said by Apple Dunkin'),# ...]readability_per_speaker=defaultdict(lambda:Readability())# Calculate readability metricsfordialogueintranscript:readability_per_speaker[dialogue[0]].analyze_text(dialogue[1])# Calculate resultsforspeakerinreadability_per_speaker:dic[key]=dic[key].get_results()# readability_per_speaker now in form:{"SPEAKER NAME":{{'ARI':12.163787878787879,'FleschReadingEase':58.2319,'FleschKincaidGradeLevel':11.2857,'GunningFogIndex':14.5465,'SMOGIndex':12.287087810503355,'ColemanLiauIndex':9.5226,'LIX':46.467171717171716,'RIX':5.375}},# more speakers ...}ContributionContributions are welcome. Please create a pull request or email me atericwiener3@gmail.com. Also feel free to create an issue if you need help with something.TestingTesting can be run with pytest. Simple navigate to the directory and runpytest.
Package: readable-content
Collects actual content of any article, blog, news, etc.Installationpip install readable-contentUsageAfter installing you need to do just add following two variables in settings.py of your Scrapy projectfrom readable_content.parser import ContentParser
parser = ContentParser("https://ideas.ted.com/how-do-animals-learn-how-to-be-well-animals-through-a-shared-culture/")
content = parser.get_content()
print(readable_content)In case the website does not allow getting the content and throws 4XX or 3XX or any other error codes, we can first get the HTML using other techniques like using requests, using user-agent, applying proxies on your own, etc. Then the html content can be passed as following:parser = ContentParser("https://ideas.ted.com/how-do-animals-learn-how-to-be-well-animals-through-a-shared-culture/", html_content)Here html_content variable is string representation of the HTML.Thank you!
Package: readabledelta
Installationpip install readabledeltaUsage examplesThereadabledeltais just a more human-friendly printable version oftimedelta.  The public interface is equivalent to timedelta, only printing behaviour has been modified.It’s easy to confuse hours/minutes with minutes/seconds in the default formatting of timedeltas>>> lunchtime = datetime(year=2015, month=5, day=27, hour=12)
>>> right_now = datetime(year=2015, month=5, day=27, hour=13, minute=5)
>>> 'Lunch was {} ago'.format(delta)
'Lunch was 1:05:00 ago'
>>> 'Lunch was {} ago'.format(readabledelta(delta))
'Lunch was 1 hour and 5 minutes ago'For negative timedeltas, the default representation is more machine-friendly than human-friendly: “an hour and five minutes” back is easier for people to understand than the weird but technically-correct “negative one day plus 22 hours and 55 minutes”>>> '{}'.format(lunchtime - right_now)
'-1 day, 22:55:00'
>>> '{}'.format(readabledelta(lunchtime - right_now))
'-1 hour and 5 minutes'A readabledeltais atimedelta, compares as you’d expect, and is simple enough not to misbehave.>>> issubclass(readabledelta, timedelta)
True
>>> isinstance(readabledelta(), timedelta)
True
>>> readabledelta() == timedelta()
TrueThis means you can safely add or subtract them todatetimeinstances, there will be no unpleasant surprises with arithmetic.
Package: readableID
# Readable ID[![CircleCI](https://circleci.com/gh/nziehn/readableID.svg?style=svg)](https://circleci.com/gh/nziehn/readableID)Use readableID to transform integer item ids to readable, nonconsecutive idsCriteria for a good readable id:- as short as possible- should contain only numbers and characters that are easy to distinguish regardless of font, e.g. no `0` vs `O`.- not create any duplicates with increase number of items!- consecutive numbers should not create consecutive ids```pythonid_generator.generate_id(0)  # returns 9MBEid_generator.generate_id(1)  # returns QCAH```This library does not use any dependencies outside of the python std lib!### InstallingJust install using `pip`:```pip install readableID```### UsageUsage is very simple after creating an object, just call the `generate_id` method:```pythonimport readableIDid_generator = readableID.ReadableID()for x in range(1000):readable_id = id_generator.generate_id(x)print(readable_id)```Generally it is easiest to use this library in conjunction with a database that allows auto-incrementing idswhich you use as input for the generate_id method.### Adapting parameters to your needsTo create your own unique numbers, you can salt them using the following parameters:```pythonimport readableIDid_generator = readableID.ReadableID(charset=readableID.DEFAULT_CHARSET,min_length=readableID.DEFAULT_MINIMAL_LENGTH,prime=readableID.DEFAULT_PRIME,xor=readableID.DEFAULT_XOR)```#### `charset`:The `charset` controls the allowed characters. There are 2 criteria for this string:1. characters must be unique2. length of string must be a power of 2, e.g. 8, 16, 32, 64The default charset is chosen to create minimal confusion for readers, since only very distinct chars were chosen.#### `min_length`:The `min_length` controls the length of the generated ids. The library will fit as many item ids into the given `min_length` as possible,but if your number of items grows beyond this number, the ids will automatically get longer!Example: with the default parameters, you can fit `32 ^ 4` item ids into 4 characters.So if you call `generate_id` with any number `0 <= x < 32^4` it will produce a id with length of 4.Starting at `32^4`, you will see ids with length of 5! Starting at `32^5` you will see ids with length of 6 and so on.#### `prime`:The `prime` parameter allows you to change how the next number is chosen. It is critical that this is a `prime number > 2` if you want to avoid duplicates!If you are unsure - you can skip changing this parameter and rather chose a different `xor` value!#### `xor`:The `xor` value allows you to create different sequences of numbers, you can chose `any integer >= 0`,but generally it makes more since to pick a number:`100 < x < len(charset) ^ min_length`. Changing `xor` will not have as big of an effect as changing the `prime` value,but will still create reasonably different sequences of numbers/
Package: readable-log-formatter
Pretty logs for local development.pipinstallreadable-log-formatterProvides the classreadable_log_formatter.ReadableFormatterto be used
with Python’s logging:importloggingfromreadable_log_formatterimportReadableFormatterlog=logging.getLogger()log.setLevel(logging.INFO)hndl=logging.StreamHandler()hndl.setFormatter(ReadableFormatter())log.addHandler(hndl)