Metadata-Version: 2.4
Name: genro-bag
Version: 0.7.5
Summary: Modernized bag system for the Genropy framework - hierarchical data container with XML serialization
Project-URL: Homepage, https://github.com/genropy/genro-bag
Project-URL: Documentation, https://genro-bag.readthedocs.io
Project-URL: Repository, https://github.com/genropy/genro-bag
Project-URL: Issues, https://github.com/genropy/genro-bag/issues
Author: Genropy Team
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: bag,data-container,genro,genropy,hierarchical-data,xml-serialization
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: genro-toolbox>=0.6.1
Requires-Dist: genro-tytx>=0.1.0
Provides-Extra: all
Requires-Dist: httpx>=0.27.0; extra == 'all'
Requires-Dist: msgpack>=1.0; extra == 'all'
Requires-Dist: mypy>=1.0; extra == 'all'
Requires-Dist: myst-parser>=4.0.0; extra == 'all'
Requires-Dist: orjson>=3.9; extra == 'all'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'all'
Requires-Dist: pytest-cov>=4.0; extra == 'all'
Requires-Dist: pytest>=7.0; extra == 'all'
Requires-Dist: ruff>=0.1.0; extra == 'all'
Requires-Dist: sphinx-autodoc-typehints>=3.0.0; extra == 'all'
Requires-Dist: sphinx-rtd-theme>=3.0.0; extra == 'all'
Requires-Dist: sphinx>=8.0.0; extra == 'all'
Requires-Dist: sphinxcontrib-mermaid>=1.0.0; extra == 'all'
Requires-Dist: xmlschema>=3.0; extra == 'all'
Provides-Extra: dev
Requires-Dist: httpx>=0.27.0; extra == 'dev'
Requires-Dist: msgpack>=1.0; extra == 'dev'
Requires-Dist: mypy>=1.0; extra == 'dev'
Requires-Dist: orjson>=3.9; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: myst-parser>=4.0.0; extra == 'docs'
Requires-Dist: sphinx-autodoc-typehints>=3.0.0; extra == 'docs'
Requires-Dist: sphinx-rtd-theme>=3.0.0; extra == 'docs'
Requires-Dist: sphinx>=8.0.0; extra == 'docs'
Requires-Dist: sphinxcontrib-mermaid>=1.0.0; extra == 'docs'
Provides-Extra: xsd-validate
Requires-Dist: xmlschema>=3.0; extra == 'xsd-validate'
Description-Content-Type: text/markdown

# genro-bag

[![PyPI version](https://img.shields.io/pypi/v/genro-bag?v=0.7.1)](https://pypi.org/project/genro-bag/)
[![Tests](https://github.com/genropy/genro-bag/actions/workflows/tests.yml/badge.svg)](https://github.com/genropy/genro-bag/actions/workflows/tests.yml)
[![codecov](https://codecov.io/gh/genropy/genro-bag/branch/main/graph/badge.svg)](https://codecov.io/gh/genropy/genro-bag)
[![Documentation](https://readthedocs.org/projects/genro-bag/badge/?version=latest)](https://genro-bag.readthedocs.io/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

An **intermediate representation** for structured data in Python.

## What is Bag?

A Bag is an abstraction that bridges the gap between how humans think about structured data and how software implements it.

When you work with configuration files, API responses, form data, or document structures, they all share the same fundamental shape: **named things containing values, organized in a hierarchy, with additional properties attached**.

Yet in code, we scatter this across dictionaries, classes, JSON, XML, database rows—each with its own access patterns and limitations.

A Bag unifies these patterns into a single, consistent model:

- **Nodes** — Named containers that hold a value
- **Hierarchy** — Nodes can contain other nodes, forming a tree
- **Attributes** — Each node carries metadata alongside its value
- **Paths** — Navigate the tree with familiar dot notation

## The Layered Design

Bag provides progressive capability. Start simple, add layers when needed:

| Layer | Purpose |
|-------|---------|
| **Core Bag** | The fundamental container: paths, values, attributes |
| **Resolvers** | Values that compute themselves: lazy loading, API calls |
| **Subscriptions** | React to changes: validation, logging, computed properties |
| **Builders** | Domain-specific languages: HTML, Markdown, XML schemas |

## Install

```bash
pip install genro-bag
```

## Documentation

Full documentation with examples: [genro-bag.readthedocs.io](https://genro-bag.readthedocs.io/)

| Section | Description |
|---------|-------------|
| **[Getting Started](https://genro-bag.readthedocs.io/en/latest/getting-started.html)** | Learn the three core concepts |
| **[Core Bag](https://genro-bag.readthedocs.io/en/latest/bag/)** | Basic usage, paths, attributes, serialization |
| **[Resolvers](https://genro-bag.readthedocs.io/en/latest/resolvers/)** | Lazy loading, API calls, computed values |
| **[Subscriptions](https://genro-bag.readthedocs.io/en/latest/subscriptions/)** | React to changes, validation, logging |
| **[Builders](https://genro-bag.readthedocs.io/en/latest/builders/)** | Domain-specific languages (HTML, Markdown, XSD) |

## Development

```bash
pip install -e ".[dev]"
pytest
```

1500+ tests, 88%+ coverage.

## License

Apache License 2.0 - see [LICENSE](LICENSE) for details.

Copyright 2025 Softwell S.r.l. - Genropy Team
