Saravanan666/pypi-org huggingface dataset:
Package: tinydbstorage
tinydb-storageTiny db storage extension, this is an unofficial fromtinydb. I'm creating this
extension based on my case only.InstallationpipinstalltinydbstorageStorage extension to use TinydbMemory storageFile storageRedis storageS3 storageMemory storage exampleimportrequestsfromtinydbimportTinyDB,Queryfromtinydbstorage.storageimportMemoryStoragedb=TinyDB(storage=MemoryStorage)definsert_data():resp=requests.get("https://jsonplaceholder.typicode.com/users")db.table("users").insert_multiple(resp.json())File storage exampleimportosimportrequestsfromtinydbimportTinyDB,Queryfromtinydbstorage.storageimportFileStoragedb_path=os.path.join(os.path.dirname(__file__),"db.json")db=TinyDB(path=db_path,storage=FileStorage)definsert_data():resp=requests.get("https://jsonplaceholder.typicode.com/users")db.table("users").insert_multiple(resp.json())Redis storage exampleimportrequestsfromtinydbimportTinyDB,Queryfromtinydbstorage.storageimportRedisStoragedb=TinyDB(storage=RedisStorage,redis_uri="redis://:secret@localhost:6379/0")definsert_data():resp=requests.get("https://jsonplaceholder.typicode.com/users")db.table("users").insert_multiple(resp.json())S3 storage exampleimportrequestsfromtinydbimportTinyDB,Queryfromtinydbstorage.schemaimportS3ConfigSchemafromtinydbstorage.storageimportS3Storageconfig=S3ConfigSchema.parse_obj({"bucket_name":"foo","file_path":"foo/bar/baz.json","region_name":"ap-southeast-1","access_key_id":"foobar","secret_access_key":"foobar",})db=TinyDB(storage=S3Storage,config=config)definsert_data():resp=requests.get("https://jsonplaceholder.typicode.com/users")db.table("users").insert_multiple(resp.json())Help & BugsIf you are still confused or found a bug,
pleaseopen the issue. All bug reports are appreciated, some
features have not been tested yet due to lack of free time.Licensetinydb-storagereleased under MIT. SeeLICENSEfor more details.
Package: tinydb-viewer
tinydb-viewerView records generated fromTinyDBand alike (e.g. list of dictionaries.)InstallationMethod 1:$ pip install tinydb-viewerMethod 2:Clone the project from GitHubGet poetryandpoetry install tinydb-viewer --path PATH/TO/TINYDB/VIEWERUsageRun a server initiation script first. This will allow you to edit the data as well.fromtinydb_viewerimportTinyDBTinyDB('db.json').runserver()Then, in IPython or in Jupyter Notebook,>>>fromtinydb_viewerimportTinyDB>>>tdb=TinyDB('db.json')>>>tdb.search(tdb.query['foo']=='bar',sort_func=lambdax:x['baz'])>>>tdb.view()'The first page is shown.'>>>tdb.view(-1)'The last page is shown.'>>>tdb.previous()'The previous page (i-1) is shown.'>>>tdb.next()'The next page (i+1) is shown.'BonusI extended TinyDB a little. My TinyDB is'ensure_ascii' = Falseby default, so that the file is a little smaller.Also, it will usetinydb-constraintby default, if it is installed.ScreenshotsRelated projectstinydb-constraint- Apply constraints before inserting and updating TinyDB records.
Package: tinydebug
TinyDebugTinyDebug is a Python tool used to create simple, shareable videos of step-by-step execution of code, just like this one:InstallationUse thepippackage manager to install TinyDebugpipinstalltinydebugThen, you can run it as a command-line tool:tinydebug--helpif that doesn't work, try runningpython -m tinydebug --help.ContributingWant to contribute? That's awesome! Have a look at the issues page, and pick something to work on.
Please comment on an issue to let me know you're working on it, so that I can help you along the way :)Found a bug, some typo, or want to suggest a cool new feature? Open up an issue, we'll discuss it and start working on it!
And if you fix a small bug or want to make a small change that doesn't have an issue already, just send a pull request! Pull requests are always welcome.LicenseThis repository is maintained by AlephZero, and was created during Google Code-In 2019.The code is licensed under the MIT license.
Package: tinydenticon
tinydenticonPython 3 implementation of Identicon.Specifically designed to produce the same results asidenticon.jsInstallation:Pip:pip3installtinydenticonUsage example:fromPILimportImagefromtinydenticonimportIdenticondefmain():text="tinytengu"size=500rounds=1337identicon=Identicon(text.encode(),hash_rounds=rounds,image_side=size)image=Image.new("RGB",(size,size))image.putdata(identicon.get_pixels())image.show()if__name__=="__main__":main()LicenseGNU GPL v3
Package: tinydns
tinydns基于gevent异步IO框架实现的轻量DNS服务器，易于配置和启动，可安装于Python2或Python3环境， 可用于爬虫等业务中。1.如何安装使用pip 安装pip install  tinydns2.配置及使用示例创建配置文件vim /etc/tinydns.conf在文件中输入如下内容：[tinydns]
*.baidu.com = 192.168.1.1,192.168.1.2,192.168.1.3
www.baidu.com  = 192.168.1.4,192.168.1.5
image.baidu.com =  192.168.1.1上面的配置文件所代表的意思是：所有符合*.baidu.com的域名(除了www.baidu.com image.baidu.com)均随机解析到192.168.1.1 192.168.1.2 192.168.1.3中的随意一个所有符合www.baidu.com的域名 随机解析到 192.168.1.4 192.168.1.5中的随机一个所有符合image.baidu.com的域名 解析到 192.168.1.1除了以上之外的域名则直接从本机网络设置中获取到对应的DNS记录返回给客户端启动服务tinydns-c/etc/tinydns.conf备注：如在服务运行中 修改了配置文件 无需重启，服务会自动加载新的配置文件内容。3.联系我们zhoukunpeng@gongchang.com18438697706@163.com
Package: tinydownload
Download files from tinyupload.com.Installationsudo pip install -U tinydownloador if you like to live on the bleeding edge:sudo python setup.py installRun it usingtinydownloadUsageusage: tinydownload [-h] [-o OUTPUT_FILE] query

