Simplified invocation of typer apps from any directory.
Project description
typer-invoke
Simplified invocation of typer apps from any directory.
The idea is that you place typer apps in a directory in your project and then you can invoke them from anywhere inside that project.
Example
- Place scripts anywhere in the project (ex
admindirectory). - Make sure they're
typerapps. - Register them in
pyproject.toml. - Invoke them from anywhere in the project.
Ex:
inv --help
inv help-full
inv build deploy
inv test unit --pri1
In this project there's the admin directory with scripts actually used for managing the project
and the sample directory with more samples on how to use this package.
Why?
The main use case is for project management that require custom scripts for various tasks.
Wrapping those scripts as typer apps makes them easier to use.
Making typer easier to use makes those scripts even easier to use.
An alternative to:
Versus Invoke
The main driver for this project is as a replacement for Invoke, which I've been using for a while and found the following limitations:
--helpand--listoptions are clunky, in that they need to be placed right after theinvcommand, ex:
Here a more common pattern is used andinv --help some.task--helpacts as both help and list:
There's alsoinv some task --helphelp-full, which lists all tasks recursively:-
inv help-full - Output can be subdued.
If you use tools that have colors in their output, often that output is stripped of colors and other formatting. There are settings you can play with, but often it doesn't work. - Lack of support.
Some issues and features have been piling up for a while, and I'm not sure if they will ever be addressed. Seems like the project has had new development recently, though.
Typer is widely used and has a lot of support.
Other advantages (in my opinion):
- Prettier.
Developer experience counts. Other than more common usage patterns, Typer supports rich and Markdown formatting.
Including usingrichfor logging, which is done in this project. - No dot
.namespace.
Invoke uses a dot.namespace for tasks, which is not very common when running scripts.
Typer follows a normal CLI pattern. Namespaces are Typer apps and are separated by a space.
Invoke is the inspiration for this project, hence the name typer-invoke and keeping the inv
command name.
Cool things about Invoke
Invoke concepts and features I was using that are not native to this project, but the workarounds work well:
- Task dependencies.
In Invoke, it's easy to declare a task dependent on others and they will be executed in the correct order.
While we don't have this feature, it's very easy to simply call other functions and end up with the same functionality. - Namespaces (task groups)
You can declare namespaces and whatever tasks you want in them.
The same is done in Typer by with apps. Each app added is the equivalent of a namespace.
Usually, one app is in one file, but it's not a requirement. - Dry runs
The--dryoption in Invoke is very useful and available to all tasks.
Typer doesn't have this feature, but it's easy to add. See the examples in this project, under theadmindirectory.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file typer_invoke-0.4.0.tar.gz.
File metadata
- Download URL: typer_invoke-0.4.0.tar.gz
- Upload date:
- Size: 32.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ca4d13cd00774d3976e30000926b1cc0cbfef90809db8fab2ffcc01b5d44da45
|
|
| MD5 |
fdf78936565724787ec38a0605fef64a
|
|
| BLAKE2b-256 |
19f842f4b2875ab5c5905d42c57e6d71fa54e6b32a9fd6de3ee805f1690ac79a
|
File details
Details for the file typer_invoke-0.4.0-py3-none-any.whl.
File metadata
- Download URL: typer_invoke-0.4.0-py3-none-any.whl
- Upload date:
- Size: 10.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.32.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a350d94d172093dec60ef01bfd616bf6c48894a07f2194881de1db6b0695198
|
|
| MD5 |
fad44defb9840f4359059aec9a726aba
|
|
| BLAKE2b-256 |
ae989ab1ca1b99a9b36b86afda29f5bed9a0be3c5a9da34f5da2869f113abc07
|