Saravanan666/pypi-org huggingface dataset:
Package: typer-builder
typer-builderA framework for simplifying the development ofTyperbased CLIs supporting modern type hints and hierarchical
dependency injection.Table of ContentsIntroductionExampleDocumentationNew-style type hint supportDependency injectionIntroductionThebuild_app_from_module()inspect a hierarchy of Python modules to build a Typer command and group structure.
Packages are treated as command groups and may define acallback()member. Modules are treated commands and must
define amain()member. Modules and packages prefixed with an underscore (_) are ignored. Help text is extracted
from themain()docstring or the module docstring.In addition, we provide support for new-style type hints (PEP 585 - Type Hinting Generics in Standard CollectionsandPEP 604 - Union Operators) in older versions of Python as well as adapt it for Typer (e.g.list[str]andstr | None), as well as a method of injecting dependencies to functions that are not sourced from the command-line.Example$ tree src/mypackage/
src/mypackage/
├── __init__.py
├── __main__.py
└── commands
    ├── __init__.py
    ├── hello.py
    └── bye.py# src/mypackage/commands/hello.pydefmain(name:str)->None:print("Hello,",name)# src/mypackage/__main__.pyfromtyper_builderimportbuild_app_from_moduleif__name__=="__main__":app=build_app_from_module("mypackage.commands")app()DocumentationNew-style type hint supportThroughtypeapi, we can convert new-tyle type hints such asstr | Noneorlist[int]to their corresponding
