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, TimeUnit
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, TimeUnit.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.3.tar.gz (69.5 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.3-py3-none-any.whl (79.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: true_core-0.1.3.tar.gz
  • Upload date:
  • Size: 69.5 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.3.tar.gz
Algorithm Hash digest
SHA256 aeb1af5107d4d0262ceb7251a7543ddfc2ce8ab1ee3da5d4aadcb19322920160
MD5 cb31ec67bd50cb642acb47d691ea1c75
BLAKE2b-256 a58092a803170397aefe1c02804b09c33235190093a9ffe0b89067d7439117b0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: true_core-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 79.7 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b87a80f1732926cc591f23b15c6924eb511cbdd0217a8d595c0010430bf1a800
MD5 f067be56e26f2fb37e7b8b7e0f2b571c
BLAKE2b-256 4b552296386a3e7837e3922ad8774537a52284c38329ab7b2fa958e81bd972ea

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