Skip to main content

PyMagic

A comprehensive utility library for Python development, providing tools for logging, debugging, and common operations.

Installation

pip install pymagic

Features

  • Logging System: Advanced logging capabilities based on loguru with customizable formats
  • Utility Tools: Common utility functions for string manipulation, file operations, and more
  • Decorators: Useful decorators for exception handling, timing, and other common patterns
  • Base Classes: Extensible base classes to simplify application development

Usage

Logging

from pymagic import logger

# Basic logging
logger.info("This is an info message")
logger.error("This is an error message")

# Create a custom logger
from pymagic import LoggerUtils

custom_logger = LoggerUtils.new("logs/app.log", level="DEBUG")
custom_logger.debug("This is a debug message in custom logger")

Utility Tools

from pymagic import Tools

# Check if string contains Chinese characters
contains_chinese = Tools.is_contain_zh("浣犲ソ World")

# Get current timestamp
timestamp = Tools.get_timestamp()

# Format time
formatted_time = Tools.format_time(timestamp, "%Y-%m-%d")

Using Base Class

from pymagic import Base

class MyClass(Base):
    def process_data(self, data):
        # Automatically gets exception handling
        # and logging capabilities
        return data.transform()

# Use with context manager
with MyClass() as my_instance:
    result = my_instance.process_data(some_data)

Documentation

For full documentation, visit our documentation site.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for pymagic-guyue 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 pymagic-guyue 0.0.1
File Size Uploaded
pymagic_guyue-0.0.1.tar.gz 40.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pymagic-guyue 0.0.1
File Interpreter ABI Platform
pymagic_guyue-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 83.8 kB

Release files / pymagic_guyue-0.0.1.tar.gz

Download URL pymagic_guyue-0.0.1.tar.gz
Size 40.9 kB
Tags Source
SHA-256 checksum
How to use checksums
9bee48551213b71845a69a437c66d9e74dd95954082cdc2abe3a17d4b04bd961
BLAKE2b-256 checksum
How to use checksums
ed2c46f49f6586c110d23ca37c995a2e19e688109c9aa395f2e66c135078c350
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release files / pymagic_guyue-0.0.1-py3-none-any.whl

Download URL pymagic_guyue-0.0.1-py3-none-any.whl
Size 42.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
94632afbdbab1ad68e100ade5c6a485d86ae455314af7c4ceb8040b80ea82314
BLAKE2b-256 checksum
How to use checksums
8e3edebfcf9ed201c2dbf0af0c076b91b41e14bad6a877e05ae219f60943ea3b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.20

Release history Release notifications | RSS feed

This release

0.0.1 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