Saravanan666/pypi-org huggingface dataset:
Package: tiktoken-async
⏳ tiktoken-asynctiktoken is a fastBPEtokeniser for use with
OpenAI's models.importasyncioimporttiktoken_asyncenc=asyncio.run(tiktoken_async.get_encoding("cl100k_base"))assertenc.decode(enc.encode("hello world"))=="hello world"# To get the tokeniser corresponding to a specific model in the OpenAI API:enc=asyncio.run(tiktoken_async.encoding_for_model("gpt-4"))The open source version oftiktoken-asynccan be installed from PyPI:pip install tiktoken-asyncThe tokeniser API is documented intiktoken_async/core.py.Example code usingtiktokencan be found in theOpenAI Cookbook.Performancetiktokenis between 3-6x faster than a comparable open source tokeniser:Performance measured on 1GB of text using the GPT-2 tokeniser, usingGPT2TokenizerFastfromtokenizers==0.13.2,transformers==4.24.0andtiktoken==0.2.0.Getting helpPlease post questions in theissue tracker.If you work at OpenAI, make sure to check the internal documentation or feel free to contact
@shantanu.Extending tiktokenYou may wish to extendtiktoken-asyncto support new encodings. There are two ways to do this.Create yourEncodingobject exactly the way you want and simply pass it around.importasynciocl100k_base=asyncio.run(tiktoken.get_encoding("cl100k_base"))# In production, load the arguments directly instead of accessing private attributes# See openai_public.py for examples of arguments for specific encodingsenc=tiktoken_async.Encoding(# If you're changing the set of special tokens, make sure to use a different name# It should be clear from the name what behaviour to expect.name="cl100k_im",pat_str=cl100k_base._pat_str,mergeable_ranks=cl100k_base._mergeable_ranks,special_tokens={**cl100k_base._special_tokens,"
":100264,"
":100265,})Use thetiktoken_async_extplugin mechanism to register yourEncodingobjects withtiktoken_async.This is only useful if you needtiktoken_async.get_encodingto find your encoding, otherwise prefer
option 1.To do this, you'll need to create a namespace package undertiktoken_async_ext.Layout your project like this, making sure to omit thetiktoken_ext/__init__.pyfile:my_tiktoken_extension
├── tiktoken_async_ext
│   └── my_encodings.py
└── setup.pymy_encodings.pyshould be a module that contains a variable namedENCODING_CONSTRUCTORS.
This is a dictionary from an encoding name to a function that takes no arguments and returns
arguments that can be passed totiktoken_async.Encodingto construct that encoding. For an example, seetiktoken_async_ext/openai_public.py. For precise details, seetiktoken_async/registry.py.Yoursetup.pyshould look something like this:fromsetuptoolsimportsetup,find_namespace_packagessetup(name="my_tiktoken_extension",packages=find_namespace_packages(include=['tiktoken_async_ext*']),install_requires=["tiktoken_async"],...)Then simplypip install ./my_tiktoken_extensionand you should be able to use your
custom encodings! Make surenotto use an editable install.
Package: tiktoken-cli
tiktoken-cliSimple wrapper aroundtiktokento use
it in your favorite language.WhyIf you play with openAI's GPT API, you probably encounter one annoying
problem : your prompt is allowed a given amount of tokens, you have no
idea how those tokens are counted, and you only know it was too much when
the API replies with an error, which is seriously annoying (and slow).OpenAI published itstiktokentoken
counting library to solve that, which helps a lot! If you're writing a
python program.tiktoken-cliallows you to write your program in any language. It's a
simple wrapper aroundtiktokenthat will read your prompt from STDIN and
write the tokens to STDOUT. Now you can write your program in
your favorite language and use the CLI for token counting.It's almost not worth publishing a github repos for so few lines, but I
figured that README explanation would be valuable for people wondering how
to use openAI's API in their favorite language, the code is merely an
executable example.A note for those of you who may be new to GPT's API : having the count of
tokens from your prompt alone is not enough to avoid the exceed context
errors. This is because the API wraps your messages with its own content.
The exact algorithm to know if you're going to exceed the count is
documentedin the API doc here(it's in the block "Deep dive : Counting tokens for chat API calls").Installtiktoken-cliis a simple script, you can install via pipx.pipxinstalltiktoken-cliUsageTo usetiktokensend your prompt as STDIN, and read the tokens
as STDOUT.Examples:In shell:tiktoken--modelgpt-4in.txtout.txtReplace the file with-for standard input/output:echo"Hello, world!"|tiktoken--modelgpt-4-out.txt# writes tokens to out.txttiktoken--modelgpt-4in.txt-# writes tokens to stdoutYou can count tokens easily:echo"Hello, world!"|tiktoken-|wc-lModeltiktokencounts tokens differently based on model. By default, the model
used is gpt-3.5-turbo.You can change the model using the--modeloption.For the full list of models available:tiktoken--help
Package: tiktokget
# tiktokget
A tiktok downloader for Linux (and probably all other POSIX-compatible systems). Downloads all the TikTok videos of a user via providing their username, with or without watermark.PrerequisitesYou’ll need:[Firefox](https://www.mozilla.org/en-US/firefox/new/)[gecko-driver](https://github.com/mozilla/geckodriver/releases)[Python 3.x](https://www.python.org/)[yt-dlp](https://github.com/yt-dlp/yt-dlp/) and [most of it’s dependancies (pycryptodomex not required)](https://github.com/yt-dlp/yt-dlp/blob/master/requirements.txt) for getting videos without watermarkSimply install python 3.x using your package manager or the standard distribution, then install tiktokget with:pip3 install tiktokgetInvocation is simple:tiktokget usernameWill download every video (without watermarks) by username, into a folder, also named after their username.
The videos will be titled their title in tiktok, prefixed by their ID number.To download with watermarks, or without the use of yt-dlp, use:tiktokget -w usernameortiktokget username -wWhichever one floats your boat.to get help with usage, simply invoke tiktokget without any arguments, ie:tiktokgetI recently added -f, which runs selenium in GUI mode, so you can interact with the browser. This should help with failed downloads.
Package: tiktokimage
TikTok StyleAdd TikTok effect to imageUsage# usage: tiktokimage [-h] [--input_path INPUTIMAGE] [--output_path OUTPUTIMAGE]optionarguments:-h,--helpshowthishelpmessageandexit--input_pathpathofimagetoaddeffect--output_pathpathofoutputimageInstallpipinstalltiktopimage
Package: tiktokpy
TikTokPyTooling thatautomatesyour social media interactions to “farm” Likes and Followers on TikTokQuickstart.pyimportasynciofromtiktokpyimportTikTokPyasyncdefmain():asyncwithTikTokPy()asbot:# Do you want to get trending videos? You can!trending_items=awaitbot.trending(amount=5)foritemintrending_items:# ❤️ you can like videosawaitbot.like(item)# or unlike themawaitbot.unlike(item)# or follow usersawaitbot.follow(item.author.username)# as and unfollowawaitbot.unfollow(item.author.username)# 😏 getting user's feeduser_feed_items=awaitbot.user_feed(username="tiktok",amount=5)foriteminuser_feed_items:# 🎧 get music title, cover, link, author name..print("Music title: ",item.music.title)# #️⃣ print all tag's title of videoprint([tag.titlefortaginitem.challenges])# 📈 check all video statsprint("Comments: ",item.stats.comments)print("Plays: ",item.stats.plays)print("Shares: ",item.stats.shares)print("Likes: ",item.stats.likes)# and many other things 😉asyncio.run(main())InstallationInstall with pip:pipinstalltiktokpyInstall browser by playwrightplaywrightinstallfirefoxRunTo create your cookies and settings.toml file simply runpythonquicklogin.pyand then after you login runpythonquickstart.py
Package: tiktok-rapidapi
TikTok API on RapidAPIAvailable onPyPiInstallusing pippip install tiktok_rapidapiusing poetrypoetry add tiktok_rapidapiBuildWindowsgit clone https://github.com/dankaprogg/tiktok_rapidapi.git

cd tiktok_rapidapi
py -m venv venv
cd venv/Scripts/ && activate && cd ../../
pip install -r requirements.txt
py setup.py sdist bdist_wheel installLinuxgit clone https://github.com/dankaprogg/tiktok_rapidapi.git

cd tiktok_rapidapi
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
python3 setup.py sdist bdist_wheel installTestsWe are using pytest framework with pytest-asynciopipinstallpytest
pipinstallpytest-asynciopytest-vtests
Package: tiktok-research-client
TikTok Research ClientTikTok Research ClientTikTok Research Client is a command-line tool for collecting data from TikTok using the TikTok Research API. This tool provides a streamlined way to fetch information about users, search for videos by, and collect comments on specific videos.YOU NEED TO HAVE ACCESS TO THETIKTOK RESEARCH APITO USE THIS TOOL.RequirementsRequires granted access to theTikTok Research API. Once permisison has been granted, fill out the.envfile.InstallationYou can installTikTok Research ClientviapipfromPyPI:$pipinstalltiktok-research-clientUsagePlease see theCommand-line Referencefor details.To run the script, navigate to the folder containing main.py and execute the following command:tiktok-research-client[OPTIONS]orpython-mtiktok-research-client[OPTIONS]Options-q, --query_option: What do you want to query? Choose from user, search, or comments.-i, --query_input: What is the input? For user, enter the username. For search, enter the keywords separated by commas. For comments, enter the video ID.-m, --collect_max: Maximum number of videos to collect (default is 100).-d, --start_date: The start date for data collection, formatted as YYYY-MM-DD (default is 2023-01-01).ExamplesTo get user information for the usernamejohn_doe:tiktok-research-client-quser-ijohn_doeTo search for videos related to coding:tiktok-research-client-qsearch-i"climate,global warming"-m50To get comments for a video with ID 123456789:tiktok-research-client-qcomments-i123456789Use custom queryCheck out thedocumentationon how to construct you own custom query.fromtiktok_research_client.data_collection.collectimportTiktokClientclient=TiktokClient()query={"query":{"and":[{"operation":"IN","field_name":"region_code","field_values":["US"],},{"operation":"EQ","field_name":"hashtag_name","field_values":["climate"],},],"not":[{"operation":"EQ","field_name":"video_length","field_values":["SHORT"]}],},"max_count":100,"start_date":"20230101","end_date":"20230115",}url="https://open.tiktokapis.com/v2/research/video/query/?fields=id,region_code,like_count,username,video_description,music_id,comment_count,share_count,view_count"data=client.query(query=query,url=url)ContributingContributions are very welcome.
To learn more, see theContributor Guide.LicenseDistributed under the terms of theMIT license,TikTok Research Clientis free and open source software.IssuesIf you encounter any problems,
pleasefile an issuealong with a detailed description.Known IssuesMany. This is a super lightweight and simple client, and has not been tested extensively - actually not at all. Will do at some point. If the pre-defined CLI commands are insufficient, then just make your own query and usequeryfunction.CreditsThis project was generated from@cjolowicz'sHypermodern Python Cookiecuttertemplate.
Package: tiktok-scraper
InstallationTo install with pip, runpip3installtiktok-scraperSimple UsageTo use it with default settings, the latest version of Chrome is required. After which, you can runtiktok-scraper<USERNAME>which downloads locally to a folder with the same name as the usernameAPIusage: tiktok-scraper [-h] [--driver DRIVER] [--driver-type DRIVER_TYPE]
                      [--show-browser] [--delay DELAY] [--location LOCATION]
                      username
positional arguments:
  username              The TikTok username

optional arguments:
  -h, --help            show this help message and exit
  --driver DRIVER       Driver location
  --driver-type DRIVER_TYPE
                        Type of driver (i.e. Chrome)
  --show-browser        Shows browser while scraping. Useful for debugging
  --delay DELAY         Number of seconds to delay between video downloading
  --location LOCATION   Location to store the filesOPTIONS--driver        Location of the driver (i.e. ./chromedriver). If not specified, it checks in `$PATH` first, and if it's not in there, a chromedriver is downloaded locally

--driver-type   Type of driver (i.e. Chrome, Firefox)

--show-browser  If set, the scraping is done with showing the browser. This is useful for debugging why sometime scraping may fail

--delay         The number of seconds to delay between video downloading. This may be important if there's a rate limit

--location      Location of where the videos are downloaded. If not specified, location is the same as the username
Package: tiktok-signature
Serverimportasynciofromplaywright.async_apiimportasync_playwrightfromtiktok_signature.serverimportmake_serverasyncdefmain():asyncwithasync_playwright()asplaywright:server=awaitmake_server(playwright=playwright,host="127.0.0.1",port=8002)awaitserver.start()awaitasyncio.Event().wait()asyncio.run(main())As packageimportasynciofromtiktok_signatureimportSignerfromplaywright.async_apiimportasync_playwrightasyncdefmain():asyncwithasync_playwright()asplaywright:signer=Signer(playwright=playwright)awaitsigner.init()awaitsigner.sign("url")asyncio.run(main())DockerYou can build image yourselfdocker build . -t tiktok-signatureOr start with the second command and use the ready imagedocker run --name=tiktok-signature --restart=always -p 8002:8002 -e port=8002 sheldygg/tiktok-signature
Package: tikup
TikUpAn auto downloader and uploader for TikTok videos.RequirementsTikTok-Api,internetarchive,youtube-dl, andplaywrighton Python 3.How to InstallInstall withpip install tikup.
Update withpip install -U tikup.How to Useusage: tikup [-h] [--no-delete] [--hashtag] [--limit LIMIT] [--use-download-archive] [--id] [--liked]
             [--folder FOLDER] [--no-upload]
             user

An auto downloader and uploader for TikTok videos.

positional arguments:
  user

optional arguments:
  -h, --help            show this help message and exit
  --no-delete           don't delete files once uploaded to the Internet Archive
  --hashtag             download this hashtag
  --limit LIMIT         set limit on amount of TikToks to download
  --use-download-archive
                        record the video url to the download archive. This will download only videos not listed in the
                        archive file. Record the IDs of all downloaded videos in it.
  --id                  download this video ID
  --liked               download this user's liked posts
  --folder FOLDER       set download destination (default: ~/.tikup)
  --no-upload           turn off uploading to the Internet Archive
Package: tikuppp
TikUpAn auto downloader and uploader for TikTok profiles.RequirementsTikTok-Api,internetarchive, andyoutube-dlon Python 3.How to InstallInstall withpip install tikup.How to Useusage: tikup.py [-h] [--no-delete] [--hashtag] [--limit LIMIT]
                [--use-download-archive] [--id] [--liked] [--sort]
                user

An auto downloader and uploader for TikTok videos.

positional arguments:
  user

optional arguments:
  -h, --help            show this help message and exit
  --no-delete           don't delete files when done
  --hashtag             download hashtag instead of username
  --limit LIMIT         set limit on amount of TikToks to download
  --use-download-archive
                        record the video url to the download archive. This
                        will download only videos not listed in the archive
                        file. Record the IDs of all downloaded videos in it.
  --id                  download this video ID
  --liked               download the user's liked posts
  --sort                sort into folders based on TikTok username
Package: tikuppppp
TikUpAn auto downloader and uploader for TikTok profiles.RequirementsTikTok-Api,internetarchive, andyoutube-dlon Python 3.How to InstallInstall withpip install tikup.How to Useusage: tikup.py [-h] [--no-delete] [--hashtag] [--limit LIMIT]
                [--use-download-archive] [--id] [--liked] [--sort]
                user

An auto downloader and uploader for TikTok videos.

positional arguments:
  user

optional arguments:
  -h, --help            show this help message and exit
  --no-delete           don't delete files when done
  --hashtag             download hashtag instead of username
  --limit LIMIT         set limit on amount of TikToks to download
  --use-download-archive
                        record the video url to the download archive. This
                        will download only videos not listed in the archive
                        file. Record the IDs of all downloaded videos in it.
  --id                  download this video ID
  --liked               download the user's liked posts
  --sort                sort into folders based on TikTok username
Package: tikv-client
TiKV Client (Python)This library is a TiKV client in Python; it supports both synchronous and asynchronous API.It's built on top ofTiKV Client in Rustvia
CFFI andPyO3 Python binding.This client is still in the stage of prove-of-concept and under heavy development.InstallThis package requires Python 3.6+ and pip 19+. Currently only supports MacOS (x86_64 and aarch64) and Linux in x86_64 with GLibc >= 2.12.pip3 install tikv-clientInstall (Development)> pip3 install maturin

> maturin build
🍹 Building a mixed python/rust project
🔗 Found pyo3 bindings
🐍 Found CPython 3.8 at python3.8
📦 Built source distribution to /home/andy/Code/client-py/target/wheels/tikv_client-0.1.0.tar.gz
    Blocking waiting for file lock on build directory
   Compiling pyo3 v0.12.3
   Compiling tikv-client v0.1.0 (/home/andy/Code/client-py)
    Finished dev [unoptimized + debuginfo] target(s) in 17.62s
📦 Built wheel for CPython 3.8 to /home/andy/Code/client-py/target/wheels/tikv_client-0.1.0-cp38-cp38-manylinux1_x86_64.whl

> pip3 install target/wheels/tikv_client-0.1.0-cp38-cp38-manylinux1_x86_64.whl
Installing collected packages: tikv-client
Successfully installed tikv-client-0.1.0ExamplePython TiKV client is synchronous by defult:fromtikv_clientimportTransactionClientclient=TransactionClient.connect("127.0.0.1:2379")txn=client.begin(pessimistic=True)txn.put(b"k1",b"v1")txn.put(b"k2",b"v2")txn.put(b"k3",b"v3")txn.put(b"k4",b"v4")txn.put(b"k5",b"v5")txn.commit()snapshot=client.snapshot(client.current_timestamp())print(snapshot.get(b"k3"))print(snapshot.batch_get([b"k1",b"k4"]))fork,vinsnapshot.scan(b"k1",end=None,limit=10,include_start=False):print(k,v)Asynchronous client is available intikv_client.asynchronousmodule. Modules and classes under this modules is similar to the synchronous ones.importasynciofromtikv_client.asynchronousimportTransactionClientasyncdefmain():client=awaitTransactionClient.connect("127.0.0.1:2379")txn=awaitclient.begin(pessimistic=True)awaittxn.put(b"k1",b"v1")awaittxn.put(b"k2",b"v2")awaittxn.put(b"k3",b"v3")awaittxn.put(b"k4",b"v4")awaittxn.put(b"k5",b"v5")awaittxn.commit()snapshot=client.snapshot(awaitclient.current_timestamp())print(awaitsnapshot.get(b"k3"))print(awaitsnapshot.batch_get([b"k1",b"k4"]))fork,vinawaitsnapshot.scan(b"k1",end=None,limit=10,include_start=False):print(k,v)event_loop=asyncio.get_event_loop()asyncio.get_event_loop().run_until_complete(main())
Package: tikz2pdf
tikz2pdfCommand line utility to make standalone PDF files from TikZ code.Free software: ISC licenseDocumentation:https://tikz2pdf.readthedocs.org.FeaturesTODOCreditsThis package was created withCookiecutterand theaudreyr/cookiecutter-pypackageproject template.History0.1.0 (2016-1-22)First release on PyPI.
Package: tikzify
A set of utilities for programmatically generating TikZ code.Contribution guidelinesConventionsNaming conventions are according to PEP8.How to clean the source:isort.pylinttikzifyflake8tikzifyRunningThis macro is helpful for running examples:functiondm{python"$1.py"$2&&pdflatex-shell-escape$1&&open$1.pdf}The basal ganglia example can be run by doingdmbasal_gangliafrom the examples folder.  It should produceexamples/basal_ganglia.pdf, which shows all of the output, as well asexamples/figures/basal_ganglia-*.pdf, which are the individual diagrams to be included.A copy of thepdf <examples/basal_ganglia.pdf>is provided.  It shows three programmatically-generated diagrams, with various sections highlighted.Whom do I talk to?Neil Girdhar
Package: tikzplotly
TikzplotlyConvertplotlyfigures to tikz code for inclusion intoPGFPlots(PGF/TikZ) figures.This results in a tikz code, that can be easily included into your LaTeX document.
This also allows to easily edit the content of the figure.ExampleThe following Python codeimportplotly.expressaspximporttikzplotlydf=px.data.gapminder().query("continent == 'Oceania'")fig=px.line(df,x='year',y='lifeExp',color='country',markers=True)tikzplotly.save("example.tex",fig)will result in the following tikz code\pgfplotstableread{data0 Australia New_Zealand
1952 69.12 69.39
1957 70.33 70.26
1962 70.93 71.24
1967 71.1 71.52
1972 71.93 71.89
1977 73.49 72.22
1982 74.74 73.84
1987 76.32 74.32
1992 77.56 76.33
1997 78.83 77.55
2002 80.37 79.11
2007 81.235 80.204}\dataZ\begin{tikzpicture}\definecolor{636efa}{HTML}{636efa}\definecolor{EF553B}{HTML}{EF553B}\begin{axis}[
xlabel=year,
ylabel=lifeExp,
]\addplot+ [mark=*, solid, color=636efa, mark options={solid, draw=636efa}] table[y=Australia]{\dataZ};\addlegendentry{Australia}\addplot+ [mark=*, solid, color=EF553B, mark options={solid, draw=EF553B}] table[y=New_Zealand]{\dataZ};\addlegendentry{New Zealand}\end{axis}\end{tikzpicture}InstallationTikzplotly is available from thePython Package Index, so it can be installed withpip:pipinstalltikzplotlyUsageGenerate the figure with Plotly,Invoketikzplotlyto convert the figure to tikz code :importtikzplotlytikzplotly.save("figure.tex",fig)Add the content of the generated filefigure.texto your LaTeX document :\input{figure.tex}To correctly compile the document, you will need to add the following packages to your preamble :\usepackage{pgfplots}\pgfplotsset{compat=newest}NoteThis module is in development and new features are added bit by bit, when needed. If you have a feature request, please open an issue with the plotly figure you want to convert and the desired output.
You can also submit a pull request with the desired feature !Some feature can result in different output between the plotly figure and the tikz figure, for instance the size of markers.ReferencesplotlyPGFPlots(withmanual)PGF/TikZtikzplotlib: a similar project for matplotlib figures from which this one is inspired.LicenseThis project is licensed under the MITLicense.
Package: tikzpy
TikZpy package for drawing in TikZWhat Is This?TikZpy simplifies the art of drawing by code tikz figures in eps, png and tikz LaTeX compatible figures using PythonHow To Use ThisInstall as,python3 -m pip install tikzpyMore info intikzpy.readthedocs.ioRequires to install MikTex (miktex.org) or similar LaTeX distribution
Package: tikz-python
Tikz-PythonAn object-oriented Python approach towards providing a giant wrapper for Tikz code, with the goal of streamlining the process of creating complex figures for TeX documents.To install it, runpip install tikz-pythonDocumentationWe have documentation now! Please visit thedocumentationsite.How to Use: BasicsAn example of this package in action is below.fromtikzpyimportTikzPicture# Import the class TikzPicturetikz=TikzPicture()tikz.circle((0,0),3,options="thin, fill=orange!15")arc_one=tikz.arc((3,0),0,180,x_radius=3,y_radius=1.5,options="dashed")arc_two=tikz.arc((-3,0),180,360,x_radius=3,y_radius=1.5)tikz.show()# Displays a pdf of the drawing to the userwhich producesWe explain line-by-line the above code.from tikzpy import TikzPictureimports theTikzPictureclass from thetikzpypackage.The second line of code is analogous to the TeX code\begin{tikzpicture}and\end{tikzpicture}. The variabletikzis now a tikz environment, specifically an instance of the classTikzPicture, and we can now append drawings to it.The third, fourth, and fifth lines draw a filled circle and two elliptic arcs, which give the illusion of a sphere.In the last line, the callshow()immediately displays the PDF of the drawing to the user.