Download files from tinyupload.com

optional arguments:
  -h, --help            show this help message and exit

required arguments:
  query                 the file_id or the tinyupload link
  -o OUTPUT_FILE, --output-file OUTPUT_FILE
                                                path and name of the fileContributingAny PR’s in bug fixes, features or even this documentation are most
welcome!LicenseThe MIT License
Package: tiny-dungeon
tiny-dungeon-chargenPython package to generate player characters for theTiny Dungeontabletop roleplaying game (1st edition) by Brandon McFaddon.InstallationThis package may be installed from pypi via pip:python -m pip install tiny-dungeonUsageInstantiate a character>>>fromtiny_dungeon.charimportTinyDungeonPC>>>>>>pc=TinyDungeonPC()>>>>>># view as dictionary>>>pc.as_dict(){'race':'Fey','hp':6,'race_trait':'Bow Mastery','race_trait_desc':'You have Mastered bows and have Advantage when using them. This is in addition to the Mastered weapon chosen at Adventurer Creation.','trait1':'Acrobat','trait1_desc':'You gain Advantage when Testing to do acrobatic tricks such as tumbling, long-distance jumps, climbing, and maintaining balance.','trait2':'Marksman','trait2_desc':'When you Focus, your next attack with a ranged weapon is successful on a Test of 3, 4, 5, or 6.','trait3':'Nimble Fingers','trait3_desc':'You gain Advantage when Testing to pick locks, pick pockets, or steal.','weapon_proficiency':'Ranged','weapon':'Throwing Knives','gold_pieces':10,'equipment':['bedroll','flint and steel','belt pouch','rucksack','lantern','empty waterskin','oil (3 pints)',"50' rope",'rations (7 days)','torch','cloak'],'family_trade':''}>>>>>># print character to STDOUT>>>pc.print_char()NAME:_________________________________RACE:FeyHITPOINTS:6WEAPONPROFICIENCY:RangedWEAPON:ThrowingKnivesMASTEREDWEAPON:______________________TRAITS------------BowMastery:YouhaveMasteredbowsandhaveAdvantagewhenusingthem.ThisisinadditiontotheMasteredweaponchosenatAdventurerCreation.Acrobat:YougainAdvantagewhenTestingtodoacrobatictrickssuchastumbling,long-distancejumps,climbing,andmaintainingbalance.Marksman:WhenyouFocus,yournextattackwitharangedweaponissuccessfulonaTestof3,4,5,or6.NimbleFingers:YougainAdvantagewhenTestingtopicklocks,pickpockets,orsteal.EQUIPMENT------------bedrollflintandsteelbeltpouchrucksacklanternemptywaterskinoil(3pints)50' roperations(7days)torchcloakGOLDPIECES:10
Package: tiny-elastic-cli
tiny-elastic-cliA simple cli for querying elasticsearch. Outputs json.ConfigLaunching the cli once will propagate ~/.tiny-elastic-cli.confInstallingGlobal installpip install tiny-elastic-cliLocal installpip install --user tiny-elastic-cliIn the case of local install, the script will be available through~/.local/bin/elasticor similar. Consider adding.local/binto your path.Usageelastic --helpelastic 'foo:bar'elastic 'foo:bar' --source 'otherfield' | jq .License(The MIT License)Copyright (c) 2018 Einar Otto Stangvik <einaros@gmail.com>Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Package: tinyerr
TinyErrTinyErr (pronounced tinier) provides tiny errors that get straight to the point.Project is still in early Alpha – significant changes are expected and
features are limitedInstallpip install tinyerrWhile TinyErr is in alpha, it may be best to install directly from GitHub for
the latest changes:pip install git+https://github.com/James-Ansley/tinyerr.gitExamplemain.py:deffoo(x,y):returnbar(x,y)defbar(x,y):returnx+yresult=foo(5,"Hello")print(result)Runningtinyerr main.pyproduces:File "main.py", line 9, in <module>

    result = foo(5, "Hello")
             ^^^^^^^^^^^^^^^

