Skip to main content

A boilerplate utility package

Project description

True-Core Python Library

A sophisticated Python utility library providing advanced enum management, type validation, time handling, regular expressions, and file operations.

Core Components

1. Enum Management (true.enum_registry)

  • EnumRegistry: Advanced enum combination and management
    • Merge multiple enum classes into a single registry
    • Type-safe operations and validation
    • Metadata support with descriptions, tags, and timestamps
    • Comprehensive filtering capabilities
    • Statistical analysis and serialization

2. Enum Toolkits (true.enums_toolkits)

  • Specialized Enum Classes:
    • DynamicEnum: Runtime-modifiable enums
    • Type-safe enums: ByteEnum, FloatEnum, ComplexNumberEnum
    • Collection enums: DictEnum, SetEnum, ListEnum, TupleEnum
    • Iterator enums: IterableEnum, IteratorEnum, GeneratorEnum
  • Metadata Support:
    • Custom attribute configuration
    • Type information tracking
    • Serialization capabilities

3. Collections (true.collections)

  • File System Operations:
    • Secure file deletion and creation
    • Advanced file metadata handling
    • Cross-platform compatibility
    • File type-specific operations
  • File Management:
    • RecycleBin with metadata tracking
    • Batch file operations
    • Directory watching
    • File statistics and analysis

4. Time Management (true.time)

  • Time Handling:
    • Advanced timezone support
    • Time arithmetic and comparisons
    • Duration calculations
    • Event scheduling
  • Time Features:
    • Time rounding and formatting
    • Timezone conversions
    • Performance timing decorators
    • Schedule management with conflict detection

5. Regular Expressions (true.re)

  • Validation Patterns:
    • Username validation patterns
    • Password complexity patterns
    • Email format validation
    • Phone number formats
    • Credit card validation
    • URL pattern matching
    • Date format validation
    • IP address validation

6. Type System (true.types)

  • Version Types:
    • SemVer, CalVer, DateVersion support
    • Version validation and comparison
  • Numeric Types:
    • BigInt and BigDecimal with validation
    • Scientific number handling
    • Validated numeric types
  • ID Types:
    • UUID/ULID support with versions
    • String and integer-based IDs
  • Serialization:
    • JSON, YAML, TOML support
    • Type conversion utilities

7. Exception Handling (true.exceptions)

  • Specialized Exceptions:
    • Enum-related exceptions
    • Type validation errors
    • Schedule management errors
    • File operation errors
    • Access control exceptions
    • Configuration errors

Installation

pip install true-core

Quick Start

from true.enum_registry import EnumRegistry
from true.collections import OSUtils
from true.time import Time, Schedule, Event
from true.types import BigInt, Version
from enum import Enum

# Enum Registry Example
class ColorEnum(Enum):
    RED = 1
    BLUE = 2

registry = EnumRegistry([ColorEnum])
int_values = registry.filter.by_value_type(int)

# Time Management Example
time = Time.now()
schedule = Schedule()
event = Event(name="Meeting", start_time=time, end_time=time.add(1, "hours"))
schedule.add_event(event)

# Type Validation Example
version = Version("1.2.3")
big_num = BigInt(1000000, context="Positive")

# File Operations Example
utils = OSUtils()
utils.force_delete("path/to/file")  # Secure deletion
utils.watch_directory("path/to/dir", callback=lambda event: print(f"Change: {event.src_path}"))

Requirements

  • Python 3.8+
  • Platform-specific dependencies:
    • Windows: pywin32 for advanced file operations
    • Unix: Standard Python libraries
  • Optional dependencies:
    • pytz for timezone support
    • pydub for audio file handling
    • Pillow for image processing

Documentation

For detailed documentation, see docs.

License

MIT License - See LICENSE file for details.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

Support

For support:

  1. Check the documentation
  2. Search existing issues
  3. Create a new issue if needed

Author

Alaamer - https://github.com/alaamer12

Acknowledgments

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

true_core-0.1.2.tar.gz (52.8 kB view details)

Uploaded Source

Built Distribution

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

true_core-0.1.2-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file true_core-0.1.2.tar.gz.

File metadata

  • Download URL: true_core-0.1.2.tar.gz
  • Upload date:
  • Size: 52.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.6

File hashes

Hashes for true_core-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d927a9e8df04e5d0707ace8e7933a630ae90de052f839a384260341e017f4e67
MD5 073076677ebe10ea013f6b4e6be088ee
BLAKE2b-256 dbc00b479cb6215f4e53beb86403c7a00c31efd025b3c130cd3492757bc051ca

See more details on using hashes here.

File details

Details for the file true_core-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: true_core-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.6

File hashes

Hashes for true_core-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 795c3e92a9d2e5f8d563c076810ff41353045f6a84499322ff972f8b36a8aa26
MD5 ad93b88b67fb039e1601196005122d69
BLAKE2b-256 f3845015e719d10d40a47bcf1f69b6e69ce8b214a5ad3033fe5ad1677c5b8b60

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