Skip to main content

A complete Python framework for full-stack development with Azure integration, SMS, SharePoint, and automation capabilities

Project description

JLFramework

PyPI version Python 3.9+ License: MIT

A complete Python framework for full-stack development with FastAPI and Vue.js, plus comprehensive automation utilities for Azure, SMS, SharePoint, SQL, and more. Create production-ready applications in minutes with Django-like scaffolding and importable utilities.

โœจ Features

๐Ÿš€ Rapid Development

  • Rapid Scaffolding - Create full-stack projects in under 5 minutes
  • Production-Ready Templates - FastAPI backend + Vue.js frontends with best practices
  • Django-like Experience - Clean imports and intuitive CLI commands

๐Ÿ—๏ธ Full-Stack Templates

  • Multiple Frontend Options - Embedded, features, and marketplace templates
  • Flexible & Modular - Use only what you need, mix and match templates
  • Docker Ready - Dockerfiles included for all templates

๐Ÿ”ง Automation Utilities (New in v1.0.7!)

  • SMS Integration - Send SMS via Twilio with delivery tracking
  • SharePoint/Email - Microsoft Graph API integration for emails and file operations
  • SQL Management - Connection pooling, async/sync queries, retry logic
  • Notifications - Automatic Slack and Teams notifications with decorators
  • Azure Integration - App Configuration, Blob Storage, and more
  • No Hardcoded Credentials - All config from Azure App Configuration or .env files

๐Ÿ”’ Security & Enterprise Features

  • Security First - Tenant isolation, OIDC auth, audit logging built-in
  • Batteries Included - Database, auth, logging, middleware, and more
  • Multi-Environment - Dev, UAT, Prod configuration support

๐Ÿ“ฆ Installation

# Install the framework
pip install jlframework

# Install with all optional dependencies
pip install jlframework[all]

# Install with dev dependencies
pip install jlframework[dev]

๐Ÿš€ Quick Start

1. Create a Full-Stack Project

# Initialize a new project
jlframework init my-awesome-app
cd my-awesome-app

# Add backend
jlframework add backend

# Add frontend
jlframework add frontend-embedded

# List available templates
jlframework list

2. Use Automation Utilities

from jlframework import (
    # SMS Integration
    SMSHandler,
    
    # SharePoint & Email
    SharePointManager,
    
    # SQL Management
    SqlManager,
    
    # Notifications
    slack_notification,
    teams_notification,
    
    # Azure Integration
    AzureAppConfig,
    BlobStorageManager,
    
    # Utilities
    ExecutionResult,
    ReportStatus,
)

# Send SMS
sms = SMSHandler()
sms.send_sms(to_number="+1234567890", message="Hello!")

# Send Email via SharePoint
sp = SharePointManager()
await sp.send_email(
    subject="Test Email",
    body="Hello from jlframework!",
    recipient="user@example.com"
)

# Query Database with Connection Pooling
sql = SqlManager()
df = await sql.get_async("SELECT * FROM users", "users_data")

# Automatic Notifications
@slack_notification()
async def my_automation(self):
    # Your automation logic
    return ExecutionResult(
        status=ReportStatus.SUCCEEDED,
        records_processed=100
    )

3. Use FastAPI Utilities

from fastapi import FastAPI, Request, Depends
from sqlalchemy.orm import Session
from jlframework import (
    get_db,
    CommonManager,
    AuditManager,
    restrict_access_middleware,
)

app = FastAPI()

# Add middleware
app.middleware("http")(restrict_access_middleware)

@app.get("/api/v1/items")
async def get_items(
    request: Request,
    db: Session = Depends(get_db)
):
    # Get tenant ID from request
    tenant_id = CommonManager.get_tenant_id(request)
    
    # Query database
    items = db.query(Item).filter_by(tenant_id=tenant_id).all()
    
    return {"items": items}

๐ŸŽฏ New Automation Modules (v1.0.7)

SMS Handler

Send SMS messages via Twilio with delivery tracking:

from jlframework import SMSHandler

sms = SMSHandler()

# Send single SMS
sms.send_sms(
    to_number="+1234567890",
    message="Your verification code is 123456"
)

# Send bulk SMS
sms.send_bulk_sms(
    to_numbers=["+1234567890", "+0987654321"],
    message="Bulk notification"
)

# Check delivery status
status = sms.get_message_status(message_sid)

SharePoint Manager

Microsoft Graph API integration for emails and file operations:

