Skip to main content

A reusable Object-Oriented generic library for note processing, analysis, and security.

Project description

📝 cloudnoteslib

PyPI version Python 3.9+ License: 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 markdownrichtext without code changes

Design Patterns Used

  • Facade PatternCloudNotesClient acts as the single point of entry
  • Factory Method_create_processor() instantiates the correct text parser
  • Strategy PatternSearchEngine uses interchangeable search rules (Exact, Fuzzy, Regex)
  • Template Method — Base NoteProcessor establishes the master cleaning algorithm framework
  • Singleton PatternNoteConfig for global configuration load

📦 Installation

pip install cloudnoteslib

🚀 Quick Start

Basic Usage — Create and Process a Note

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

# 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

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)

# 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

# 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 file for details.

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

cloudnoteslib-0.1.1.tar.gz (25.6 kB view details)

Uploaded Source

Built Distribution

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

cloudnoteslib-0.1.1-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

Details for the file cloudnoteslib-0.1.1.tar.gz.

File metadata

  • Download URL: cloudnoteslib-0.1.1.tar.gz
  • Upload date:
  • Size: 25.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for cloudnoteslib-0.1.1.tar.gz
Algorithm Hash digest
SHA256 d00730a6ec935b95c4e49fc1561941eca38342f1e773855d5e2b78bb142bfb5b
MD5 613a86afb9e259ef8367fd4eca318612
BLAKE2b-256 417ed07f0123b19acc997b857185e49e1062acc998f916a4bedbbcb1ebc6e50c

See more details on using hashes here.

File details

Details for the file cloudnoteslib-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: cloudnoteslib-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 31.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.0

File hashes

Hashes for cloudnoteslib-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3711e813616d2b3ce3679e9e743f8617c629afe71aa92b697a3f61c1757e2069
MD5 2083600f67d91b46f5a19bc5dcb6392f
BLAKE2b-256 83fedcdd11d98489929339eed94d54a18e1a54b5018e2b644f17123847b25145

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