Metadata-Version: 2.4
Name: dan-annotation
Version: 1.0.0
Summary: DAN (Data Advanced Notation) Parser and Encoder for Python
Author: DAN Python Library
License-Expression: MIT
Project-URL: Documentation, https://github.com/marcuwynu23/danpy#readme
Project-URL: Issue Tracker, https://github.com/marcuwynu23/danpy/issues
Project-URL: Source Code, https://github.com/marcuwynu23/danpy
Keywords: dan,parser,encoder,data-format,configuration,config
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
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: Topic :: Text Processing :: Markup
Classifier: Topic :: Utilities
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# DAN (Data Advanced Notation) Python Library

[![Python Version](https://img.shields.io/badge/python-3.7+-blue.svg)](https://www.python.org/downloads/)
[![License](https://img.shields.io/badge/license-MIT-green.svg)](LICENSE)

A Python implementation of the DAN (Data Advanced Notation) parser and encoder. DAN is a human-readable data format that combines the simplicity of key-value pairs with the power of nested structures and tables.

## Features

- **Decode**: Parse DAN text into Python dictionaries
- **Encode**: Convert Python dictionaries into DAN text
- Support for nested blocks, tables, arrays, and various data types
- Comment support (# and //)
- Type inference (strings, numbers, booleans, arrays)
- Comprehensive test suite with 40+ test cases
- Multiple real-world examples

See [FEATURES.md](FEATURES.md) for a complete feature list.

## Installation

This repo uses **[uv](https://docs.astral.sh/uv/)** for environments and lockfiles (`uv.lock`).

```bash
# Install uv: https://docs.astral.sh/uv/getting-started/installation/
uv sync
```

Editable install from a clone:

```bash
git clone https://github.com/marcuwynu23/dan-py.git
cd dan-py
uv sync
```

With dev tools (e.g. pytest):

```bash
uv sync --group dev
uv run pytest tests/
```

You can still install from PyPI with pip when a release is published:

```bash
pip install dan-annotation
```

## Quick Start

### Decoding DAN

```python
from dan import decode

text = """
app {
  name: "MyApp"
  version: 1.0
  server {
    host: localhost
    port: 3000
  }
}
"""

data = decode(text)
print(data)
# {'app': {'name': 'MyApp', 'version': 1.0, 'server': {'host': 'localhost', 'port': 3000}}}
```

### Encoding to DAN

```python
from dan import encode

data = {
    "app": {
        "name": "MyApp",
        "version": 1.0,
        "server": {
            "host": "localhost",
            "port": 3000
        }
    }
}

text = encode(data)
print(text)
```

### Working with Tables

```python
text = """
users: table(id, username, email) [
  1, alice, "alice@example.com"
  2, bob, "bob@example.com"
]
"""

data = decode(text)
# {'users': [{'id': 1, 'username': 'alice', 'email': 'alice@example.com'}, ...]}
```

### Reading from Files

```python
from dan import decode

with open('config.dan', 'r') as f:
    config = decode(f.read())
```

## Examples

Check out the [examples/](examples/) directory for real-world usage scenarios:

- Application configuration (`config.dan`)
- Database schemas (`database_schema.dan`)
- API routes (`api_routes.dan`)
- Microservices configuration (`microservices.dan`)
- Docker Compose (`docker_compose.dan`)
- Kubernetes resources (`kubernetes.dan`)
- And many more!

## Running Tests

```bash
# Run all tests
python -m unittest discover tests -v

# Run specific test file
python -m unittest tests.test_dan -v

# Using pytest (if installed)
pytest tests/
```

## Documentation

- [FEATURES.md](FEATURES.md) - Complete feature documentation
- [CONTRIBUTING.md](CONTRIBUTING.md) - Guidelines for contributing
- [CHANGELOG.md](CHANGELOG.md) - Version history and changes
- [SECURITY.md](SECURITY.md) - Responsible vulnerability disclosure
- [examples/README.md](examples/README.md) - Example files documentation

## Contributing

Contributions are welcome! Please read [CONTRIBUTING.md](CONTRIBUTING.md) and [CODE_OF_CONDUCT.md](CODE_OF_CONDUCT.md). Optional support: [PayPal](https://paypal.me/wynumarcu23) or the repository **Sponsor** button (`.github/FUNDING.yml`).

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## Security

Please report security vulnerabilities to the maintainers. See [SECURITY.md](SECURITY.md) for more information.

## Support

- 📖 [Documentation](https://github.com/marcuwynu23/dan-py#readme)
- 🐛 [Issue Tracker](https://github.com/marcuwynu23/dan-py/issues)
- 💬 [Discussions](https://github.com/marcuwynu23/dan-py/discussions)