from jlframework import SharePointManager, ContentType

sp = SharePointManager()

# Send email with attachments
await sp.send_email(
    subject="Monthly Report",
    body="<h1>Report</h1><p>Please find attached...</p>",
    recipient="user@example.com",
    attachments=["report.pdf"],
    content_type=ContentType.Html
)

# Upload file to SharePoint/OneDrive
await sp.upload_file_to_drive(
    folder_path="/Shared Documents/Reports",
    file_name="report.pdf",
    file_path="./report.pdf"
)

# Search SharePoint
results = await sp.search_items_in_drive("quarterly report")

SQL Manager

Singleton SQL manager with connection pooling and retry logic:

from jlframework import SqlManager
import pandas as pd

sql = SqlManager()

# Async query (returns DataFrame)
df = await sql.get_async(
    query="SELECT * FROM customers WHERE region = ?",
    header="customers",
    params=("North",)
)

# Sync query
df = sql.get_sync(
    query="SELECT * FROM orders",
    header="orders"
)

# Execute non-query
await sql.execute_async(
    query="UPDATE customers SET status = ? WHERE id = ?",
    params=("active", 123)
)

# Health check
is_healthy = await sql.check_health()

Notification Decorators

Automatic Slack and Teams notifications:

from jlframework import slack_notification, teams_notification, ExecutionResult, ReportStatus

class MyAutomation:
    @slack_notification()
    async def process_data(self):
        # Your automation logic
        records = await self.fetch_data()
        await self.process_records(records)
        
        # Return execution result
        return ExecutionResult(
            status=ReportStatus.SUCCEEDED,
            records_processed=len(records),
            records_failed=0,
            execution_time=120.5
        )
    
    @teams_notification()
    async def generate_report(self):
        # Automatically sends Teams notification on success/failure
        report = await self.create_report()
        return ExecutionResult(
            status=ReportStatus.SUCCEEDED,
            message="Report generated successfully"
        )

Azure Integration

Azure App Configuration and Blob Storage:

from jlframework import AzureAppConfig, BlobStorageManager

# Load configuration from Azure App Configuration
config = AzureAppConfig()
db_connection = config.get_config_value("DatabaseConnectionString")
api_key = config.get_config_value("ApiKey")

# Use Blob Storage
blob = BlobStorageManager()

# Upload file
await blob.upload_file(
    container_name="reports",
    blob_name="monthly-report.pdf",
    data=file_content
)

# Download file
content = await blob.download_file(
    container_name="reports",
    blob_name="monthly-report.pdf"
)

# List blobs
blobs = await blob.list_blobs(container_name="reports")

๐Ÿ“š Available Templates

Backend

FastAPI backend with:

  • Domain-driven design structure
  • SQLAlchemy ORM with multiple database support
  • Tenant-based access control middleware
  • Audit logging with MongoDB
  • Azure integration (optional)
  • Docker support
  • Environment-based configuration

Frontend - Embedded

Vue.js 3 embedded application with:

  • Vite build system
  • TypeScript support
  • Vue Router
  • OIDC authentication (optional)
  • API service layer
  • Tailwind CSS
  • Docker + Nginx deployment

Frontend - Features

Vue.js 3 micro-frontend features:

  • Modular component architecture
  • Custom event system
  • Shared state management
  • Independent deployment

Frontend - Marketplace

Vue.js 3 marketplace application:

  • Full marketplace UI
  • Product catalog
  • User management
  • OIDC authentication

๐ŸŽฏ CLI Commands

jlframework init

Initialize a new project with configuration files.

jlframework init my-project
jlframework init my-project --no-git  # Skip git initialization

jlframework add

Add a template to your project.

jlframework add backend
jlframework add frontend-embedded
jlframework add frontend-features
jlframework add frontend-marketplace
jlframework add backend --skip-install  # Skip dependency installation

jlframework list

List all available templates.

jlframework list

๐Ÿ“– Complete Import Reference

Automation Modules

from jlframework import (
    # SMS Integration
    SMSHandler,
    
    # SharePoint & Email
    SharePointManager,
    ContentType,
    GraphMethod,
    
    # SQL Management
    SqlManager,
    
    # Notifications
    slack_notification,
    teams_notification,
    
    # Azure Integration
    AzureAppConfig,
    BlobStorageManager,
    
    # Utilities
    ExecutionResult,
    ReportStatus,
    ReportRequestError,
    ReportStatusError,
    get_iana_timezone,
)