File "main.py", line 2, in foo

    return bar(x, y)
           ^^^^^^^^^

File "main.py", line 6, in bar

    return x + y
           ~~^~~

TypeError: cannot do `<int> + <str>`By default, the traceback limit is set to 0 (the entire stack). This can be
configured with the-tbor--tracebackcommand line option.
e.g.tinyerr -tb 1 main.pywill yield:File "main.py", line 6, in bar

    return x + y
           ~~^~~

TypeError: cannot do `<int> + <str>`
Package: tinyfasta
Python package for working with biological sequences from FASTA files.Documentation:http://tinyfasta.readthedocs.org/en/latest/GitHub:https://github.com/tjelvar-olsson/tinyfastaPyPI:https://pypi.python.org/pypi/tinyfastaFree software: MIT LicenseFeaturesEasy to use: intuitive API for parsing, searching and writing FASTA filesLightweight: no dependencies outside Python’s standard libraryCross-platform: Linux, Mac and Windows are all supportedWorks with with Python 2.7, 3.2, 3.3, and 3.4Quick GuideTo install the TinyFasta package:sudo pip install tinyfastaTo parse a FASTA file:>>> from tinyfasta import FastaParser
>>> for fasta_record in FastaParser("tests/data/dummy.fasta"):
...     if fasta_record.description.contains('seq1'):
...         print(fasta_record)
...
>seq1|contains 2x78 A's
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAATo create a FASTA record:>>> from tinyfasta import FastaRecord
>>> sequence = "C" * 100
>>> fasta_record = FastaRecord.create("My Sequence", sequence)
>>> print(fasta_record)
>My Sequence
CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
CCCCCCCCCCCCCCCCCCCC
Package: tinyflask
Tinyflask: Python Web Framework built for learning purposesTinyflask is a Python web framework built for learning purposes.It's a WSGI framework and can be used with any WSGI application server such as Gunicorn.InstallationpipinstalltinyflaskHow to use itBasic usage:fromtinyflask.apiimportAPIapp=API()@app.route("/home")defhome(request,response):response.text="Hello from the HOME page"@app.route("/hello/{name}")defgreeting(request,response,name):response.text=f"Hello,{name}"@app.route("/book")classBooksResource:defget(self,req,resp):resp.text="Books Page"defpost(self,req,resp):resp.text="Endpoint to create a book"@app.route("/template")deftemplate_handler(req,resp):resp.body=app.template("index.html",context={"name":"Tinyflask","title":"Best Framework"}).encode()Unit TestsThe recommended way of writing unit tests is withpytest. There are two built in fixtures
that you may want to use when writing unit tests with Tinyflask. The first one isappwhich is an instance of the mainAPIclass:# conftest.pyimportpytestfromtinyflask.apiimportAPI@pytest.fixturedefapi():returnAPI()@pytest.fixturedefclient(api):returnapi.test_session()And then:deftest_route_overlap_throws_exception(app):@app.route("/")defhome(req,resp):resp.text="Welcome Home."withpytest.raises(AssertionError):@app.route("/")defhome2(req,resp):resp.text="Welcome Home2."The other one isclientthat you can use to send HTTP requests to your handlers. It is based on the famousrequestsand it should feel very familiar:deftest_parameterized_route(app,client):@app.route("/{name}")defhello(req,resp,name):resp.text=f"hey{name}"assertclient.get("http://testserver/matthew").text=="hey matthew"TemplatesThe default folder for templates istemplates. You can change it when initializing the mainAPI()class:app=API(templates_dir="templates_dir_name")Then you can use HTML files in that folder like so in a handler:@app.route("/show/template")defhandler_with_template(req,resp):resp.html=app.template("example.html",context={"title":"Awesome Framework","body":"welcome to the future!"})Static FilesJust like templates, the default folder for static files isstaticand you can override it:app=API(static_dir="static_dir_name")Then you can use the files inside this folder in HTML files:<!DOCTYPE html><htmllang="en"><head><metacharset="UTF-8"><title>{{title}}</title><linkhref="/static/main.css"rel="stylesheet"type="text/css"></head><body><h1>{{body}}</h1><p>This is a paragraph</p></body></html>MiddlewareYou can create custom middleware classes by inheriting from thetinyflask.middleware.Middlewareclass and overriding its two methods
that are called before and after each request:fromtinyflask.apiimportAPIfromtinyflask.middlewareimportMiddlewareapp=API()classSimpleCustomMiddleware(Middleware):defprocess_request(self,req):print("Before dispatch",req.url)defprocess_response(self,req,res):print("After dispatch",req.url)app.add_middleware(SimpleCustomMiddleware)
Package: tinyflow
Experiments in data flow programming.After some experimentation, Apache Beam’s Python SDK got the API right.
Use that instead.Standard Word Count ExampleGrab the 5 most common words inLICENSE.txtfromcollectionsimportCounterfromtinyflow.serialimportops,Pipelinepipe=Pipeline()\|"Split line into words">>ops.flatmap(lambdax:x.lower().split())\|"Remove empty lines">>ops.filter(bool)\|"Produce the 5 most common words">>ops.counter(5)\|"Sort by frequency desc">>ops.sort(key=lambdax:x[1],reverse=True)withopen('LICENSE.txt')asf:results=dict(pipe(f))Using only Python’s builtins:fromcollectionsimportCounterimportitertoolsasitwithopen('LICENSE.txt')asf:lines=(line.lower().split()forlineinf)words=it.chain.from_iterable(lines)count=Counter(words)results=dict(count.most_common(10))Developing$gitclonehttps://github.com/geowurster/tinyflow.git$cdtinyflow$pipinstall-e.\[all\]$pytest--covtinyflow--cov-reportterm-missingLicenseSeeLICENSE.txtChangelogSeeCHANGES.md
Package: tinygpgs
tinygpgs is a fast module and standalone Python 2 script for doing
symmetric key (passphrase-based) encryption and decryption using the OpenPGP
file format compatible with GPG (GnuPG).UsageFile class API usage for encryption:import getpass
from tinygpgs.file import GpgSymmetricFile
f = GpgSymmetricFile('FILE.bin.gpg', 'wb', getpass.getpass())
try:
  f.write('Hello, World!\n')
  f.write('This is the end.\n')
