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
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 typipe-0.1.2.tar.gz.
File metadata
- Download URL: typipe-0.1.2.tar.gz
- Upload date:
- Size: 7.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.16.1 CPython/3.10.12 Linux/6.5.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bac663398cebd4b2b5a83ec8b93c3c997ce2a318fe067441fb14e3bff283a777
|
|
| MD5 |
8964e7d4a078609d5d58f987c2b55b44
|
|
| BLAKE2b-256 |
b14ec7e678f3ebd9e92b75b236b5fb5db2272cbdad2890580a35e4d0ff4e1efc
|
File details
Details for the file typipe-0.1.2-py3-none-any.whl.
File metadata
- Download URL: typipe-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.16.1 CPython/3.10.12 Linux/6.5.0-1022-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfcfd9c9c6895ee44a42285189e796e0a3174d2f84f43ce4601eec23b464a66c
|
|
| MD5 |
5c8449f15e1b790029bb4ef4322c7d18
|
|
| BLAKE2b-256 |
8d48b246484720c258e46334ca7f8655310451b2db9794d062d95c10e5528c6e
|