Skip to main content

MetaX 是一个功能丰富的Python工具库,提供数学运算、字符串处理、日期时间、文件操作等常用工具函数,帮助开发者提高开发效率。

Project description

MetaX

PyPI version Python License

English | 中文


中文

MetaX 是一个功能丰富的Python工具库,提供数学运算、字符串处理、日期时间、文件操作等常用工具函数,帮助开发者提高开发效率。

📖 项目定位

MetaX致力于成为Python开发者的得力助手,提供:

  • 🔢 数学运算 - 基础运算、高级数学函数、数论工具
  • 📝 字符串处理 - 格式化、验证、转换工具
  • ⏰ 日期时间 - 时间获取、计算、格式化工具
  • 📁 文件操作 - 文件读写、路径操作、哈希计算

所有函数都经过精心设计,提供完整的类型注解和文档字符串,支持IDE自动提示,开箱即用。

🚀 安装

使用pip安装

pip install metax

升级到最新版本

pip install metax --upgrade

从TestPyPI安装(测试版本)

pip install --index-url https://test.pypi.org/simple/ metax

💡 快速开始

基础示例

import metax

# 问候函数
print(metax.hello("世界"))  # 输出: 你好, 世界!

数学运算

import metax

# 基础运算
print(metax.add(10, 5))        # 加法: 15
print(metax.subtract(10, 5))   # 减法: 5
print(metax.multiply(10, 5))   # 乘法: 50
print(metax.divide(10, 5))     # 除法: 2.0

# 高级运算
print(metax.power(2, 3))       # 幂运算: 8.0
print(metax.sqrt(16))          # 平方根: 4.0
print(metax.factorial(5))      # 阶乘: 120

字符串处理

import metax

# 格式化
print(metax.reverse("hello"))           # 反转: olleh
print(metax.mask("13812345678", 3, 4))  # 脱敏: 138****5678
print(metax.format_size(1024000))       # 文件大小: 1000.00 KB

# 验证
print(metax.is_email("test@example.com"))   # 邮箱验证: True
print(metax.is_phone_cn("13812345678"))     # 手机号验证: True
print(metax.is_url("https://example.com"))  # URL验证: True

日期时间

import metax

print(metax.now())           # 当前时间: 2026-05-15 10:30:45
print(metax.timestamp())     # 时间戳: 1705285845
print(metax.today())         # 今天日期: 2026-05-15

文件操作

import metax

# 文件读写
metax.write_text("test.txt", "Hello, MetaX!")
content = metax.read_text("test.txt")

# 路径操作
path = metax.join_path("D:", "test", "file.txt")
print(metax.get_extension("test.txt"))  # 扩展名: .txt

📚 文档

文档入口

详细文档

更新日志

🔗 重要链接

PyPI

GitHub

📦 功能概览

模块 功能 函数数量
数学运算 基础运算、高级运算、数论函数 17个
字符串处理 格式化、验证 26个
日期时间 时间获取、计算、判断 17个
文件操作 读写、路径、哈希 22个

总计:82+个实用函数

🎯 适用场景

  • 数据处理 - 数学计算、字符串处理
  • 表单验证 - 邮箱、手机号、身份证验证
  • 日志处理 - 时间格式化、文件操作
  • 工具开发 - 快速构建命令行工具
  • 自动化脚本 - 文件处理、数据转换

🤝 贡献

欢迎贡献代码、报告问题或提出建议!

贡献流程

  1. Fork 项目仓库
  2. 创建功能分支 (git checkout -b feature/AmazingFeature)
  3. 提交更改 (git commit -m 'Add some AmazingFeature')
  4. 推送到分支 (git push origin feature/AmazingFeature)
  5. 创建 Pull Request

详细流程请参考 更新流程文档

📄 许可证

本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情

📊 版本信息

  • 当前版本:0.1.2
  • Python版本:>= 3.8

🌟 Star History

如果这个项目对你有帮助,请给一个 ⭐️ Star 支持一下!


English

MetaX is a feature-rich Python utility library that provides common tools for mathematical operations, string processing, datetime handling, and file operations, helping developers improve productivity.

📖 Project Positioning

