Skip to main content

Reserved placeholder for pyw-core (umbrella namespace)

Project description

pyw-core ๐ŸŒ

PyPI CI License

Namespace seed & common utilities for the pythonWoods ecosystem.

Overview

pyw-core รจ il cuore dell'ecosistema pythonWoods, fornendo il namespace condiviso, utilities comuni e le basi architetturali per tutti i moduli. Anche se minimalista per design, รจ il fondamento che garantisce coerenza e interoperabilitร  tra tutti i package.

Ecosystem Overview

Package Description Status
pyw-core Namespace & common utilities 0.0.0
pyw-logger Structured logging (rich + structlog) 0.0.0
pyw-fs Unified filesystem (local/S3/GCS) 0.0.0
pyw-secret Secret backends (.env, Vault, SSM) 0.0.0
pyw-cli Typer CLI scaffolding 0.0.0
pyw-config Configuration utilities 0.0.0
pyw-vision Vision utilities & helpers 0.0.0
pyw-motion Motion detection & tracking 0.0.0
pyw-music21 Music21 stubs & helpers 0.0.0
pyw-musicparser Parse MIDI/Lilypond 0.0.0

Bundle Packages

Bundle Description Includes
pyw-devtools Developer toolkit logger, fs, cli, secret, config
pyw-music Music processing music21, musicparser
pyw-cv Computer vision vision, motion

Philosophy

  • Namespace package โ€“ import pyw.* per evitare conflitti e garantire coerenza
  • Small, composable modules โ€“ scegli solo ciรฒ che ti serve, zero bloat
  • Typed APIs โ€“ Pydantic models e type hints per zero sorprese
  • No heavy deps by default โ€“ librerie "pesanti" (Torch, OpenCV) come extras opzionali
  • Interoperability-first โ€“ tutti i moduli condividono pattern e utilities comuni

Installation

pip install pyw-core

pyw-core รจ intenzionalmente minimalista: fornisce solo il namespace e utilities fondamentali condivise dall'ecosistema.

Core Features

๐Ÿ—๏ธ Base Classes

from pyw.core import BaseConfig, BaseModel
from pyw.core.types import PathLike, JsonDict

class MyConfig(BaseConfig):
    """Configurazione con validazione type-safe."""
    name: str
    debug: bool = False
    paths: list[PathLike] = []

class DataModel(BaseModel):
    """Modello dati con serializzazione automatica."""
    id: int
    metadata: JsonDict = {}

๐Ÿ”ง Common Utilities

from pyw.core.utils import (
    ensure_list, deep_merge, safe_import,
    classproperty, deprecated
)

# List normalization
items = ensure_list("single_item")  # โ†’ ["single_item"]
items = ensure_list(["already", "list"])  # โ†’ ["already", "list"]

# Deep dictionary merging
config = deep_merge(
    {"db": {"host": "localhost", "port": 5432}},
    {"db": {"port": 3306, "ssl": True}}
)
# โ†’ {"db": {"host": "localhost", "port": 3306, "ssl": True}}

# Safe imports con fallback
requests = safe_import("requests", fallback_message="pip install requests")

# Class properties
class MyClass:
    @classproperty
    def version(cls):
        return "1.0.0"

# Deprecation warnings
@deprecated("Use new_function() instead", version="2.0.0")
def old_function():
    pass

๐Ÿ“ฆ Plugin Discovery

from pyw.core.plugins import discover_plugins, load_plugin

# Trova tutti i plugin pyw installati
plugins = discover_plugins("pyw.*")

# Carica plugin specifico
logger_plugin = load_plugin("pyw.logger")

๐Ÿ” Type Utilities

from pyw.core.types import (
    PathLike, JsonDict, OptionalStr,
    Singleton, classproperty
)
from typing import Any

# Type aliases comuni
def process_file(path: PathLike) -> JsonDict:
    """Accetta str, Path, o file-like objects."""
    pass