finally:
  f.close()File class API usage for decryption:import getpass
from tinygpgs.file import GpgSymmetricFile
f = GpgSymmetricFile('FILE.bin', 'rb', getpass.getpass())
try:
  # Use f.read(8192) in a loop instead to limit memory usage.
  print(f.read())
finally:
  f.close()For encryption, it also provides theencryptedfile1.1.1 interface for easy
migration:import getpass
from tinygpgs.file import EncryptedFile  # Just for compatibility.
f = EncryptedFile('FILE.bin.gpg', mode='wb', passphrase=getpass.getpass())
try:
  f.write('Hello, World!\n')
  f.write('This is the end.\n')
finally:
  f.close()Command-line tool usage:$ python -m tinygpgs -c FILE.bin                  # Encrypt.
Enter passphrase:
$ python -m tinygpgs -d <FILE.bin.gpg >FILE2.bin  # Decrypt.
Enter passphrase:
$ cmp FILE.bin FILE2.binThe command-line tool has many flags identical to gpg(1), so you can usepython-mtinygpgsas a drop-in replacement forgpgfor symmetric
key encryption and decryption.Featurestinygpgs supports all ciphers, hashes, string-to-key modes, output formats
(binary and ASCII armor) and compression methods in theOpenPGP RFCfor both encryption and decryption.
All these settings are configurable in keyword arguments to the class
constructors and in command-line flags.tinygpgs doesn’t support public-key cryptography (e.g. encryption, signing
and key generation).InstallationTo get the module, run this:$ python -m pip install tinygpgs pycryptoPlease note that tinygpgs works withoutpycryptoas well, but withpycryptoit works much faster, even comparable with gpg(1): less than 1.37
slower.To get the standalone version of the command-line tool (single executable
file for Unix, contains the module embedded), seehttps://github.com/pts/tinygpgs.You need Python >=2.4 to use tinygpgs as a script or a module. It was tested
with 2.4 and 3.8, and all the major versions in-between.More infoSee seehttps://github.com/pts/tinygpgs.Licensetinygpgs is free software released under the MIT license. There is NO
WARRANTY. Use at your risk.
Package: tiny-gptv
TinyGPTVSimple Implementation of TinyGPTV in super simple Zeta lego blocks. Here all the modules from figure 2 are implemented in Zeta and Pytorch.The flow is the following:
x -> skip connection -> layer norm -> lora -> mha + lora -> residual_rms_norm -> original_skip_connection -> mlp + rms normInstallpip3 install tiny-gptvUsageTinyGPTVBlock, Figure3 (c):LayernormMHALoraQK NormRMS NormMLPimporttorchfromtiny_gptv.blocksimportTinyGPTVBlock# Random tensor, replace with your input datax=torch.rand(2,8,512)# TinyGPTVBlockblock=TinyGPTVBlock(512,8,depth=10)# Print the blockprint(block)# Forward passout=block(x)# Print the output shapeprint(out.shape)Figure3 (b) Lora Module for LLMS BlockMHA,Lora,Normalization,MLPSkip connectionSplit then addimporttorchfromtiny_gptvimportLoraMHAx=torch.rand(2,8,512)block=LoraMHA(512,8)out=block(x)print(out.shape)Citation@misc{yuan2023tinygptv,title={TinyGPT-V: Efficient Multimodal Large Language Model via Small Backbones},author={Zhengqing Yuan and Zhaoxu Li and Lichao Sun},year={2023},eprint={2312.16862},archivePrefix={arXiv},primaryClass={cs.CV}}LicenseMIT
Package: tinygrad-lightning
Tinygrad Lightning - WIPPytorch Lightning clone for tinygrad. Easy data loading, training, logging and checkpointing.Exampleimport tinygrad_lightning as pl

