Skip to main content

A lightweight Python utility for file-based logging and persistent state tracking.

Project description

infra

A lightweight Python utility for file-based logging and persistent state tracking.

Overview

  • infra is a minimal Python package designed to help small to medium projects:
  • Keep clean and readable logs
  • Persist application state between runs
  • Avoid heavy logging frameworks
  • It is especially useful for scripts, automation tools, and long-running processes.

Features

  • Simple file-based logger
  • Persistent state storage (JSON-based)
  • Zero external dependencies
  • Easy to integrate into existing projects

Installation

pip install infra

Quick Start

File Logging

from infra.file_logger import FileLogger

logger = FileLogger("app.log")

logger.info("Application started")
logger.warning("Low memory warning")
logger.error("Unexpected error occurred")

This will create (or append to) a log file and store timestamped log messages.

State Tracking

from infra.state_tracker import StateTracker

state = StateTracker("state.json")

state["last_run"] = "2026-01-23T14:00"
state["counter"] = 5
state.save()

This allows your application to persist important values between executions.


Project Structure

infra/
├── infra/
│   ├── __init__.py
│   ├── file_logger.py
│   └── state_tracker.py
├── README.md
├── LICENSE
└── pyproject.toml

Design Goals

  • Keep the API small and intuitive
  • Prefer simplicity over feature overload
  • Avoid external dependencies
  • Be suitable for educational and practical use

Limitations

  • Not thread-safe
  • No log rotation support
  • Designed for small to medium workloads

Roadmap / TODO

  • Add unit tests
  • Add log rotation support
  • Improve type hints and documentation

License

This project is licensed under the 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

slinfra-0.1.2.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

slinfra-0.1.2-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file slinfra-0.1.2.tar.gz.

File metadata

  • Download URL: slinfra-0.1.2.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for slinfra-0.1.2.tar.gz
Algorithm Hash digest
SHA256 d772b0137f032e3415bec3d036173fcfc5ddade2de6047ce4132153236a76c9e
MD5 a64f4954d9093e6f95662a9b2b8bc1f8
BLAKE2b-256 dd822edaddf4ad5a3c8783ab10047a86cb86ffa6637df74dcc6fad0d6006ce58

See more details on using hashes here.

File details

Details for the file slinfra-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: slinfra-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 4.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for slinfra-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cb1f256586ea0cfb16f6e52d4321bc46b64628d5d8c7ee09500673a38819afe4
MD5 699d5cd9c017adb82607f77e783b65a2
BLAKE2b-256 a37821d437ecaf948b6dba76944b5b6e067cc478a93d12f2719206e6b64cecd7

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