Skip to main content

Python Applications Lightweight Initiator

Project description

Downloads License Python

Pali

Pali (Python Applications Lightweight Initiator) is a lightweight foundation library for Python Applications. Built entirely in native Python with zero dependencies.

Python applications repeatedly solve the same infrastructure problems—configuration, logging, concurrency, persistence, data pipelines, and service lifecycle management. Pali provides a lightweight, dependency-free collection of reusable building blocks for these common application patterns, allowing developers to focus on application logic instead of reinventing infrastructure. Adopt only the components you need, with no hidden framework overhead.

Start with Quick Start to see how fast it is to build with Pali.

Why Pali?

  • Lightweight — Minimal footprint, no external dependencies.
  • Native Python — Pure Python implementation, works well in constrained and dependency-sensitive environments (e.g. ESX).
  • 12-factor friendly — Designed for config, concurrency, logging, and disposability.
  • Production-tested — Real-world utilities refined over years.
  • Modular — Import only what you use.

When should I consider Pali ?

Pali is a good fit when you are building:

  • Infrastructure automation
  • DevOps tooling
  • Background workers
  • Long-running daemons
  • Backend services
  • Microservices
  • Batch processing applications
  • Data pipelines
  • Integration services
  • CLI utilities

Micro-Examples

Structured logging — Standardized application logging:

from pali import setup_logging, getLogger

# Setup logging once when application starts. 
setup_logging(log_dir="./", log_file="my_app.log")

# Now every module can get logger and add logs.
log = getLogger(__name__)
log.info('Application started')

Configuration management — Load and validate settings:

# Define a .ini format based Config file for application.
# config/pali.cfg
[DEFAULT]
debug = true

[DATABASE]
host = localhost
port = 5432
from pali import ConfigManager

# Initialize ConfigManager with app config file.
cfg = ConfigManager('config/pali.cfg')

# Read a value from the DATABASE section
db_host = cfg.get('DATABASE', 'host')

# Read a default value from the DEFAULT section
debug = cfg.get('DEFAULT', 'debug')

Data pipelines — Sequential processing stages:

from pali import Pipeline, Stage

class HeatWaterStage(Stage):
    def __init__(self):
        super(HeatWaterStage, self).__init__('Heat Water')

    def run(self, data):
        data['temperature'] = 100
        data['state'] = 'water heated'

class AddTeaStage(Stage):
    def __init__(self):
        super(AddTeaStage, self).__init__('Add Tea')

    def run(self, data):
        data['tea'] = 'green'
        data['state'] = 'tea added'

class SteepTeaStage(Stage):
    def __init__(self):
        super(SteepTeaStage, self).__init__('Steep Tea')

    def run(self, data):
        data['steeped'] = True
        data['state'] = 'tea steeped'

class ServeTeaStage(Stage):
    def __init__(self):
        super(ServeTeaStage, self).__init__('Serve Tea')

    def run(self, data):
        data['served'] = True
        data['result'] = 'cup of tea ready'

pipeline = Pipeline(
    name='TeaPipeline',
    stages=[HeatWaterStage(), AddTeaStage(), SteepTeaStage(), ServeTeaStage()],
    data={'cup': 'empty'}
)
pipeline._run()
print(pipeline.data)

Parallel task execution — Process items concurrently:

from pali import Task, ThreadPool

class ProcessItem(Task):
    def _run(self):
        self.result = expensive_operation(self.data)

items = [1, 2, 3]
tasks = [ProcessItem(item) for item in items]
with ThreadPool(4) as pool:
    for t in tasks:
        pool.append_task(t)
results = [t.result for t in tasks]

Quick Links

Requirements

  • Python 2.7+ or Python 3.4+
  • No external dependencies

Contributing

See the Contributing Guide for details.

Support

License

Pali is licensed under the MIT License. See LICENSE for details.

Changelog

See CHANGELOG.md for version history and release notes.

Acknowledgments

Pali was built with simplicity and ease of use in mind. It draws inspiration from various threading and task queue libraries while maintaining a minimal footprint and zero external dependencies.


Ready to get started? Check out the Quick Start Guide!

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

pali-1.1.0.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

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

pali-1.1.0-py3-none-any.whl (45.5 kB view details)

Uploaded Python 3

File details

Details for the file pali-1.1.0.tar.gz.

File metadata

  • Download URL: pali-1.1.0.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for pali-1.1.0.tar.gz
Algorithm Hash digest
SHA256 a790c6f64ce14945ee4fb3ed365543d035f15b0924037aa8b0baf0eb674a0a7f
MD5 d4242d5d2e8e8ff192c6d632c5c8fda0
BLAKE2b-256 d10aabc2121b7e611fedfca324c1a655afa286ed7d03d5979902ae4e416a1c7d

See more details on using hashes here.

File details

Details for the file pali-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: pali-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 45.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for pali-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c6ebf6bdc18fe982283ccfe845ca3e6bcbb305ff6ca3a10f74cf9305399bf095
MD5 fd9c70e10c21bb17a2fade82e1b53463
BLAKE2b-256 5189a5c1c1e376ec462bfd3eba17648498f6615c65150e5e8b0b3c1a73e0fa98

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