Skip to main content

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


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.2.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

typipe-0.1.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

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

Hashes for typipe-0.1.2.tar.gz
Algorithm Hash digest
SHA256 bac663398cebd4b2b5a83ec8b93c3c997ce2a318fe067441fb14e3bff283a777
MD5 8964e7d4a078609d5d58f987c2b55b44
BLAKE2b-256 b14ec7e678f3ebd9e92b75b236b5fb5db2272cbdad2890580a35e4d0ff4e1efc

See more details on using hashes here.

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

Hashes for typipe-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cfcfd9c9c6895ee44a42285189e796e0a3174d2f84f43ce4601eec23b464a66c
MD5 5c8449f15e1b790029bb4ef4322c7d18
BLAKE2b-256 8d48b246484720c258e46334ca7f8655310451b2db9794d062d95c10e5528c6e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page