Skip to main content

A utility library for Python development

Project description

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.

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

pymagic_guyue-0.0.1.tar.gz (40.9 kB view details)

Uploaded Source

Built Distribution

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

pymagic_guyue-0.0.1-py3-none-any.whl (42.9 kB view details)

Uploaded Python 3

File details

Details for the file pymagic_guyue-0.0.1.tar.gz.

File metadata

  • Download URL: pymagic_guyue-0.0.1.tar.gz
  • Upload date:
  • Size: 40.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for pymagic_guyue-0.0.1.tar.gz
Algorithm Hash digest
SHA256 9bee48551213b71845a69a437c66d9e74dd95954082cdc2abe3a17d4b04bd961
MD5 4eb9062f07733300ba9312056f834dcc
BLAKE2b-256 ed2c46f49f6586c110d23ca37c995a2e19e688109c9aa395f2e66c135078c350

See more details on using hashes here.

File details

Details for the file pymagic_guyue-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pymagic_guyue-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 42.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for pymagic_guyue-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 94632afbdbab1ad68e100ade5c6a485d86ae455314af7c4ceb8040b80ea82314
MD5 a5e1d55fccc03ca0a6e9bdc86d2f7c81
BLAKE2b-256 8e3edebfcf9ed201c2dbf0af0c076b91b41e14bad6a877e05ae219f60943ea3b

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