Metadata-Version: 2.4
Name: opengate-gate-macro-fold
Version: 0.2.0
Summary: Folding and unfolding GATE 9 macros - from mono macro to set of macros and vice versa
Project-URL: Homepage, https://github.com/MateuszBala/opengate-gate-macro-fold
Project-URL: Repository, https://github.com/MateuszBala/opengate-gate-macro-fold
Author: Mateusz Jakub Bała
License-Expression: MIT
License-File: LICENSE
Keywords: gate,macro,monte-carlo,opengate,simulation
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Requires-Python: >=3.11
Description-Content-Type: text/markdown

# opengate-gate-macro-fold

[![CI](https://github.com/MateuszBala/opengate-gate-macro-fold/actions/workflows/ci.yaml/badge.svg)](https://github.com/MateuszBala/opengate-gate-macro-fold/actions/workflows/ci.yaml)
[![Version](https://img.shields.io/badge/version-0.2.0-informational)](https://github.com/MateuszBala/opengate-gate-macro-fold/releases)
[![Standard Python](https://img.shields.io/badge/Python-3.11-blue?logo=python&logoColor=white)]()
[![Standard Python](https://img.shields.io/badge/Python-3.12-blue?logo=python&logoColor=white)]()
[![Standard Python](https://img.shields.io/badge/Python-3.13-blue?logo=python&logoColor=white)]()
[![Standard Python](https://img.shields.io/badge/Python-3.14-blue?logo=python&logoColor=white)]()
[![license](https://img.shields.io/badge/license-MIT-brightgreen)](LICENSE)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)

`opengate-gate-macro-fold` is a utility for managing [GATE 9](https://github.com/OpenGATE/Gate) simulation macro files. It supports:

- **Folding**: combining a directory of macro files into a single mono macro file.
- **Unfolding**: splitting a mono macro file into a directory of macro files.

This workflow is practical when switching between batch execution environments (for example, clusters) and local or interactive simulation workflows.

## Quick Start

### Install From PyPI

```bash
pip3 install opengate-gate-macro-fold
```

### Install From Source

```bash
make init
make install
```

### Fold A Macro Set Into A Mono Macro

```bash
opengate-gate-macro-fold \
  --fold \
  --input-macros-dir=path/to/macros/directory \
  --output-dir=path/to/output/directory \
  [--title="my-mono-macro.mac"]
```

### Unfold A Mono Macro Into A Macro Set

```bash
opengate-gate-macro-fold \
  --unfold \
  --input-mono-macro-file=path/to/mono/macro.mac \
  --output-dir=path/to/output/directory
```

## Command-Line Options

- `--fold`: enable fold mode (macro set -> mono macro).
- `--unfold`: enable unfold mode (mono macro -> macro set).
- `--input-macros-dir`: source directory used in fold mode.
- `--input-mono-macro-file`: source mono macro file used in unfold mode.
- `--output-dir`: destination directory for generated output.
- `--title`: optional title metadata for mono macro output.

## Development

Common development commands:

```bash
make lint
make format
make typecheck
make test
make check
```

### Pre-commit setup

You can install and activate `pre-commit` in two supported ways.

#### Option A (recommended): use `uv` in this repository

```bash
uv add --dev pre-commit
uv sync
uv run pre-commit install --hook-type pre-commit
```

Optional one-time verification on all files:

```bash
uv run pre-commit run --all-files
```

#### Option B: install `pre-commit` from Debian packages

```bash
sudo apt update
sudo apt install -y pre-commit
pre-commit --version
pre-commit install --hook-type pre-commit
```

Optional one-time verification on all files:

```bash
pre-commit run --all-files
```

The configured hook runs `make check` before each commit and blocks the commit if validation fails.

Project conventions and contribution standards:

- [Coding conventions](docs/CODING_CONVENTIONS.md)
- [Testing conventions](docs/TESTING_CONVENTIONS.md)
- [Commit conventions](docs/COMMIT_CONVENTIONS.md)
- [Contribution guide](docs/CONTRIBUTION.md)

## License

MIT License

Contact: [GitHub](https://github.com/MateuszBala)

## Author

The project was designed and implemented by Mateusz Jakub Bała.

Contact: [GitHub](https://github.com/MateuszBala)


## Contribution

To contribute new functionality:

- create a branch from `develop`
- follow the [commit conventions](docs/COMMIT_CONVENTIONS.md)
- open a PR using the [PR template](.github/PULL_REQUEST_TEMPLATE.md)
- follow the [contribution guide](docs/CONTRIBUTION.md)