### model ###

class TinyBobNet(pl.LightningModule):
    def __init__(self, filters=64):
        self.model = ResNet18(num_classes=10)

    def forward(self, input: Tensor):
        return self.model(input)

    def configure_optimizers(self):
        return optim.SGD(optim.get_parameters(self), lr=5e-3, momentum=0.9)

    def training_step(self, train_batch, batch_idx):
        x, y = train_batch

        for image in x:
            self.log_image("inputs", image)

        out = self.forward(x)

        cat = np.argmax(out.cpu().numpy(), axis=-1)
        accuracy = (cat == y).mean()

        loss = sparse_categorical_crossentropy(out, y)
        loss_value = loss.detach().cpu().numpy()

        # automatically logs to train/loss, ...
        self.log("loss", loss_value.mean())
        self.log("accuracy", accuracy)

        return loss

    def validation_step(self, val_batch, val_idx):
        x, y = val_batch
        out = self.forward(x)

        cat = np.argmax(out.cpu().numpy(), axis=-1)
        accuracy = (cat == y).mean()

        loss = sparse_categorical_crossentropy(out, y)
        loss_value = loss.detach().cpu().numpy()

        # automatically logs to val/loss, ...
        self.log("loss", loss_value.mean())
        self.log("accuracy", accuracy)

        return loss

batch_size = 4