FastAPI Utilities

from jlframework import (
    # Database
    get_db,
    get_db_session,
    database_middleware,
    initialize_database,
    
    # Handlers
    CommonManager,
    AuditManager,
    AuditData,
    
    # Enums
    AuditStatus,
    AuditAction,
    EntityType,
    
    # Middleware
    restrict_access_middleware,
    get_tenant_id,
    
    # Configuration
    Settings,
    get_settings,
    
    # API Client
    MainSubSysApiManager,
    RequestType,
    ApiError,
    retry_with_backoff,
)

๐Ÿ”ง Configuration

Environment Variables

Create a .env file or use Azure App Configuration:

# Azure App Configuration (Recommended)
APP_CONFIGURATION_CONNECTION_STRING=Endpoint=https://...
APPLICATION_ENVIRONMENT=Dev  # or Uat, Prod

# Or use individual environment variables
# Twilio SMS
TWILIO_ACCOUNT_SID=your_account_sid
TWILIO_AUTH_TOKEN=your_auth_token
TWILIO_MESSAGING_SERVICE_SID=your_service_sid

# Microsoft Graph (SharePoint/Email)
MICROSOFT_TENANT_ID=your_tenant_id
MICROSOFT_CLIENT_ID=your_client_id
MICROSOFT_CLIENT_SECRET=your_client_secret

# SQL Database
SQL_CONNECTION_STRING=mssql+pyodbc://...

# Slack Notifications
SLACK_SUCCESS_WEBHOOK=https://hooks.slack.com/...
SLACK_FAILURE_WEBHOOK=https://hooks.slack.com/...

# Teams Notifications
TEAMS_WEBHOOK=https://outlook.office.com/webhook/...

# Azure Storage
AZURE_STORAGE_CONNECTION_STRING=DefaultEndpointsProtocol=https;...

Centralized Configuration Manager (v1.0.13+)

New in v1.0.13: Unified configuration management with ConfigurationManager:

from jlframework.core.config_manager import ConfigurationManager

# Get singleton instance (loads from Azure App Configuration once)
config = ConfigurationManager.get_instance()

# Recommended: Use typed getters with Keys enum
api_url = config.get(config.Keys.MAIN_API_URL)
timeout = config.get_int(config.Keys.TIMEOUT, default=30)
debug = config.get_bool(config.Keys.DEBUG, default=False)

# Backward compatible: Attribute access still works
redis_url = config.Redis
storage = config.StorageConnectionString

Benefits:

  • โœ… Single source of truth for all configuration
  • โœ… Thread-safe singleton pattern
  • โœ… Azure connection string loaded only once
  • โœ… Type-safe with ConfigurationKeys enum
  • โœ… Backward compatible with old code

See CONFIGURATION_MIGRATION_GUIDE.md for migration details.

Azure App Configuration (Legacy)

Deprecated in v1.0.13, use ConfigurationManager instead:

from jlframework import AzureAppConfig

# Old way (still works but deprecated)
config = AzureAppConfig()
twilio_sid = config.get_config_value("TwilioAccountSid")
db_connection = config.get_config_value("DatabaseConnectionString")

๐Ÿ—๏ธ Project Structure

After running jlframework init and adding templates:

my-project/
โ”œโ”€โ”€ .jlframework.json      # Project configuration
โ”œโ”€โ”€ README.md              # Project documentation
โ”œโ”€โ”€ .gitignore            # Git ignore patterns
โ”œโ”€โ”€ .env                  # Environment variables
โ”œโ”€โ”€ backend/              # FastAPI backend
โ”‚   โ”œโ”€โ”€ main.py
โ”‚   โ”œโ”€โ”€ routes.py
โ”‚   โ”œโ”€โ”€ requirements.txt
โ”‚   โ”œโ”€โ”€ Dockerfile
โ”‚   โ”œโ”€โ”€ configs/
โ”‚   โ”œโ”€โ”€ domains/
โ”‚   โ””โ”€โ”€ shared/
โ””โ”€โ”€ frontend/
    โ”œโ”€โ”€ embedded/         # Embedded Vue.js app
    โ”œโ”€โ”€ features/         # Micro-frontend features
    โ””โ”€โ”€ marketplace/      # Marketplace Vue.js app

๐Ÿณ Docker Support

All templates include Dockerfiles for containerization:

# Backend
cd backend
docker build -t my-backend .
docker run -p 8000:8000 my-backend

