Skip to main content

Python package designed to help you manage and interact with text-based files in a robust and extensible way.

Project description

Config Inspector

Coverage

Overview

Config Inspector is a Python package for working with text-based config and script files.

It supports:

  • file registration + metadata collection
  • file content payload generation with size limits
  • update strategies for INI, TOML, JSON, and plain text files

Primary public APIs:

  • FileRegistry
  • FileMetadataService
  • FileContentService
  • updater_factory (plus updater classes)

Installation

uv pip install config-inspector

Quick Start

from pathlib import Path
import json

from config_inspector import FileContentService
from config_inspector import FileMetadataService
from config_inspector import FileRegistry
from config_inspector import updater_factory


class SizeFormatter:
    def format(self, size_bytes: int) -> str:
        return f"{size_bytes} bytes"


class DateTimeFormatter:
    def format(self, dt) -> str:
        return dt.strftime("%Y-%m-%d %H:%M:%S")


metadata_service = FileMetadataService(
    size_formatter=SizeFormatter(),
    datetime_formatter=DateTimeFormatter(),
)

registry = FileRegistry(metadata_service)
registry.register(Path("settings.json"), label="app-config")

for meta in registry.get_all_metadata():
    print(meta)

content_service = FileContentService(metadata_service, max_size_bytes=50_000)
payload = content_service.get_payload(Path("settings.json"), key="config")

content = json.loads(payload["config"]["content"])
content["feature_flag"] = True
updater_factory(".json").update(Path("settings.json"), content)

Development

List available commands:

just --list

Environment setup:

just env
just pip-install-editable

Testing and Quality Gates

Common local checks:

just check
just ci

Targeted commands:

just pytest
just coverage
just open-coverage
just ruff-check
just api-check

Versioning and Release

Version helpers:

just version-show
just version-bump-patch
just version-bump-minor
just version-bump-major
just version-verify

Tag helpers:

just version-tag-dryrun
just version-tag
just version-tag-push

Build and publish helpers:

just dist
just wheel-smoke
just twine-check
just twine-upload-test
just twine-upload

CI

Bitbucket Pipelines is the CI source of truth for this repository.

Main CI command path is:

just ci

Issues

If you experience issues, open one on Bitbucket:


History

All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

0.2.0 (2026-05-28)

  • ADDED: Log file clearing support via in-place truncation through the new LogFileUpdater API.
  • ADDED: Public API export for LogFileUpdater at package and updaters module levels.
  • ADDED: Tests covering log clearing for existing log files and missing log-file creation behavior.

0.1.6 (2026-04-20)

  • CHANGED: Updated build/tooling stack in pyproject.toml (Hatch/hatchling-based build flow and aligned dev/test toolchain).
  • CHANGED: Versioning/release workflow now uses pyproject.toml as version source of truth.
  • FIXED: Cross-platform (Windows) regex handling in file-size policy tests by escaping dynamic path content.

0.1.5 (2026-03-13)

  • CHANGED: Refactored package internals into DDD-aligned subdomains (updaters, file_content, registry) while preserving top-level public imports and signatures.
  • CHANGED: Standardized application ports on Protocol for cleaner dependency boundaries.
  • CHANGED: Removed legacy flat modules (domain.py, updaters.py, services.py, models.py, registry.py, protocols.py) after test migration.
  • CHANGED: Modernized developer workflow around Justfile commands (check, ci, doctor, outdated) and release helpers.
  • ADDED: Domain-focused tests under tests/domains/* and stronger architecture/public API contract checks.
  • ADDED: Version management and safe git tag recipes in Justfile (version-bump-*, version-tag, version-tag-push).
  • ADDED: Bitbucket Pipeline CI configuration as the canonical CI path for this repository.
  • CHANGED: Release quality gates now include artifact verification, wheel smoke install, and twine check.
  • CHANGED: README updated to match current public API usage and just-based workflows.
  • CHANGED: Hardened .gitignore coverage for Python packaging, test artifacts, and tooling caches.
  • CHANGED: Removed unused direct runtime dependency on requests.

0.1.4 (2025-12-04)

  • ADDED: tox and 100% test coverage
  • ADDED: updater_factory to get the correspinding file updater by looking at the file extension.

0.1.3 (2025-12-01)

  • ADDED: When writing a file with FileContentService.write_text() we set utf-8 errors to replace.

0.1.2 (2025-11-11)

  • ADDED: When reading a file with FileContentService.get_payload we set utf-8 errors to replace.

0.1.1 (2025-11-05)

  • ADDED: Added .js and .ps1 extensions that simply use PlainTextUpdater and do not try to validate/format on save.

0.1.0 (2025-10-06)

  • First release

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

config_inspector-0.2.0.tar.gz (86.9 kB view details)

Uploaded Source

Built Distribution

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

config_inspector-0.2.0-py3-none-any.whl (19.9 kB view details)

Uploaded Python 3

File details

Details for the file config_inspector-0.2.0.tar.gz.

File metadata

  • Download URL: config_inspector-0.2.0.tar.gz
  • Upload date:
  • Size: 86.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for config_inspector-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0fcda39fad234e6d73ee7ac00edb00f0fae6574108fd9463548cda4dde314919
MD5 367481aa3ef90ca7c278a25a695189da
BLAKE2b-256 8012b6728ec9d0881a055c24eb8994b5031d8b87d9367779b40cc55033f04b5a

See more details on using hashes here.

File details

Details for the file config_inspector-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for config_inspector-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 58085dea7a4eaea4a9e2ab525baf6496e1999c6e2e2853737da410c8106576e4
MD5 9a5c31900e4f9d69ebd55188fa591453
BLAKE2b-256 c06ce12fa3a4b0b897a9070ffa9217812081eefcee953c79a9158bc33cd84676

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