Metadata-Version: 2.4
Name: config-inspector
Version: 0.1.6
Summary: Python package designed to help you manage and interact with text-based files in a robust and extensible way.
Project-URL: Repository, https://bitbucket.org/xstudios/config-inspector.git
Project-URL: Issues, https://bitbucket.org/xstudios/config-inspector/issues
Project-URL: Changelog, https://bitbucket.org/xstudios/config-inspector/blob/master/HISTORY.md
Author-email: Tim Santor <tsantor@xstudios.com>
License-File: AUTHORS.md
License-File: LICENSE
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Python: >=3.11
Requires-Dist: toml>=0.10.2
Description-Content-Type: text/markdown

# Config Inspector

![Coverage](https://img.shields.io/badge/coverage-99.68%25-brightgreen)

## 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

```bash
uv pip install config-inspector
```

## Quick Start

```python
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:

```bash
just --list
```

Environment setup:

```bash
just env
just pip-install-editable
```

## Testing and Quality Gates

Common local checks:

```bash
just check
just ci
```

Targeted commands:

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

## Versioning and Release

Version helpers:

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

Tag helpers:

```bash
just version-tag-dryrun
just version-tag
just version-tag-push
```

Build and publish helpers:

```bash
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:

```bash
just ci
```

## Issues

If you experience issues, open one on Bitbucket:

- https://bitbucket.org/xstudios/config-inspector/issues


---

# History

All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/).

## 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
