Skip to main content

Graffito

Speak softly, but carry a big can of paint.

Banksy

Installtion

Find this tool onPyPI: pip install graffito

Usage

Given a program:

from graffito.tags import graffiti, get_tags

func_test = graffiti

@func_test
def test():
    pass

class TestClass:

    method_test = graffiti

    @method_test
    def class_test(self):
        pass

print(get_tags(TestClass))
print(get_tags(test))

Executing the program will return:

{'class_test': ['method_test']}
{'test': ['func_test']}

This is a bespoke module. However, let's say that we wanted to characterize functions of a certain signature with a decorator so that we could handle them the same way. Let's say:

from graffito.tags import graffiti, get_tags

class TestClass:

    two_var_sig = graffiti

    @two_var_sig
    def function_a(self, input_a, input_b):
        print(f"{input_a}, {input_b}")

    @two_var_sig
    def function_b(self, input_a, input_b):
        print(f"{input_b}, {input_a}")

    def function_not_like_them(self, input_a):
        print(f"SIKE!")

t = TestClass()
tags = get_tags(TestClass)
for tag in tags:
    if "two_var_sig" in tags[tag]:
        getattr(t, tag)(1,2)

I know it seems really arbitrary, but it helped me write a simple computer emulator and I think I can develop it to be useful outside of my silly context. Let's find out.

Metadata

Release files for graffito 0.0.1

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

Source distribution (sdist)

Source distribution for graffito 0.0.1
File Size Uploaded Provenance Actions
graffito-0.0.1.tar.gz 5.4 kB Without provenance Details for graffito-0.0.1.tar.gz

Release files / graffito-0.0.1.tar.gz

Download URL graffito-0.0.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
f08842905f73da7c2f9bc9b117bbef40da5addbf67bc9e9287f5215453e0f97c
BLAKE2b-256 checksum
How to use checksums
81ac12c8a0cb9e30301c5a142485066a7e163aeea8d57850d877f21c23cb4520
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.2

Security for graffito 0.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.0.1 This release

1 release file No provenance

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