test_ds = MnistDataset(variant='test') # same as torch dataset
train_loader = pl.DataLoader(train_ds, batch_size, workers=1, shuffle=True)

# define your model
model = TinyBobNet()
callbacks=[pl.TQDMProgressBar(refresh_rate=10), pl.TensorboardLogger("./logdir")]

trainer = pl.Trainer(model, train_loader=train_loader, callbacks=callbacks)
trainer.fit(epochs=1) # train_batches=2, val_batches=4
Package: tinygraphio
tinygraphioPython implementation of the tinygraphio graph data interchange file format.InstallationInstall withpoetrypoetry add tinygraphioInstall withpippip install tinygraphioUsageTheTinygraphclass implements a compressed sparse row graphTheTinygraphioReaderimplements reading a graph from a binary file-like objectTheTinygraphioWriterimplements writing a graph to a binary file-like objectfromtinygraphio.graphimportTinygraph,Node,Edgefromtinygraphio.readerimportTinygraphioReaderfromtinygraphio.writerimportTinygraphioWriterWritinggraph = Tinygraph(offsets=[0, 2, 4, 5], targets=[1, 2, 0, 2, 1])

with open("berlin.tinygraph", "wb") as f:
    writer = TinygraphioWriter(f)
    writer.write(graph)Readingwith open("berlin.tinygraph", "rb") as f:
    reader = TinygraphioReader(f)
    graph = reader.read()Note: this library implements reading and writing a compressed sparse row graph in a
The use case tinygraphio covers is storing large graphs effectively and efficiently and sharing graphs in a portable way.
We do not provide a full-blown graph computation toolkit on purpose.DevelopmentLicenseCopyright © 2023 tinygraphDistributed under the MIT License (MIT).
Package: tinyhmm
A tiny hmm.Free software: MIT licenseInstallationpip install tinyhmmYou can also install the in-development version with:pip install https://github.com/reedf1/tinyhmm/archive/main.zipDocumentationhttps://tinyhmm.readthedocs.io/DevelopmentTo run all the tests run:toxNote, to combine the coverage data from all the tox environments run:Windowsset PYTEST_ADDOPTS=--cov-append
toxOtherPYTEST_ADDOPTS=--cov-append toxChangelog0.0.0 (2023-06-18)First release on PyPI.
Package: tinyhttp
IntroductionA socket-based static HTTP server, Support for asynchronous.(Does not support python2)Installpip install tinyhttpUsageAsynchrouspython-mtinyhttp # or tinyhttpMulti-Threadpython-mtinyhttp.threadSet Port(The defalut port is 6789.)python-mtinyhttp.thread 6666Debug modepython-mtinyhttp--debug
Package: tinyik
tinyik is a simple and naive inverse kinematics solver.It defines the actuator as a set of links and revolute joints from an origin. Here is the example of a robot arm that consists of two joints that rotate around z-axis and two links of 1.0 length along x-axis:>>>importtinyik>>>arm=tinyik.Actuator(['z',[1.,0.,0.],'z',[1.,0.,0.]])Since the joint angles are zero by default, the end-effector position is at (2.0, 0, 0):>>>arm.anglesarray([0.,0.])>>>arm.eearray([2.,0.,0.])Sets the joint angles to 30 and 60 degrees to calculate a new position of the end-effector:>>>importnumpyasnp>>>arm.angles=[np.pi/6,np.pi/3]# or np.deg2rad([30, 60])>>>arm.eearray([0.8660254,1.5,0.])Sets a position of the end-effector to calculate the joint angles:>>>arm.ee=[2/np.sqrt(2),2/np.sqrt(2),0.]>>>arm.anglesarray([7.85398147e-01,3.23715739e-08])>>>np.round(np.rad2deg(arm.angles))array([45.,0.])Optionally, it has the visualization feature. Passes the actuator to it to visualize its structure:>>>leg=tinyik.Actuator([[.3,.0,.0],'z',[.3,.0,.0],'x',[.0,-.5,.0],'x',[.0,-.5,.0]])>>>leg.angles=np.deg2rad([30,45,-90])>>>tinyik.visualize(leg)Passes with the target position, can compare before and after the IK. The gray links are before IK and the white links are after it. The red sphere is the target position:>>>tinyik.visualize(leg,target=[.8,.0,.8])Installation$pipinstalltinyikWith the visualization feature:$pipinstalltinyik[viz]