Typed pipe to pipe input into functions.
Project description
typipe
Extremely minimal package which implements a typed pipe. Some convenience functions are also implemented, e.g. a map which is more restricted than the built-in map, but is typed.
Tested with pyright/pylance.
Example:
import typipe as ty
def times_two(x: int) -> int:
return 2 * x
out: Piped[str] = (
ty.pipe(253)
| times_two
| times_two
| times_two
| str
| ty.tap # prints 2024
| (lambda s: f"hello {s}!!")
| (lambda s: cast(str, s).upper())
)
print(out.get()) # HELLO 2024!!
Note: lambda functions cannot be typed but you can use cast as above to get autocomplete inside the lambda.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
typipe-0.1.1.tar.gz
(3.2 kB
view hashes)
Built Distribution
typipe-0.1.1-py3-none-any.whl
(3.9 kB
view hashes)