Skip to main content

yaphs

pipeline status coverage report

Yet another python hook system for python 2.7/3.x

Usage

Basic usage

Import yaphs

from yaphs import Hook

Register foo as a hook-compatible function

@Hook
def foo(*args):
    print(args)

Register bar as a hook to be executed before calling foo

@foo.before(*args):
def bar(*args):
    print('before foo, args: ' + str(args))

When you call foo, bar is called before

foo(1, 2)

Expected output:

before foo, args: (1, 2)
(1, 2)

Class usage (python 3.x only)

You can use yaphs hooks inside classes:

class MyClass:
    @Hook
    def foo(self, *args)

When you register hooks, you just have to know that the first argument will be the object

c = MyClass()

@c.foo.after:
def bar(o, *args):
    print('after foo')
    print('object: ' + str(o))
    print('args: ' + str(args))

Metadata

Release files for yaphs 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaphs 1.0
File Size Uploaded
yaphs-1.0.tar.gz 1.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yaphs 1.0
File Interpreter ABI Platform
yaphs-1.0-py3-none-any.whl Python 3 none any Details

Total release size: 4.7 kB

Release files / yaphs-1.0.tar.gz

Download URL yaphs-1.0.tar.gz
Size 1.9 kB
Tags Source
SHA-256 checksum
How to use checksums
75dd3d48e700f810d7c466e8159fb7673d349f7bb1dec475d722897bc0667f8a
BLAKE2b-256 checksum
How to use checksums
1dd0f9fe10d2258c8489bfa8d2e63194d2c5b7603e3e53e68a12d281f8f357bb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release files / yaphs-1.0-py3-none-any.whl

Download URL yaphs-1.0-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
368ade1feb256958f6dd74847f54e3944f84d53c31bee7bb1aab3ac165f40fc0
BLAKE2b-256 checksum
How to use checksums
af00618b20d259ba81b597db8118c8df6a27b1b2e504e814cb769d7aa237a0bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

Release history Release notifications | RSS feed

This release

1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page