Metadata-Version: 2.4
Name: cloudnoteslib
Version: 0.1.1
Summary: A reusable Object-Oriented generic library for note processing, analysis, and security.
Home-page: https://github.com/Kavyavegunta04/Cloudnote
Author: Kavya
Author-email: Kavya <kavyavegunta27@gmail.com>
Project-URL: Homepage, https://github.com/Kavyavegunta04/Cloudnote
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Developers
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: cryptography>=41.0.0
Dynamic: author
Dynamic: home-page
Dynamic: requires-python

# 📝 cloudnoteslib

[![PyPI version](https://badge.fury.io/py/cloudnoteslib.svg)](https://badge.fury.io/py/cloudnoteslib)
[![Python 3.9+](https://img.shields.io/badge/python-3.9+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**A comprehensive, reusable Python OOP library designed for text note processing, content analysis, security, and formats exporting.**

`cloudnoteslib` provides a clean, object-oriented interface for extracting, sanitizing, analyzing, and structuring text notes securely across formats (Markdown, Plain Text, Rich Text). It strictly incorporates deep software engineering principles, serving as a standalone business logic processor suitable for both backend and script integration.

---

## 🏗️ Architecture & OOP Principles

| OOP Pillar | Implementation | Class(es) |
|---|---|---|
| **Abstraction** | Abstract base class defines the processor contract | `NoteProcessor` (ABC) |
| **Inheritance** | Concrete processors extend the abstract base | `MarkdownProcessor`, `PlainTextProcessor`, `RichTextProcessor` |
| **Encapsulation** | Private attributes with validated property accessors | `Note`, `Tag`, `NoteCollection` |
| **Polymorphism** | Interchangeable format processors with identical interfaces | Swap `markdown` ↔ `richtext` without code changes |

### Design Patterns Used

- **Facade Pattern** — `CloudNotesClient` acts as the single point of entry
- **Factory Method** — `_create_processor()` instantiates the correct text parser
- **Strategy Pattern** — `SearchEngine` uses interchangeable search rules (Exact, Fuzzy, Regex)
- **Template Method** — Base `NoteProcessor` establishes the master cleaning algorithm framework
- **Singleton Pattern** — `NoteConfig` for global configuration load

---

## 📦 Installation

```bash
pip install cloudnoteslib
```

---

## 🚀 Quick Start

### Basic Usage — Create and Process a Note

```python
from cloudnoteslib import CloudNotesClient, Note

# Initialize the client supporting 'markdown' format parsing
client = CloudNotesClient(processor_type="markdown")

# Initialize a Note (models use strict Property Encapsulation)
my_note = Note(
    title="Project Ideas", 
    content="# Main Goals\\n\\nWe need to deploy to **AWS** and use PostgreSQL.",
    tags=["work", "cloud"]
)

# Process note content (sanitizes and parses formatting depending on the Processor)
processed = client.process_note(my_note)

print(f"Title: {processed.title}")
print(f"Word Count: {processed.word_count}")
print(f"Clean Content Snippet: {processed.content[:30]}")
```

### Content Analytics

```python
# Extract analytical insights directly from note content
analytics = client.analyze_content(my_note)

print(f"Vocabulary Richness: {analytics['vocabulary_richness']}")
print(f"Reading Time (mins): {analytics['reading_time']}")
print(f"Paragraph Count: {analytics['paragraph_count']}")
print(f"Top Used Words: {analytics['top_words']}")
```

### Search Using Strategies

```python
from cloudnoteslib import NoteCollection

collection = NoteCollection([my_note, Note("Meeting", "Met with team about the project.")])

# Default Exact Match Strategy
exact_results = client.search_notes(collection, query="project")

# Swap to Fuzzy or Regex strategy dynamically!
fuzzy_results = client.search_notes(collection, query="prject", strategy="fuzzy")
regex_results = client.search_notes(collection, query="^Proj", strategy="regex")

print(f"Fuzzy Found: {len(fuzzy_results)} note(s)")
```

### Enterprise Security (AES Encrypt & HTML Sanitize)

```python
# Encrypt highly sensitive note contents for DB storage
password = "my_secure_user_pass_123"
cipher_text = client.encrypt_content("My Secret Credit Card Pin: 1234", password)

# Decrypt
plain_text = client.decrypt_content(cipher_text, password)

# Note: Client auto-sanitizes against Cross-Site Scripting (XSS) on process_note()
malicious_note = Note("Hack", "Hello <script>alert(1)</script> World")
safe_note = client.process_note(malicious_note)
print(safe_note.content) # Output removes malicious script tags
```

### Exporters

```python
# Export an entire collection into a structured JSON string or Markdown file representation
json_string = client.export(collection, format="json")
md_string = client.export(collection, format="md")
```

---

## 📖 API Reference

### Core Classes

| Class | Module | Description |
|---|---|---|
| `CloudNotesClient` | `cloudnoteslib` | High-level Facade bridging all modules |
| `Note` | `cloudnoteslib.models` | Immutable base node holding title, content, properties |
| `NoteCollection` | `cloudnoteslib.models` | Iterable container holding multiple notes |
| `Tag` | `cloudnoteslib.models` | Categorization entity holding name and auto-color |
| `NoteConfig` | `cloudnoteslib.config` | Singleton Configuration manager |

### Processors

| Class | Module | Description |
|---|---|---|
| `NoteProcessor` | `cloudnoteslib.processors` | Abstract base class (ABC) |
| `MarkdownProcessor` | `cloudnoteslib.processors` | Markdown content sanitizer |
| `PlainTextProcessor` | `cloudnoteslib.processors` | Standard text normalization |
| `RichTextProcessor` | `cloudnoteslib.processors` | HTML formatting parser |

### Analyzers

| Class | Module | Description |
|---|---|---|
| `ContentAnalyzer` | `cloudnoteslib.analyzers` | Single-note Deep Analytics |
| `NoteStatistics` | `cloudnoteslib.analyzers` | Collection-wide summaries |
| `SearchEngine` | `cloudnoteslib.analyzers` | Multi-strategy search application |

### Security & Exporters

| Class | Module | Description |
|---|---|---|
| `NoteEncryptor` | `cloudnoteslib.security` | PBKDF2/Fernet AES Encryption wrapper |
| `ContentSanitizer` | `cloudnoteslib.security` | Sub-layer removing unsafe URL/script tags |
| `JSONExporter` | `cloudnoteslib.exporters` | Format out to JSON structures |
| `MarkdownExporter` | `cloudnoteslib.exporters` | Format out to Markdown file dumps |

### Exceptions

| Exception | Description |
|---|---|
| `CloudNotesLibError` | Base exception |
| `NoteValidationError` | Property length bounds exceeded |
| `ProcessorNotSupportedError` | Unknown syntax selection |
| `SecurityError` | Failed decryption/encryption |

---

## 📄 License

This project is licensed under the MIT License — see the [LICENSE](LICENSE) file for details.