representation usingtypingbefore the function signature is parsed byTyper.# src/mypackage/commands/create_user.pyfrom___future__importannotationsdefmain(name:str|None=None,groups:list[str]|None=None)->None:# ...typeapialso allows us to convertlist[str]toList[str]anddict[str, int]toDict[str, int]for
Python versions prior to 3.9. This is necessary becauseTyperdoes not support the new-style type hints.Dependency injectionThetyper_builder.Dependenciesobject is used to map types to concrete values or functions that provide them.
Functions wrapped withDependencies.bind()will have their arguments resolved by the injector based on type
annotations. Everybuild_app_from_module()call creates a newDependenciesinstance. Dependencies can be
injected from the outside by passing aDependenciesinstance tobuild_app_from_module()or by providing
additional dependencies via acallback()function on the command group.Note that theDependenciesdoes not understand generics with different type parameters. For example, it makes
no distinction betweenMyGeneric[int]andMyGeneric[str]. This is a limitation of the current implementation as well
as the Python type system.The most common use case for dependency injection is to inject configuration managers or clients into subcommands. For
an example, you should check out theexamples/dependency-injectiondirectory.LicenseThis project is licensed under the terms of the MIT license.
Package: typer-cmd
typer-cmdtyper-cmd is an extension to typer that easily turns your typer app into a shell utility. It is built on top of the built in python cmd module, with modifications to make it work with typer.Usagepipinstalltyper-cmdSimply create a Typer instance and add it into the TyperCmd instance:importtyperfromtyper_cmd.shellimportTyperCmdapp=typer.Typer()job_app=typer.Typer()app.add_typer(job_app,name="job")@app.command()defhello(name:str):print("hello",name)@job_app.command()defrun(name:str):print(f'run job{name}')@job_app.command()deflist():print('list jobs')if__name__=="__main__":cmd=TyperCmd(typer=app)cmd.cmdloop()or u can make a new subclass from TyperCmd and add your own necessary initializing code
Package: typerconf
The configuration is a JSON structure. We'll use the following for the
coming examples.{"courses":{"datintro22":{"timesheet":{"url":"https://sheets.google..."},"schedule":{"url":"https://timeedit.net/..."}}}}The format is actually irrelevant to anyone outside of this library,
since it will never be accessed directly anyway. But it will be used to
illustrate the examples.We can access values by dot-separated addresses. For instance, we can
usecourses.datintro22.schedule.urlto access the TimeEdit URL of the
datintro22 course.Let's have a look at some usage examples.A command-line applicationSay we have the programnytidthat wants to use this config module and
subcommand.importtyperimporttyperconfasconfigcli=typer.Typer()# add some other subcommandsconfig.add_config_cmd(cli)We want the CLI command to have the following form when used withnytid.nytidconfigcourses.datintro22.schedule.url--sethttps://timeedit.net/...will set the configuration value at the path, whereasnytidconfigcourses.datintro22.schedule.urlwill return it.Internally,nytid's different parts can access the config through the
following API.importtyperconfasconfigurl=config.get("courses.datintro22.schedule.url")Without the CLIWe can also use it without the CLI and application features. Then it's
thetyperconf.Configclass that is of interest.Let's assume that we have the structure from above in the file~/.config/app.config. Consider the following code.defaults={"courses":{"datintro22":{"root":"/afs/kth.se/..."}}}conf=Config(json_data=defaults,conf_file="~/.config/app.config")print(f"datintro22 root directory ={conf.get('courses.datintro22.root')}")print(f"datintro22 schedule ={conf.get('courses.datintro22.schedule')}")When we constructconfabove, we merge the default config
with the values set in the config file that was loaded.We note that the construction ofconfabove, can be replaced
by the equivalentconf=Config(defaults)conf.read_config("~/.config/app.config",writeback=True)The meaning ofwritebackis that whenever we change the
config, it will automatically be written back to the file from which it
was read. Writeback is enabled by default when supplying the file to the
constructor. It's disabled by default for the methodconf.read_config, but we can turn it on by passing thewriteback=True.We can change the config by using theconf.setmethod.conf.set("courses.datintro22.root","/home/dbosk/...")That would change the root that we got from the default config. Since we
enabled writeback above, this would automatically update the config file
with the new values.
Package: typer-config
typer-configThis is a collection of utilities to use configuration files to set parameters for atyperCLI.
It is useful for typer commands with many options/arguments so you don't have to constantly rewrite long commands.
This package was inspired byphha/click_config_fileand prototyped inthis issue. It allows you to set values for CLI parameters using a configuration file.Installation$pipinstalltyper-config[all]Note: that will include libraries for reading from YAML, TOML, and Dotenv files as well.
Feel free to leave off the optional dependencies if you don't need those capabilities.Usage# Long commands like this:$my-typer-app--opt1foo--opt2bararg1arg2# Can become this:$my-typer-app--configconfig.ymlQuickstartYou can use a decorator to quickly add a configuration parameter to yourtyperapplication:importtyperfromtyper_configimportuse_yaml_configapp=typer.Typer()@app.command()@use_yaml_config()# MUST BE AFTER @app.command()defmain(foo:FooType):...if__name__=="__main__":app()Your typer command will now include a--config CONFIG_FILEoption at the command line.Note: this package also provides@use_json_config,@use_toml_config, and@use_dotenv_configfor those file formats.
You can also use your own loader function and the@use_config(loader_func)decorator.See thedocumentationfor more examples using typer-config.
Package: typer-di
Dependency injection for TyperAdd dependency injection functionality toTyperlibrary. Implement the same DI behavior as inFastAPI.DescriptionWithtyper_diyou can easely move common parts of your commands to dependency functions.Any dependency function can depends on other functions and etc. All args and options will be merged to interface of each command that uses corresponding dependencies.typer_diensures to call each dependency callback onlyonce.UsageLets say you have a method that validates and parses a config:defget_config(config_path:Path)->Config:...In case of multiple commands you need to duplicate annotation code:fromtypingimportAnnotatedfromtyperimportTyper,Optionapp=Typer()@app.command()deffirst(...,config_path:Annotated[Path,Option("--config")]):config=get_config(config_path)...@app.command()defsecond(...,config_path:Annotated[Path,Option("--config")]):config=get_config(config_path)...Withtyper_diyou can move annotations to parsing methods.All you need is to useDependsannotation and replace the originalTyperbyTyperDI(it's a thin layer that transforms all passed functions unwrapping dependencies).fromtypingimportAnnotatedfromtyperimportOptionfromtyper_diimportTyperDI,Dependsapp=TyperDI()defget_config(config_path:Annotated[Path,Option("--config")])->Config:...@app.command()deffirst(...,config:Config=Depends(get_config)):...@app.command()defsecond(...,config:Config=Depends(get_config)):...Release Notesv0.1.2addpy.typedmarker to the packagev0.1.1fix invalid validation for duplicated namescheck for loops in dependency graphv0.1.0first public versionsupport py37+
Package: type-registry
Python Type RegistryThetype-registrylibrary provides the ability to easily register factory methods (or classes) that can be
used in a configuration file to quickly construct complex objects (or models).ExampleLets demonstrate how to easily use this library.  There are a functions and decorators, but the most important is theregisterdecorator.  By registering a type, we are telling the system that when a configuration section has a special key__factory__to construct that section into an object.We start by registering ourPytorchExampleand give it a more usable name ofpytorch-model.importtorch.nnasnnfromtype_registryimportregister@register('pytorch-model',input_size=1024,output_size=8)defPytorchExample(nn.Module):def__init__(self,input_size,hidden_size,output_size):...Now that we have the type registered with the system, in the configuration we can supplied the details
around its construction (in this case we are just providing the value of thehidden_size)model:__factory__:pytorch-modelhidden_size:...Constructing from configOnce we have our types registered and a config defined, we need to correctly load the configuration so that
it will construct the types.  This is accomplished using theload_yamlandload_yaml_strfunctions.fromtype_registeryimportload_yaml_stryaml_str=get_config()result=load_yaml_str(yaml_str)You can also have environment variables (or custom variables) automatically expanded in the same configuration
file.model:__factory__:simple-modeluse_aws:$USE_AWSViewing the RegisteryTo make working with the library a little easier, there is a function that can be called which will print out
the details of the registery (at the time the call takes place).fromtype_registeryimportprint_registryif__name__=='__main__':print_registery(color=True)Setting thecolorvalue to True will have the system print out the results using shell coloring (termcolor library).
You can also have the output of theprint_registrycall target a file instead ofstdout.fromtype_registeryimportprint_registryif__name__=='__main__':withopen('registry.txt','w')asf:print_registry(file=f)
Package: typergame
Typergame.pyBy @drooler (https://bit.ly/drooler)Current version: V0.3.1Update logsV0.1.0 - First buildV0.1.1 to V0.1.2 - Bug fixesV0.2.1 - Added costum user statsV0.2.2 to V0.2.6 - Bug fixesV0.2.7 - Added syntax documentationV0.3.0 - Added inventory systemV0.3.1 - Bug fixesHow to set up1- Install with pipRunpip install typergame2- Create a .py and paste in the template codeTemplate code:importtypergamegame=typergame.Typergame("Project name",["exit"])running=Truewhilerunning:command=game.user.run()ifcommand=="exit":running=Falsegame.functions.write("Press enter to exit")input()game.functions.clear()3- Build your game: add commands, add user stats,...LinksWebsite:https://typergame.replit.appGithub:https://github.com/bijenmanlol/typergamePypi:https://pypi.org/project/typergameDocumentation:https://typergame.replit.app/docs
Package: typerighter
Data Types for Cynical HumansOverviewWelcome to Typerighter, a project that makes it easy to with common types of
data using roughly the same ideas as type systems. Instead of defining what a
string is, it uses strings to define what URLs or datetimes are.Its concepts are simple and built around ideas that require little effort for
effective data management.Schematics RethinkI am the original author ofhttps://github.com/schematics/schematics.A community took over the Schematics project a while back, but I found I needed to solve the roughly the same validation and conversion problems in every new system I encountered, giving me an opportunity to continue learning about the problem space.Typerighter is how I think about the problem ten years after Schematics.Read The DocsLearn more about it withour great documentation.ExampleDefine a type by instantiating it with config parameters.>>> string_type = types.StringType(max_length=12)Validate data with that type definition.>>> short_string = 'Take Five'
>>> string_type.validate(short_string)Define a record with fields and instantiate it.>>> class Artist(types.Record):
...     name = types.StringType(required=True)
...     website = types.URLType()
...
>>> artist_type = Artist()Validate data with that record.>>> band_data = {
...     'name': u'American Food',
...     'website': 'https://soundcloud.com/americanfood'
... })
>>> artist_type.validate(band_data)Use a mutable structure instead of a dict for the data.>>> american_food = artist_type.make_view(band_data)
>>> # Promote the reinterpretation of Take On Me
>>> american_food.website = 'https://soundcloud.com/americanfood/my-take-on-take-on-me'
>>> american_food.validate()
Package: typernexrad-cli
Typer NEXRADA Python CLI Application to access the funcionalities of NEXRADCreated five user functionalities in Typercreateuser - Creates user with their username, password, and their tiers and uploads them to databasetyper_t7 createuser <username> <passwod>download - Download files from users public s3 bucket by specifying the file nametyper_t7 download <username> <password> <bucketname> <filename>fetch - Lists all files in the public S3 buckettyper_t7 fetch <username> <password> <bucketname>fetchnexrad - Generates NOAA public S3 link and Users S3 link based on the parameters year, day, hour, station, and filenametyper_app fetchnexrad <username> <password>fetchnexrad_filename - Generates link based on NOAA Nexrad S3 bucket based on the filename given by the usertyper_app  fetchnexrad_filename <username> <password>
Package: typer-plugins
typer-pluginsRegister Typer CLI applications to a main root application to make it more pluggable.This is inspired byclick-pluginsso I have created a similar package to register Typer CLI based applications in a similar plugin format. It's slightly different how to use it and I'm still actively working on this project to improve the process of registering, detecting duplicate plugins. Natively running a plugin with broken code will not break the full application, only when someone attempts to execute that specific command.But now you can manage your Typer CLI applications with plugin based architecture, managing separate sub-command groups in separate Git repositories.How to usepip install typer-pluginsImport the package in your main application that you want to register all your plugins intoimporttyperfromtyper_pluginsimportregister_plugins# Import the register_plugins functionapp=typer.Typer(invoke_without_command=True)register_plugins(app=app,entrypoint="exampleapp.plugins")# Run the function after creating your main `app`. This entrypoint should be used by all your applications.if__name__=="__main__":app()Create your plugin(s) and ensure you either create an entrypoint,here is an example using pyproject.toml with Poetry:[tool.poetry.plugins."exampleapp.plugins"]"plugin-a"="plugin_a.app:app"This format assumes your plugin is calledplugin_aand there is a python file calledapp.pywith the Typer app created assigned to a variable namedapp. You can find a working example in theexamples directoryAs long as your entrypoint matches up with the poetry plugin configured in the pyproject.toml file, you can now proceed topip install <your-plugin>whether it be locally or via a package distributer. It will then register from your main application where you use theregister_pluginsfunction.$pythonmy-appplugin-a--help
Usage:my-appplugin-a[OPTIONS]COMMAND[ARGS]...

Options:--helpShowthismessageandexit.

Commands:root-command-aroot-command-bsome-commandssome-other-commandsDevelopment / ContributingTO-DO
Package: typer-router
typer-routerOverviewBuild Typer CLI Apps with File System-Based RoutingGetting StartedInstalltyper-router:pip install typer-routerA simple example:importtyper_routerfrommy_packageimportmy_approuter=typer_router.Router.from_app_module(my_app)app=router.to_typer(name="my_app_name")See amore in-depth tutorial here.Development StatusThis project is currently in early-stage development. There may be
breaking changes often. While the major version is 0, minor version
upgrades will often have breaking changes.DevelopingFirst, you need a couple global dependencies installed, see their documentation for details:pipxdirenvThen clone the repo and runnpm installandmvenv sync dev. Make your changes and then runjustto run formatting,
linting, and tests.Develop documentation by runningjust docsto start up a dev server.To run tests only, runjust test. You can pass additional arguments to pytest,
e.g.just test -k test_something.Prior to committing, you can runjustwith no arguments to run all the checks.AuthorCreated by Nick DeRobertis. MIT License.LinksSee thedocumentation here.
Package: typer-shell
Typer Shell!Beautiful command-line shell withTyper!This is just an update toclick-shellfor typer.I also added some features like:better help by defaultsupport for typer default functions (just name one of your commands 'default' and it will be triggered when nothing else is recognized)easily drop into an ipython terminal with the local context loaded with 'shell'each shell can have local parameters with helper functions for loading and saving them from filesSee it in action!And checkoutthe demo script:#!/usr/bin/env pythonfromrichimportprintfromtyperimportContextfromtyper_shellimportmake_typer_shellclassApp:def__init__(self,name:str="Bob"):self.name=nameapp=make_typer_shell(prompt="🔥: ",obj=App(),params={"name":"Bob"},params_path="params.yaml")inner_app=make_typer_shell(prompt="🌲: ",params={"name":"Bob"},params_path="innerparams.yaml")app.add_typer(inner_app,name="inner")@app.command()@inner_app.command()deffoobar(name:str="Bob"):"Foobar command"print("Hello",name)@app.command()defname(ctx:Context,name:str="Bob"):"Name command"print("Hello",name)# Set both the shell and the inner shell to have the same default@app.command(hidden=True)@inner_app.command(hidden=True)defdefault(ctx:Context,line:str="Bob"):"Name command wrapper for default"ctx.invoke(name,ctx=ctx,name=line)if__name__=="__main__":app()
Package: typers-terminal
Typers TerminalTypers Terminal is a productivity application used to speed read and type text from any URL, clipboard or builtin drill.To learn content faster, a combination of speed reading and typing can be used. There are many studies showing the benefits of reading and taking hand written notes. Hand writing notes is slow at 13-20 while typing is much faster at 40 wpm and can easily be improved to 75wpm+. Though typing is not the same as note taking, I would argue there are still overlapping benefits such as, an increase in ability to focus, conprehension, memory and many more.There is nothing stopping you from typing content in a notepad to take notes, but if you type incorrectly, take a microbreak, or scroll pages then you will have to spend time finding your place. Additionally, Stats are collected to show what type of words you struggle with and exercises are provided.Working FeaturesTyping TextDrillsCustomizeword amountstarting lettersDigraphs2 most frequent charctersTrigraphs3 most frequent charactersWords300 most common (10fastfingers words)10,000 wordsSubmit TextURLSelects Header Text and paragraphs, list underneathClipboardStatsduring typingshows wpm for a given word as if you typed that word for 1 minafter typingshowsaverage wpmaccuracyfastest wordsslowest wordsslowest correct wordsIn DevelopmentSpeed readinglogging statsdocumentationhow to installbetter annotationtestingCI/CD toolInstallation GuideHow To Usestart application withpython3 main.pyin/typers_terminal/typers_terminalnavigate with with arrow keys or jk and select with enterfor typingif a weird symbol that you cannot type is found type ``to exit out early pressescforce close withctrl+cContribution Instructionsthis
Package: typer-tinydb
A Typer config file get/set boilerplateUsing the boilerplateAliases and subcommandsWe recommand the following aliases, which are readily available out of the box.configcfgcThis way, if your app is namedsuper-appAnd is defined insuper_app.pyroughly as follows:importtyper# ... some importsapp=typer.Typer(name='super-app',# ... other args)You just have to add the following below:fromtyper_tinydbimportcfg,config# those are typer appsapp.add_typer(cfg)# the cfg appapp.add_typer(config)# the config appYou can rename them however you like by usingapp.add_typer(cfg,name='my-super-config')Using it on the command lineWith the same configuration as above, your new app can now run the commands:super-appcfglist# list config key:value pairssuper-appcfggetsome-key# get the values linked to the key 'some-key'super-appcfgsetsome-key'20-hS407zuqYKQ8tPP2r5'# store some hash or token into your settings filesuper-appcfgset-kuser23'supersecretpassword'# it's going to get obfuscated so looking at the JSON doesn't helpYou can obviously usesuper-app config getand others, or any name you attribute to it.Using it within python modulesThe CLI key-values are stored in a tinydb instance that is available by just importing the table namedglobals:fromtyper_tinydbimportdb,globals,whereInsert / UpsertTo insert a new value, the easiest is to use theupsert_param.defupsert_param(param:str,value:Any,obfuscate:bool=False):...This function is used to upsert a parameter (param) and its corresponding value (value) to the global database.
The function takes in 3 parameters:param,value, andobfuscate.Theparamparameter is a string that contains the parameter name.Thevalueparameter can take in any type of value, and it contains the value to be upserted to the database.Theobfuscateparameter is a boolean value that determines if the parameter and its corresponding value will be obfuscated before being stored in the database.The function uses the usualQuery()anddb.search(..)fromtinydb.The function upserts theparamandvalueto the database, and also stores thetimestamp,machine, and a boolean to indicate wether parameters are obfuscated.Get Keys / ValuesThere are two pre-made functions:getKeyandgetValue. The key difference is as follows:getKeyreturnsall the values associated with keykeygetValuearbitrarily returns the first encountered value.The underlying databaseYou can create any table using the database objectdb, pleasecheck out the tinydb docs !To get the key just usewhere:returns=globals.search(where('param')==param)To insert new values or update existing, use theupsertfunction:Param=Query()globals.upsert({"param":param,"value":value,"timestamp":datetime.now().strftime("%d/%m/%Y %H:%M:%S"),"machine":socket.gethostname(),},Param.param==param)CommandsGo check out thecommands page 🚀