Skip to main content

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

Metadata

Release files for config-inspector 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for config-inspector 0.2.0
File Size Uploaded
config_inspector-0.2.0.tar.gz 86.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for config-inspector 0.2.0
File Interpreter ABI Platform
config_inspector-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 106.7 kB

Release files / config_inspector-0.2.0.tar.gz

Download URL config_inspector-0.2.0.tar.gz
Size 86.9 kB
Tags Source
SHA-256 checksum
How to use checksums
0fcda39fad234e6d73ee7ac00edb00f0fae6574108fd9463548cda4dde314919
BLAKE2b-256 checksum
How to use checksums
8012b6728ec9d0881a055c24eb8994b5031d8b87d9367779b40cc55033f04b5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release files / config_inspector-0.2.0-py3-none-any.whl

Download URL config_inspector-0.2.0-py3-none-any.whl
Size 19.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58085dea7a4eaea4a9e2ab525baf6496e1999c6e2e2853737da410c8106576e4
BLAKE2b-256 checksum
How to use checksums
c06ce12fa3a4b0b897a9070ffa9217812081eefcee953c79a9158bc33cd84676
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page