# Singleton pattern
class DatabaseConnection(Singleton):
    def __init__(self):
        self.connected = False

# Sempre la stessa istanza
db1 = DatabaseConnection()
db2 = DatabaseConnection()
assert db1 is db2

โšก Performance Utilities

from pyw.core.performance import (
    timer, cache_result, rate_limit,
    memory_usage
)
import time

# Timing decorator
@timer
def slow_function():
    time.sleep(1)
    return "done"

result = slow_function()  # Logs: "slow_function took 1.002s"

# Result caching
@cache_result(ttl=300)  # Cache for 5 minutes
def expensive_computation(x: int) -> int:
    return x ** 2

# Rate limiting
@rate_limit(calls=10, period=60)  # Max 10 calls/minute
def api_call():
    pass

# Memory monitoring
with memory_usage() as mem:
    big_list = list(range(1000000))
print(f"Memory used: {mem.peak_mb:.1f} MB")

Integration Patterns

๐Ÿ”— Module Integration

# Pattern per moduli pyw
from pyw.core import BaseModule

class MyModule(BaseModule):
    """Template per nuovi moduli pyw."""
    
    name = "my-module"
    version = "1.0.0"
    dependencies = ["pyw-core>=0.1.0"]
    
    def __init__(self, config=None):
        super().__init__()
        self.config = config or self.default_config()
    
    @classmethod
    def default_config(cls):
        return {"enabled": True}

๐Ÿงช Testing Support

from pyw.core.testing import (
    temporary_directory, mock_environment,
    assert_type_safe, benchmark
)

def test_my_function():
    with temporary_directory() as tmpdir:
        # Test con directory temporanea
        pass
    
    with mock_environment({"DEBUG": "true"}):
        # Test con environment variables mock
        pass
    
    # Type safety testing
    result = my_typed_function("input")
    assert_type_safe(result, MyExpectedType)
    
    # Performance benchmarking
    with benchmark("my_operation") as b:
        expensive_operation()
    assert b.elapsed < 1.0  # Max 1 second

Bundle Installation

Per installare gruppi di moduli correlati:

# Developer toolkit completo
pip install pyw-devtools  # logger + fs + cli + secret + config

# Music processing
pip install pyw-music     # music21 + musicparser  

# Computer vision
pip install pyw-cv        # vision + motion

Advanced Usage

๐Ÿ”Œ Custom Extensions

from pyw.core.extensions import register_extension

@register_extension("mycompany.custom")
class CustomExtension:
    """Estensione personalizzata per pyw."""
    
    def setup(self):
        # Inizializzazione custom
        pass

# Auto-discovered da pyw.core.plugins

๐Ÿ“Š Ecosystem Stats

from pyw.core import ecosystem_info

# Info sull'ecosistema installato
info = ecosystem_info()
print(f"Installed pyw modules: {len(info.modules)}")
for module in info.modules:
    print(f"  {module.name} v{module.version}")

๐ŸŽฏ Quality Assurance

from pyw.core.qa import (
    validate_module, check_compatibility,
    run_ecosystem_tests
)

# Valida un modulo pyw
issues = validate_module("pyw.mymodule")
if issues:
    for issue in issues:
        print(f"โš ๏ธ  {issue}")

# Check compatibilitร  tra moduli
compat = check_compatibility(["pyw-logger==1.0", "pyw-fs==2.0"])
assert compat.compatible

Development Tools

๐Ÿ—๏ธ Module Scaffolding

# Crea nuovo modulo pyw
pyw-core scaffold my-module --type=utility
cd pyw-my-module/

# Struttura generata:
# pyw-my-module/
# โ”œโ”€โ”€ pyw/
# โ”‚   โ””โ”€โ”€ my_module/
# โ”‚       โ”œโ”€โ”€ __init__.py
# โ”‚       โ””โ”€โ”€ core.py
# โ”œโ”€โ”€ tests/
# โ”œโ”€โ”€ pyproject.toml
# โ””โ”€โ”€ README.md