# Frontend
cd frontend/embedded
docker build -t my-frontend .
docker run -p 80:80 my-frontend

๐Ÿงช Development

Running Backend

cd backend
pip install -r requirements.txt
python main.py

Running Frontend

cd frontend/embedded
npm install
npm run dev

๐Ÿ“ Complete Examples

Azure Function App with Automation

import azure.functions as func
from jlframework import (
    AzureAppConfig,
    SqlManager,
    SharePointManager,
    slack_notification,
    ExecutionResult,
    ReportStatus
)

# Load configuration from Azure App Configuration
config = AzureAppConfig()

class DataProcessor:
    def __init__(self):
        self.sql = SqlManager()
        self.sp = SharePointManager()
    
    @slack_notification()
    async def process_daily_report(self):
        # Fetch data from database
        df = await self.sql.get_async(
            "SELECT * FROM orders WHERE date = CAST(GETDATE() AS DATE)",
            "daily_orders"
        )
        
        # Process data
        total_orders = len(df)
        total_revenue = df['amount'].sum()
        
        # Send email report
        await self.sp.send_email(
            subject=f"Daily Report - {total_orders} orders",
            body=f"<h1>Daily Report</h1><p>Total Revenue: ${total_revenue}</p>",
            recipient="manager@company.com"
        )
        
        return ExecutionResult(
            status=ReportStatus.SUCCEEDED,
            records_processed=total_orders,
            message=f"Processed {total_orders} orders"
        )

# Azure Function
async def main(timer: func.TimerRequest) -> None:
    processor = DataProcessor()
    await processor.process_daily_report()

Core Python Application

import asyncio
from jlframework import (
    AzureAppConfig,
    SMSHandler,
    SqlManager,
    ExecutionResult,
    ReportStatus
)

async def send_customer_notifications():
    # Load config
    config = AzureAppConfig()
    
    # Initialize services
    sms = SMSHandler()
    sql = SqlManager()
    
    # Get customers to notify
    customers = await sql.get_async(
        "SELECT phone, name FROM customers WHERE notify = 1",
        "customers"
    )
    
    # Send SMS to each customer
    for _, customer in customers.iterrows():
        sms.send_sms(
            to_number=customer['phone'],
            message=f"Hello {customer['name']}, your order is ready!"
        )
    
    print(f"Sent {len(customers)} notifications")

if __name__ == "__main__":
    asyncio.run(send_customer_notifications())

FastAPI with Full Features

from fastapi import FastAPI, Request, Depends
from sqlalchemy.orm import Session
from jlframework import (
    get_db,
    CommonManager,
    AuditManager,
    AuditData,
    AuditStatus,
    AuditAction,
    EntityType,
    restrict_access_middleware,
    database_middleware,
)

app = FastAPI(title="My API")

# Add middlewares
app.middleware("http")(database_middleware)
app.middleware("http")(restrict_access_middleware)

# Initialize audit manager
audit = AuditManager(
    app_id=1,
    tenant_id="default",
    mongo_connection_string=config.mongo_connection
)

@app.post("/api/v1/customers")
async def create_customer(
    request: Request,
    customer_data: dict,
    db: Session = Depends(get_db)
):
    tenant_id = CommonManager.get_tenant_id(request)
    client_info = CommonManager.get_client_info(request)
    
    # Create customer
    customer = Customer(**customer_data, tenant_id=tenant_id)
    db.add(customer)
    db.commit()
    
    # Log audit
    await audit.save_audit(AuditData(
        status=AuditStatus.SUCCESS,
        action=AuditAction.CREATE,
        entity_type=EntityType.Customer,
        entity_id=customer.id,
        user_id=client_info['user_id'],
        ip_address=client_info['ip_address']
    ))
    
    return {"customer": customer}

if __name__ == "__main__":
    import uvicorn
    uvicorn.run(app, host="0.0.0.0", port=8000)

๐ŸŽฏ Use Cases

Perfect For:

  • โœ… Azure Function Apps (HTTP, Timer, Queue, Blob triggers)
  • โœ… Core Python automation scripts
  • โœ… FastAPI web applications
  • โœ… Standalone data processing applications
  • โœ… Microservices with Azure integration
  • โœ… Full-stack web applications
  • โœ… Enterprise automation workflows

๐Ÿค Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

๐Ÿ“ž Support