MetaX aims to be a helpful assistant for Python developers, providing:

  • 🔢 Math Operations - Basic operations, advanced math functions, number theory tools
  • 📝 String Processing - Formatting, validation, conversion tools
  • ⏰ Datetime - Time retrieval, calculation, formatting tools
  • 📁 File Operations - File I/O, path operations, hash calculation

All functions are carefully designed with complete type annotations and docstrings, supporting IDE auto-completion, ready to use out of the box.

🚀 Installation

Install with pip

pip install metax

Upgrade to Latest Version

pip install metax --upgrade

Install from TestPyPI (Testing Version)

pip install --index-url https://test.pypi.org/simple/ metax

💡 Quick Start

Basic Example

import metax

# Greeting function
print(metax.hello("World"))  # Output: 你好, World!

Math Operations

import metax

# Basic operations
print(metax.add(10, 5))        # Addition: 15
print(metax.subtract(10, 5))   # Subtraction: 5
print(metax.multiply(10, 5))   # Multiplication: 50
print(metax.divide(10, 5))     # Division: 2.0

# Advanced operations
print(metax.power(2, 3))       # Power: 8.0
print(metax.sqrt(16))          # Square root: 4.0
print(metax.factorial(5))      # Factorial: 120

String Processing

import metax

# Formatting
print(metax.reverse("hello"))           # Reverse: olleh
print(metax.mask("13812345678", 3, 4))  # Mask: 138****5678
print(metax.format_size(1024000))       # File size: 1000.00 KB

# Validation
print(metax.is_email("test@example.com"))   # Email validation: True
print(metax.is_phone_cn("13812345678"))     # Phone validation: True
print(metax.is_url("https://example.com"))  # URL validation: True

Datetime

import metax

print(metax.now())           # Current time: 2026-05-15 10:30:45
print(metax.timestamp())     # Timestamp: 1705285845
print(metax.today())         # Today's date: 2026-05-15

File Operations

import metax

# File I/O
metax.write_text("test.txt", "Hello, MetaX!")
content = metax.read_text("test.txt")

# Path operations
path = metax.join_path("D:", "test", "file.txt")
print(metax.get_extension("test.txt"))  # Extension: .txt

📚 Documentation

Documentation Portal

Detailed Docs

Changelog

🔗 Important Links

PyPI

GitHub

📦 Feature Overview

Module Features Function Count
Math Operations Basic operations, advanced math, number theory 17
String Processing Formatting, validation 26
Datetime Time retrieval, calculation, judgment 17
File Operations I/O, path, hash 22

Total: 82+ utility functions

🎯 Use Cases

  • Data Processing - Mathematical calculations, string processing
  • Form Validation - Email, phone, ID card validation
  • Log Processing - Time formatting, file operations
  • Tool Development - Quick CLI tool building
  • Automation Scripts - File processing, data conversion

🤝 Contributing

Contributions, bug reports, and feature requests are welcome!

Contribution Process

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

For detailed process, please refer to Update Process Documentation

📄 License

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

📊 Version Information

  • Current Version: 0.1.2
  • Python Version: >= 3.8

🌟 Star History

If this project helps you, please give it a ⭐️ Star!


Made with ❤️ by ACANX

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

metax-0.1.3.tar.gz (19.2 kB view details)

Uploaded Source

Built Distribution

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

metax-0.1.3-py3-none-any.whl (18.8 kB view details)

Uploaded Python 3

File details

Details for the file metax-0.1.3.tar.gz.

File metadata

  • Download URL: metax-0.1.3.tar.gz
  • Upload date:
  • Size: 19.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for metax-0.1.3.tar.gz
Algorithm Hash digest
SHA256 a2bf3c7cb2244319a7cba51201ffe8ad5efe1cf6e583416f3bba2fd46d6f3853
MD5 769f57f9d89decb1b4b99d97ea893a52
BLAKE2b-256 6a3538994065cbd2a216b4bd7e516b503260b34530e527ac21c6ea3e53ae1a54

See more details on using hashes here.

File details

Details for the file metax-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: metax-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for metax-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 3b87e4849faccfd92cb0d04749b9b6ecc3991e5e3d6e27fad3d8650ef6dccd53
MD5 7ef11fa95120a647e23fa921a0c9898a
BLAKE2b-256 fa17f37650861ea05e603e1627d9e192bd87ac68b3c764609ec7cb5876033694

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