Skip to main content

A lightweight and extensible Python utility toolkit for productivity and automation.

Project description

You Can You Up (UCUU) 🚀


Tests GitHub Pages PyPI Package

⚠️ Important:
The majority of the code in this repository is generated using AI coding tools such as GitHub Copilot (GPT-4o) and TRAE (Doubao 1.5 Pro).

1. Brief Introduction

UCUU is a Python utility library for function wrapping and proxying. It supports adding proxy logic to functions via decorators or patching, making it easy to extend, debug, and test.


2. Install and Usage ⚙️

2.1 Installation

You can install UCUU from PyPI:

pip install ucuu

Or, clone this repository and install locally:

git clone https://github.com/wZuck/ucuu.git
cd ucuu
pip install .

2.2 Usage

2.2.1 Decorator mode (wrap for functions)

Example: Use a decorator to add a proxy function.
Effect: When my_func is called, it prints "My function logic" and then the proxy prints "Hello, hello ucuu".

from ucuu.decorator import ucuu

@ucuu("package_utils.print_ucuu_hello", ending_words="hello ucuu")
def my_func():
    print("My function logic")

2.2.2 Patch mode (wrap for external functions)

Example: Patch an existing function with a proxy.
Effect: When some_func is called, it prints "Original logic" and then the proxy prints "Hello, patch mode".

from ucuu.decorator import ucuu

def some_func():
    print("Original logic")

some_func = ucuu("package_utils.print_ucuu_hello", ending_words="patch mode")(some_func)

2.2.3 Register proxy functions

Example: Implement a proxy function to be called by the decorator or patch.
Effect: Prints different messages depending on the ending_words argument.

# tests/package_utils/test_print.py
def print_ucuu_hello(ending_words=None, *args, **kwargs):
    if ending_words is None:
        print("No Ending Words.")
    elif ending_words == "please raise errors":
        raise NotImplementedError('Raise Error due to requests')
    else:
        print(f"Hello, {ending_words}")

3. Demos in Testcases 🧪

  • See the tests/ directory for test cases covering decorator usage, patching, exception handling, argument binding, and more.

4. License 📄

MIT License


5. Contribute 🤝

Contributions via PR or issues are welcome!
For suggestions or questions, please leave a message at GitHub Issues.


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

ucuu-0.1.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ucuu-0.1.1-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file ucuu-0.1.1.tar.gz.

File metadata

  • Download URL: ucuu-0.1.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ucuu-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b2a71e741b56adf3b59c0a36fb5d4f559594963e56660f85e87c42bb385f080c
MD5 207be4ad933cb6646523955b810c9361
BLAKE2b-256 e71cb0f2303a444d0c15c7a932ca83a9f45b88057600541dbbc7fe161bd575a9

See more details on using hashes here.

File details

Details for the file ucuu-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: ucuu-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for ucuu-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 89e904b178dfa1ace29a5a9a67538e79af8ef8c3d9066a5855700ec7f9a50bb7
MD5 c655d507b71267f15e0ca82a517dbbdd
BLAKE2b-256 7c2a3ffd57eeafa9ce14108d4d4de00021013aee173552c53007f499bc4051ea

See more details on using hashes here.

Supported by

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