๐Ÿ—บ๏ธ Roadmap

  • SMS integration (Twilio) โœ… v1.0.7
  • SharePoint/Email integration (Microsoft Graph) โœ… v1.0.7
  • SQL connection pooling and management โœ… v1.0.7
  • Slack and Teams notification decorators โœ… v1.0.7
  • Azure App Configuration integration โœ… v1.0.7
  • Additional database support (MongoDB, PostgreSQL)
  • More frontend templates (React, Angular)
  • Code generators for models, routes, services
  • Database migration tools
  • Testing utilities
  • Deployment helpers (Kubernetes, Docker Compose)
  • VS Code extension
  • Web-based project configurator

๐ŸŽ‰ What's New

v1.0.15 - Quality Improvements (Current)

  • ๐Ÿ”ง Code Quality - Improved code organization and formatting
  • ๐Ÿ“ Documentation - Enhanced docstrings and inline documentation
  • โœ… Testing - Expanded test coverage and regression tests
  • ๐Ÿ› Bug Fixes - Minor bug fixes and improvements
  • ๐Ÿ“Š Metrics - Improved code maintainability and reduced complexity

v1.0.14 - Configuration Consolidation โš ๏ธ BREAKING CHANGES

  • ๐Ÿ”„ Unified Configuration - All configuration now uses ConfigurationManager
  • โŒ Removed Deprecated Classes - appconfig_handler.py and azure_config.py removed
  • โœ… Backward Compatible - Attribute access still works for smooth migration
  • ๐Ÿ“š Migration Guide - See CONFIGURATION_MIGRATION_GUIDE.md

Migration Required: If you were using AzureAppConfig or Configurations, update to ConfigurationManager:

# Old way (v1.0.13 and earlier) - NO LONGER WORKS
from jlframework import AzureAppConfig
config = AzureAppConfig()
value = config.get_config_value("SomeKey")

# New way (v1.0.14+) - REQUIRED
from jlframework.core.config_manager import ConfigurationManager
config = ConfigurationManager.get_instance()
value = config.get("SomeKey")
# Or use attribute access (backward compatible)
value = config.SomeKey

v1.0.13 - Centralized Configuration

  • โœจ ConfigurationManager - Unified configuration management
  • ๐Ÿ”’ Thread-Safe Singleton - Single source of truth for all configuration
  • ๐ŸŽฏ Type-Safe Access - ConfigurationKeys enum for type safety
  • โšก Performance - Azure connection string loaded only once

v1.0.7 - Automation Modules

  • โœจ SMS Handler - Send SMS via Twilio with delivery tracking
  • โœจ SharePoint Manager - Microsoft Graph API for emails and file operations
  • โœจ SQL Manager - Connection pooling, async/sync queries, retry logic
  • โœจ Notification Decorators - Automatic Slack and Teams notifications
  • โœจ Enhanced Azure Integration - Better App Configuration and Blob Storage support
  • โœจ ExecutionResult - Standardized automation result tracking
  • โœจ No Hardcoded Credentials - All config from Azure or environment variables

Made with โค๏ธ by the JLFramework Team

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

jlframework-1.0.15.tar.gz (242.1 kB view details)

Uploaded Source

Built Distribution

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

jlframework-1.0.15-py3-none-any.whl (275.6 kB view details)

Uploaded Python 3

File details

Details for the file jlframework-1.0.15.tar.gz.

File metadata

  • Download URL: jlframework-1.0.15.tar.gz
  • Upload date:
  • Size: 242.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for jlframework-1.0.15.tar.gz
Algorithm Hash digest
SHA256 6848962ddda52808b0400aedeba9ff67a8269778a109725c68b1b500ccb8bdd1
MD5 8491ac4c82ce392f76c8adfef3321fc8
BLAKE2b-256 9ca269b7423e31d583334ba5b2e29e6f66126cd8668e26cd3c103dec3532cfe1

See more details on using hashes here.

File details

Details for the file jlframework-1.0.15-py3-none-any.whl.

File metadata

  • Download URL: jlframework-1.0.15-py3-none-any.whl
  • Upload date:
  • Size: 275.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for jlframework-1.0.15-py3-none-any.whl
Algorithm Hash digest
SHA256 201ec6725c285e58a6aebc461b64ecf78d983ee7c535f1a4fd0da091dce6cce4
MD5 801c7dcc4d28a436b31f487bdd41a8e4
BLAKE2b-256 c1d9362a092639bd3300d04193c04b065d55863b95275a55c70cb5eb6b92998c

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