Saravanan666/pypi-org huggingface dataset:
Package: rustdef
rustdefJupyter extension for jupyter notebooks and rust users.You can define functions in rust and run them as python functions.
This extension is built onPyO3andmaturin.ExamplesGet StartedType conversionNumpy examplePrerequisitePython >= 3.7 and pip >= 19.3Jupyter notebookRustcargo-editInstall$pipinstallrustdefUsageDefine rust functions,%%rustdef#[pyfunction]fnmy_func(x:i64,y:&str)->i64{println!("{}",y);x+y.len()asi64}Add dependencies, (e.g.numcrate)%rustdef deps add num@0.4.0Defined dependencies are valid only in the current notebook.Show dependencies,%rustdef deps shownum = "0.4.0"

[pyo3]
version = "0.13.2"
features = [ "extension-module",]pyo3is included by default.DevelopHow does it work?Roughly, definitions in rustdef are available in python after the following steps.Each rustdef magic cell is populated with the module definition of pyo3A new crate is generated for the rustdef cellThe crate is compiled into a python wheel bymaturinInstall the wheel withpipFunctions with#[pyfunction]attributes are exported into the interpreter namespace in notebooksReady to call the function in notebooks!Buildmaturinis required.$pipinstallmaturin
$maturinbuild
$pipinstalltarget/wheels/rustdef-{version}-{python}-{platform}.whlToDoexecute within rustdef cellclass/module supportscustomizable module nameuse functions defined in another cellverbose flagserde supportwindows support
Package: rust-demangler
rust_demanglerA package for demangling Rust symbols, written in Python.Setuppipinstallrust-demanglerUsagefromrust-demanglerimportdemangleprint(demangle(<mangled_name>))Exampledemangle("_ZN3foo3barE")=="foo::bar"#legacy styledemangle("_RNvC6_123foo3bar")=="123foo::bar"#v0 styleLicenseThis project is licensed under theMIT License
Package: rust-dfs
DocumentationDeep Feature Synthesis in RustThis is a project to implement theDeep Feature Synthesisalgorithm in Rust.Roadmap(30JUL2022[^1]) Parity with Featuretools creating feature definitions (no calculation) on single tableParity with Featuretools creating feature definitions (no calculation) on multiple tablesExplore Calculation on single table using PolarsExplore Calculation on multiple tables using Polars[^1]: 3 primitives are not yet passing tests.'diff_datetime', 'geomidpoint', 'age'Running in Pythonpip install rust_dfsUsing from python# Import Featuretools, rust_dfs, and some other utility functionsimportfeaturetoolsasftfromrust_dfs.utilsimport*fromrust_dfsimportgenerate_features,compare_featuresets,Featurefromrust_dfs.generate_fake_dataframeimportgenerate_pandas_fake_dataframe# Generate a fake dataset with 4 Numeric columnsdf=generate_pandas_fake_dataframe(n_rows=10,col_defs=[("Numeric",4),])# pick some primitivesf_primitives=[ft.primitives.GreaterThan,# ft.primitives.LessThan]# or use all of them# f_primitives = list(ft.primitives.utils.get_transform_primitives().values())# convert datafame to an entitysetes=df_to_es(df)# run dfs with features_only=Trueft_feats=ft.dfs(entityset=es,target_dataframe_name="nums",trans_primitives=f_primitives,features_only=True,max_depth=1)# ft_feats = [<Feature: F_0>, <Feature: F_1>, <Feature: F_0 > F_1>, <Feature: F_1 > F_0>]# Convert back into a format that we can use to compare with rustc_feats=list(convert_features(ft_feats).values())# Now run using Rust# convert featuretools primitives to rust primitivesr_primitives=convert_primitives(f_primitives)# convert dataframe to rust featuresr_features=dataframe_to_features(es.dataframes[0])# generate engineered features using Rust (create new features only)r_derived_feats=generate_features(r_features,r_primitives)a,b=compare_featuresets(c_feats,r_derived_feats)print("=== Features generated by Featuretools, that were NOT generated by Rust ===")print(a)print()print("=== Features generated by Rust, that were NOT generated by Featuretools ===")print(b)# Persist Rust Features to diskFeature.save_features(r_derived_feats,"all_features.json")Develop GuideInstallpipenvpip install pipenv
pipenv install
pipenv shellEnsureCargo.tomlis configured[lib]name="rust_dfs"crate-type=["cdylib"]Runmaturinmaturin developRunmain.rsTo run as a rust binary:cargo run --no-default-featuresTestcargo test --no-default-featuresWhy--no-default-features? Because we are usingpyo3and is describehere:Finally, don't forget that on MacOS the extension-module feature will cause cargo test to fail without the --no-default-features flag (see the FAQ).
Package: rust-dtw
RustDTWPython extension backed by a multi-threaded Rust implementation of Dynamic Time Warping (DTW).⚡️ Quick InstallTo install rustDTW, simply:pipinstallrust-dtw❓ What is Dynamic Time WarpingIn time series analysis, dynamic time warping (DTW) is one of the algorithms for measuring similarity between two temporal sequences, which may vary in speed1. This has applications in speech recognition, time series classification and neuroscience.Example UsagerustDTW was designed for usage with timeseries data from functional brain regions. However any data represented as a numpy matrix can be provided.importnumpyasnpimportrust_dtwrust_dtw.dtw(s=np.array([0.,1.,2.]),t=np.array([3.,4.,5.]),window=50,distance_mode="euclidean")>>>5.0990195For more examples please seeexamples/or explore thewiki.DevelopingBuilt WithPyO3Maturinrust-numpyRayonSetting up DevTo get started with development, simply clone the repository and edit the main library code insrc/. Once done, simply build and test the code with./build.sh.gitclonehttps://github.com/FL33TW00D/rustDTW.gitcdrust-dtw/
./build.shTestsAll tests are implemented using pytest.poetryrunpytest📈 PerformanceThe above shows the performance of the rustdtw implementation vs the DTAIDistance OpenMP Python version (more benchmarks vs C implementation coming soon).⚠️ LicenserustDTWis free and open-source software licensed under theMIT License.
Package: rust-dwarf
xml_dwarfMining XML/HTML fastThis is the rust part of the libraryxdwarfInstallationpipinstallrust_dwarfHere's a preview on howxdwarfworksdwarf=Dwarf.from_glob(".../pmc_xml/PMC003xxxxxx/PMC31*.xml","PMC",20)Define the mining detail as xpath query pattern, chaining multistage mining is well supported.dwarf.find_one('article-meta > article-id[pub-id-type=pmid]',"pmid")dwarf.find_one("abstract","abstract").find_many("p","paragraph")# mining stage can be chained to longer detialsreference=dwarf.find_one("ref-list","ref_list").find_many("ref","reference")reference.find_one("pub-id[pub-id-type=pmid]","ref_id")reference.find_one("pub-id[pub-id-type=doi]","doi")ref_name=reference.find_many("name","ref_name")ref_name.find_one("surname","ref_surname")dwarf.set_necessary("pmid")dwarf.create_children()Mining startresult=dwarf()See resultresult.child_df().head(2)See child resultresult['ref_list'].child_df().head()
Package: rust-eac-information
Rust EAC InformationInstallpip install rust-eac-informationHow to use?Async methodfromeac_infoimportget_eac_infoasyncdeffoo():returnawaitget_eac_info(76561198256263906)eac=foo()Sync methodimportasynciofromeac_infoimportget_eac_infoeac=asyncio.get_event_loop().run_until_complete(get_eac_info(76561198256263906))Propertyseac.steamid# 76561198256263906eac.is_ban# Trueeac.ban_time# datetime.datetime(2022, 7, 22, 0, 0)eac.days_since_ban# 26eac.post_link# https://twitter.com/rusthackreport/status/1550304891448557569?ref_src=twsrc%5Etfweac.nexus_link# https://www.nexusonline.co.uk/bans/profile/?id=76561198256263906AboutThis script works withnexusand simply converts the information into python objects. If the site does not work, then the script will stop functioning.The author has nothing to do with thenexus
Package: rustedpy-maybe
A simple Maybe (Option) type for Python 3inspired by Rust, fully type annotated.InstallationNot yet available on PyPI. PyPI package coming soon.Latest GitHubmasterbranch version:$pipinstallgit+https://github.com/rustedpy/maybeSummaryExperimental. API subject to change.The idea is that a possible value can be eitherSome(value)orNothing(), with a way to differentiate between the two.SomeandNothingare both classes encapsulating a possible value.Example usage,fromrustedpy-maybeimportNothing,Someo=Some('yay')n=Nothing()asserto.unwrap_or_else(str.upper)=='yay'assertn.unwrap_or_else(lambda:'default')=='default'LicenseMIT License
Package: rust-enum
Rust-style enums for PythonEasily-defined enumerations that can contain data and be matched.Here they are:@enumclassDivisionResult:Undefined=Case()Some=Case(number=float)defdivide(a:float,b:float)->DivisionResult:ifb==0:returnDivisionResult.Undefined()returnDivisionResult.Some(a/b)matchdivide(3,3):caseDivisionResult.Some(n):assertn==1case_:assertFalseAlso Option is implemented, so you can do it even faster in most cases:defdivide(a:float,b:float)->Option[float]:ifb==0:returnOption.Nothing()returnOption.Some(a/b)assertdivide(6,2).unwrap()==3assertdivide(6,2).unwrap_or(None)==3assertdivide(6,0).unwrap_or(None)isNoneassertdivide(6,2).map(lambdav:v*3)==Option.Some(9)assertdivide(6,2).and_then(lambdav:divide(v,3))==Option.Some(1)Installationpipinstallrust_enum
Package: rustenv
rustenvCreate virtual, activate-able environments for Rust, similar tovirtualenvfor Python.A virtual environment is a self-contained installation of Rust, Cargo, etc.,
which is completely isolated from any user-level installations you may have.For example:# Create a new rustenv$rustenvrenv# Run a command in it$renv/bin/rustc--version
rustc1.26.1(827013a312018-05-25)$renv/bin/cargo--version
cargo1.26.0(0e7c5a9312018-04-06)# Activate it to avoid having to prefix your commands$.renv/bin/activate(renv)$rustc--version
rustc1.26.1(827013a312018-05-25)# Install hello-cli: https://crates.io/crates/hello-cli(renv)$cargoinstallhello-cli(renv)$hello
HelloWorld!# Deactivate it to restore your PATH and PS1(renv)$deactivate_rustenv
$rustc--versioncommandnotfound:rustcInstallationrustenv isavailable via PyPIand can be
installed usingpip:$pipinstallrustenvProject statusWhat works right nowEverything in the example above.Remaining workProvide some additional options when creating the rustenv:Allow specifying rustc / cargo versionAllow disabling PS1 modification, similar to virtualenv...and more? (file an issue! :))
Package: rustex
RustexContext Aware Async MutexExampleimportasyncioimportrandomimportcontextvarsimportuuidimportrustexmutex=rustex.Rustex()cv=contextvars.ContextVar('rustex')classPyRustexContext:def__init__(self):self.ctx=str(uuid.uuid4())def__enter__(self):cv.set(self.ctx)mutex.add_context(self.ctx)returnselfdef__exit__(self,type,value,traceback):mutex.remove_context(self.ctx)cv.set(None)classPyRustexMutex:def__init__(self,name:str):self.name=nameasyncdef__aenter__(self):awaitmutex.acquire_mutex(self.name,cv.get())returnselfasyncdef__aexit__(self,type,value,traceback):awaitmutex.release_mutex(self.name,cv.get())defwith_rustex(name:str)->PyRustexMutex:returnPyRustexMutex(name)asyncdefa_main():asyncdefdrama(i):mt='test{}'.format(random.randint(0,3))try:withPyRustexContext():asyncwithwith_rustex(mt):print("In a_main in context{}on mtex{}".format(cv.get(),mt))ifrandom.random()<.5:raiseArithmeticError("Dramatic Test Exception")print("Survived mtex{}".format(mt))exceptArithmeticErrorase:print("Past exception mtex{}".format(mt))passawaitasyncio.gather(*[drama(i)foriinrange(10)])defmain():try:loop=asyncio.new_event_loop()loop.run_until_complete(a_main())loop.close()exceptExceptionase:print(e)if__name__=="__main__":main()
Package: rust-fastql
FastQLTODODeactivate rust and make all Python code still run transparently with GQL_WRAPPER_ACTIVE unsetConvert resolver to subscriptionAdd python parralel GIL lock escape CBAdd option to send path to imageTest with modelTest as dependencyTest with defined multiple build targetsDocumentationCallback example:useful linkshttps://stackoverflow.com/questions/41081240/idiomatic-callbacks-in-rusthttps://alpha2phi.medium.com/serving-ml-model-using-graphql-subscription-7482d77ea061https://stackoverflow.com/questions/57825509/is-this-the-idiomatic-way-to-share-a-closure-callback-among-threads-in-rusthttps://graphql-rust.github.io/types/objects/complex_fields.htmlhttps://docs.rs/juniper/latest/juniper/trait.GraphQLType.htmlhttps://stackoverflow.com/questions/71357427/how-to-pass-a-rust-function-as-a-callback-to-python-using-pyo3
Package: rust-fst
Python bindings forburntsushi’sfst
crate(rustdocs)for FST-backed sets and maps.For reasons why you might want to consider using it, see BurntSushi’s
greatarticle on“Index[ing] 1,600,000,000 Keys with Automata and
Rust”.tl;dr:Work with larger-than-memory setsPerform fuzzy search using Levenshtein automataInstallationYou will need:Python >= 3.3, Python or PyPy >= 2.7 with development headers
installedRust nightly (install viarustup)Clone the repository. Installation withpip installgit+...does
not work
currentlyRunrustup override add nightlyto add an override for rustup to
use the
nightly channel for the repositoryRunpython setup.py bdist_wheelto generate a wheelInstall the wheel withpip installdist/rust_fst-0.1-py3-none-any.whlStatusThe package exposes almost all functionality of thefstcrate,
except for:Combining the results of slicing,searchandsearch_rewith
set operationsUsing raw transducersExamplesfromrust_fstimportMap,Set# Building a set in memorykeys=["fa","fo","fob","focus","foo","food","foul"]s=Set.from_iter(keys)# Fuzzy searches on the setmatches=list(s.search(term="foo",max_dist=1))assertmatches==["fo","fob","foo","food"]# Searching with a regular expressionmatches=list(s.search_re(r'f\w{2}'))assertmatches==["fob","foo"]# Store map on disk, requiring only constant memory for queryingitems=[("bruce",1),("clarence",2),("stevie",3)]m=Map.from_iter(items,path="/tmp/map.fst")# Find all items whose key is greater or equal (in lexicographical sense) to# 'clarence'matches=dict(m['clarence':])assertmatches=={'clarence':2,'stevie':3}DocumentationHead over toreadthedocs.orgfor
the API documentation.If you want to know more about performance characteristics, memory
usageand about the implementation details, please head over to thedocumentation for the Rust
crate
Package: rustgi
rustgirustgi is a fast, lightweight, single-thread Web Server Gateway Interface (WSGI) that allows you to run Python web applications using Rust. It provides a high-performance and efficient environment for hosting WSGI-compatible applications.Featuresserve WSGIset max body sizeGetting StartedInstallationYou can install rustgi with pippipinstallrustgiUsageimportrustgifromappimportapplicationrustgi.serve(application,rustgi.RustgiConfig().set_address("0.0.0.0:8000"),)Benchmarksrustgi└❯wrk-t4-c1000-d30s--latencyhttp://0.0.0.0:8000
Running30stest@http://0.0.0.0:80004threadsand1000connectionsThreadStatsAvgStdevMax+/-StdevLatency5.03ms353.39us10.73ms87.20%Req/Sec12.42k1.90k19.36k53.62%LatencyDistribution50%4.97ms75%5.14ms90%5.35ms99%6.53ms1487223requestsin30.10s,127.65MBreadSocketerrors:connect751,read81,write0,timeout0Requests/sec:49403.93
Transfer/sec:4.24MB
Package: rustgrok
rustgrokrustgrok is a python wrapper for the rust grok library written by Michael Nitchinger(https://github.com/daschl/grok).Installationpip install rustgrokUsagegrok=rustgrok.Grok()grok.compile("%{IP:client} %{WORD:method} %{URIPATHPARAM:request} %{NUMBER:bytes} %{NUMBER:duration}")result=grok.match_against("55.3.244.1 GET /index.html 15824 0.043")assertresult.get("client")=="55.3.244.1"assertresult.get("method")=="GET"assertresult.get("request")=="/index.html"assertresult.get("bytes")=="15824"assertresult.get("duration")=="0.043"
Package: rustground
RustGround  - A way to run Rust without having RustQ: Would you like to compile a rust file without being able to install rust?
A: This!!This is a simple script that wraps theRust PlaygroundAPI via Python.
Thus allowing you to upload the contents of a single Rust file to the playground, and grabbing the output whatever it may be.The need for this is only if you would like to run Rust files or Rust programs without being able to install Rust itself.
Package: rustimport-jupyter
rustimport_jupyterJupyter and IPython magic for compiling Python extensions written in Rust. This project builds on top ofrustimportby adding a IPython magic.InstallationInstall Rust by following Rust'sGetting started Guide.Install package:pip install rustimport_jupyterHow To Userustimport_jupytercompiles Python extensions written in Rust in Jupyter notebooks.
We enable the feature by loading therustimport_jupyterextension from within a Jupyter notebook:%load_extrustimport_jupyterNext, we prefix a cell with the%%rustimportmarker to compile it:%%rustimportusepyo3::prelude::*;#[pyfunction]fnsquare(x:i32)->i32{x*x}Notebook ExamplesNumPy in Rust- Usingrustimport_jupyterto write NumPy code in Rust!Run in Google Colab 💻Running in Google Colab- For Google Colab,rustimport_jupyterand therusttoolchain needs to be installed first.Run in Google Colab 💻.Polars Expression Plugins- Userustimport_jupyterto quickly iterate onPolars expression plugins.Run in Google Colab 💻.Licenserustimport_jupyteris distributed under the terms of the MIT license.
Package: rustkit
Rustkit - A Python library for Rust lovers.Rustkit is a Python library for Rust lovers. It provides a set of tools to write
Rust-like code in Python. It's written by a fellow rustacean, who also loves Python.
In my opinion, Python is a great language, but it lacks some features that Rust
has. Rustkit is an attempt to bring some of those features to Python.Roadmapas of now, only the following features are implemented:ResultOptionwith these features on their way in a future release:VectorIteratorsInstallationpipinstallrustkitUsagefromrustkitimport*# Rust-like optionalsassertsome(10).unwrap()==10assertsome(10).unwrap_or(20)==10assertOption.from_(None)==NONE# Rust-like results, and error handlersassertok(10).unwrap()==10assertok(10).unwrap_or(20)==10assertResult.from_(lambda:10/0)==err(ZeroDivisionError)
Package: rustle
rustle (python rle lib built with rust)Setupgitclonehttps://github.com/AineeJames/rustle.gitcdrustle
python3-mvenv.venvsource.venv/bin/activate
pipinstall-rrequirements.txtExampleimportrustleprint(rustle.encode_str('aaaabbbcc'))# -> 'a4b3c2'print(rustle.decode_str('a4b3c2'))# -> 'aaaabbbcc'
Package: rustlets
rustletsA wavelet library written in Rust, with bindings to python.steps to buildMake sure you have rust and python installed, check rustc --versionSetup virtual environment to your liking, make sure to export PYTHON_CONFIGURE_OPTS="--enable-shared"Install maturin python package into virtual environment. Install numpy as wellFor example, with pip, do
pip install maturinYou will also need matplotlib, scipy, numpy to run demosTo build, run maturin develop --releaseusagesee cwtfuncs.pyTODOMove Array types to ArcArray for cleanliness
Package: rustlite
Better iterators for python (all typed)Examplessimple## create iterator for even integers squaredeven_integers=Iter[int](range(100))\.filter(lambdax:x%2==0)\.map(lambdax:x**2)## to evaluate into a list usemy_list=even_integers.to_list()## The smart list will allow the usage of iterator notation again bytimes2_iter=my_list.iter()\.map(lambdax:x*2)
Package: rust-magic
rust-magicAllows to try rust in Jupyter notebook. Implemented via line/cell magics:InstallationInstall rust and jupyter-notebookcargo install cargo-scriptpip install rust-magicEnjoy :)Third-party cratesare supported via normalcargo scriptsyntax (see below for a more compact notation):Compiler optionscan be provided in the cell mode:NBHere'sa copy-pastable form of all the examples above.Syntax highlightingTo enable rust syntax highlighting in %%rust cells run the following snippet in a python jupyter cell:from notebook.services.config import ConfigManager
c = ConfigManager()
c.update('notebook', {"CodeCell": {"highlight_modes": {"text/x-rustsrc": {"reg": ["^%%rust"]}}}})This only needs to be run once: it stores the setting in a config file in home directory.Long cellsJupyter "doesn't like" long cells: when a cell gets longer than the screen its output is not readily visible.
Here're a few ways how to handle the problem with rust_magic:a) putting dependencies into a separate cell (more)b) collapsing function bodies with codefolding jupyter extensionc) putting function definitions into separate cells (more)Faster compile timescan be acheived by caching dependencies compile results withsccache.
Rust-magic automatically uses it if it is installed in the system (cargo install sccache).
Package: rustmaps.py
rustmaps.pyThis package provides a Python interface forrustmaps.com's HTTP REST API.NB:This is my first API wrapper package so it may have some issues. If you
find any I would greatly appreciate it if you opened an issue or pull request!Roadmap to 1.0.0The current features are not implemented:maps/filter/{filterId}endpoint (paginated map searching)v2Beta endpoints (beta/outpostsandbeta/map/custom)ContributingThis project uses flake8 with default settings. Please make sure your code
passespoetry run flake8andpoetry run pytestbefore opening a pull
request.This project is designed to work with Python 3.8.0+. Please do not open pull
requests with features that break this compatibility.
Package: rust-markdown-text-puller
The stupid simple rust markdown text pullerBasically, this has one function and one function alone. It takes all the human readable text from Markdown, and extracts it. That's it.Why does this library exist?I needed it for a project, and pip was the easiest place to put it.What can I do with this library?Literally anything. I'm not fussed. It's ten lines of code.Installationpipinstallrust-markdown-text-pullerUsagefromrust_markdown_text_pullerimportget_raw_textprint(get_raw_text("# Raw Markdown!"))It really is that simpleLicenseMIT license. See the LICENSE file for details
Package: rust-neighborlist
Neighborlist implementation in rust with python interfaceOnly faster thanmatscipyin few casesThis rust implementation is only faster than matscipy at high density.
i.e. when there is a lot of points within the cutoff distance.Installpip install rust-neighborlistTestimportnumpyasnppos=np.random.uniform(-4.0,3.0,(100,3))cutoff=2.0# Using matscipy.neighboursfrommatscipy.neighboursimportneighbour_listi,j=neighbour_list('ij',positions=pos,cutoff=cutoff)# Using rust neighborlistfromneighborlistimportneighbor_list_iji,j=neighbor_list_ij(pos,cutoff,self_interaction=False)Install from sourcegit clone https://github.com/mariogeiger/rust-neighborlist.git
cd rust-neighborlist
pip install .Publish to pypimaturin publish
Package: rust-playground
rust-without-rustThis is a small tool written in Python which allows you to compile simple
Rust code throughhttp://play.rust-lang.org.InstallationYou can install this package from PyPi.pip install rust-playgroundYou can also clone this repository locally and run setup.py.python setup.py installUsageusage: playground [-h] [--release] [--channel {stable,nightly,beta}]
                  [--target {llvm-ir,wasm,asm,mir,ast}] [--disable-color]
                  FILE

Use Python to execute simple Rust code by running it on https://play.rust-
lang.org/

positional arguments:
  FILE                  path to file containing Rust code

optional arguments:
  -h, --help            show this help message and exit
  --release             build artifacts in release mode, with optimizations
                        (default: False)
  --channel {stable,nightly,beta}
                        set Rust channel (default: stable)
  --target {llvm-ir,wasm,asm,mir,ast}
                        build for the target triple (default: ast)
  --disable-color       disable colors and styles for stderr (default: False)ExampleSay you want to quick test some Rust code but your current machine doesn't have
the Rust compiler installed.// test.rsfnmain(){forxin1..5{println!("{}",x);}}$playgroundtest.rsCompilingplaygroundv0.0.1(file:///playground)Finisheddev[unoptimized+debuginfo]target(s)in2.36sRunning`target/debug/playground`1234It reads yourtest.rsand passes it tohttp://play.rust-lang.orgfor compilation
and then returns stdout/stderr output on your terminal, which looks very alike to$ cargo run.License