Metadata-Version: 2.4
Name: pyarchrules
Version: 0.1.0b0
Summary: Architecture validation library for Python projects
Author: Sergei Mikheev
License: MIT License
        
        Copyright (c) 2026 Sergei Mikheev
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/mspitb/pyarchrules
Project-URL: Documentation, https://mspitb.github.io/pyarchrules/
Project-URL: Repository, https://github.com/mspitb/pyarchrules
Project-URL: Issues, https://github.com/mspitb/pyarchrules/issues
Project-URL: Changelog, https://github.com/mspitb/pyarchrules/blob/main/CHANGELOG.md
Keywords: architecture,validation,testing,monorepo,microservices
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Testing
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: tomlkit==0.14.0
Requires-Dist: typer==0.23.0
Requires-Dist: pydantic==2.12.5
Requires-Dist: loguru==0.7.0
Dynamic: license-file

<p align="center">
  <img src="https://gist.githubusercontent.com/mspitb/862bc8c4b0e176e98f06e624761519da/raw/f4237236769bd2739132790f6c6f1157e3be5131/pyarchrules_logo.svg" alt="PyArchRules Logo" width="600">
</p>

<p align="center">
  <a href="LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License: MIT"></a>
  <a href="https://www.python.org/"><img src="https://img.shields.io/badge/python-3.10+-blue.svg" alt="Python 3.10+"></a>
  <a href="https://www.python.org/"><img src="https://img.shields.io/badge/status-beta%200.1.0b0-orange.svg" alt="Status Beta"></a>
  <a href="https://mspitb.github.io/pyarchrules/"><img src="https://img.shields.io/badge/docs-mkdocs-blue.svg" alt="Documentation"></a>
</p>

> ⚠️ **This is a pre-release (beta) version.** APIs may change before the stable `0.1.0` release.

## Documentation

📚 **[Full Documentation](https://mspitb.github.io/pyarchrules/)** - Getting Started, Configuration, CLI Reference, Use Cases

## Features

- 🏗️ **Structure validation** - enforce directory tree requirements
- 🔗 **Dependency rules** - control module imports (e.g., `api -> domain`)
- 🎯 **DSL & Config** - use Python DSL or TOML configuration
- 🚀 **Zero setup** - works with `pyproject.toml`
- 🔍 **CLI & API** - integrate into CI/CD or use programmatically

## Installation

```bash
pip install pyarchrules
```

## Quick Start

```bash
# Initialize
pyarchrules init-project

# Check architecture
pyarchrules check
```

## Configuration Example

```toml
[tool.pyarchrules]
project_name = "myapp"

[tool.pyarchrules.services.backend]
path = "src/backend"

# Enforce directory structure
tree = ["api", "domain", "infra"]
tree_strict = true

# Control dependencies (api can import from domain)
dependencies = ["api -> domain", "domain -> infra"]
```

## Python API

```python
from pyarchrules import PyArchRules

rules = PyArchRules()

# DSL validation
rules.for_service("backend") \
    .must_contain_folders(["api", "domain"])

result = rules.validate()
```

## CLI Commands

| Command | Description |
|---------|-------------|
| `pyarchrules init-project` | Initialize configuration |
| `pyarchrules check` | Validate architecture |
| `pyarchrules add-service NAME PATH` | Add service |
| `pyarchrules list-services` | List all services |

## Use Cases

**Monorepos** - enforce boundaries between services
```toml
[tool.pyarchrules.services.auth]
path = "services/auth"
dependencies = ["auth -> shared"]
```

**Clean Architecture** - validate layer dependencies
```toml
dependencies = [
    "api -> application",
    "application -> domain"
]
```

**Microservices** - ensure consistent structure
```toml
tree = ["api", "domain", "infrastructure"]
tree_strict = true
```

## Development

```bash
uv sync
make test
make lint
```

## Status

> ⚠️ **Pre-release (Beta)** — `0.1.0b0` is a beta release. Core features are functional but the public API may still change before the stable `1.0` release. Not recommended for production use yet.

## License

MIT