๐Ÿ“‹ Quality Checks

# Linting ecosystem-wide
pyw-core lint --all-modules

# Type checking
pyw-core mypy --strict

# Run all tests
pyw-core test --coverage

# Check dependencies
pyw-core deps --check-conflicts

Roadmap

  • ๐Ÿ—๏ธ Enhanced utilities: Async helpers, concurrency utilities
  • ๐Ÿ“ฆ Plugin system: Hot-reloading, dependency injection
  • ๐Ÿ”ง Dev experience: Better debugging, profiling integration
  • ๐Ÿ“š Documentation: Auto-generated API docs, examples
  • ๐ŸŽฏ Quality tools: Advanced linting, security scanning
  • ๐ŸŒ Ecosystem: Package discovery, compatibility matrix
  • โšก Performance: Caching strategies, optimization helpers

Contributing

pyw-core รจ il cuore dell'ecosistema - ogni contributo deve essere attentamente valutato:

  1. Fork & Clone: git clone https://github.com/pythonWoods/pyw-core.git
  2. Development setup: poetry install && poetry shell
  3. Quality checks: ruff check . && mypy && pytest
  4. Documentation: Aggiorna docs per ogni modifica API
  5. Compatibility: Assicurati che le modifiche non rompano altri moduli
  6. Pull Request: CI esegue test completi dell'ecosistema

Architecture Notes

pyw-core (namespace + utilities)
โ”œโ”€โ”€ pyw/__init__.py          # Namespace package
โ”œโ”€โ”€ pyw/core/
โ”‚   โ”œโ”€โ”€ __init__.py         # Public API exports
โ”‚   โ”œโ”€โ”€ base.py             # BaseConfig, BaseModel
โ”‚   โ”œโ”€โ”€ utils.py            # Common utilities  
โ”‚   โ”œโ”€โ”€ types.py            # Type aliases & helpers
โ”‚   โ”œโ”€โ”€ plugins.py          # Plugin discovery
โ”‚   โ”œโ”€โ”€ performance.py      # Performance tools
โ”‚   โ”œโ”€โ”€ testing.py          # Test utilities
โ”‚   โ””โ”€โ”€ exceptions.py       # Common exceptions
โ””โ”€โ”€ tests/                  # Comprehensive test suite

Felice coding nella foresta di pythonWoods! ๐ŸŒฒ๐Ÿพ

Links utili

Documentazione dev (work-in-progress) โ†’ https://pythonwoods.dev/docs/pyw-core/latest/

Issue tracker โ†’ https://github.com/pythonWoods/pyw-core/issues

Changelog โ†’ https://github.com/pythonWoods/pyw-core/releases

ยฉ pythonWoods โ€” MIT License

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

pyw_core-0.0.0.post3.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

pyw_core-0.0.0.post3-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pyw_core-0.0.0.post3.tar.gz.

File metadata

  • Download URL: pyw_core-0.0.0.post3.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pyw_core-0.0.0.post3.tar.gz
Algorithm Hash digest
SHA256 cf4893c1535c9e6c2fb5b0ed4314c5653b4583495d743f3629c211ff195e3d4c
MD5 42d3f54149ce5af2d39a60007d94293f
BLAKE2b-256 e35c382a8c385bd8658242bd7933c56ea78a69f5c74866c7e416fdff248e6d02

See more details on using hashes here.

File details

Details for the file pyw_core-0.0.0.post3-py3-none-any.whl.

File metadata

  • Download URL: pyw_core-0.0.0.post3-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.4

File hashes

Hashes for pyw_core-0.0.0.post3-py3-none-any.whl
Algorithm Hash digest
SHA256 c81e3a669f99b264b8c10293962712c190b850be99c70e9973e140618d53a1e0
MD5 7d84b0725860e55d8851ed56eb074255
BLAKE2b-256 d77d649f6061c722ae5366e10be5097615d001a7c6375b61c3d3ae56f483a44e

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