Metadata-Version: 2.3
Name: pixi-sync-environment
Version: 0.3.1
Summary: Pre-commit hook to sync a pixi environment with a traditional conda environment.yml
Keywords: 
Author: Bernardo Veronese
Author-email: Bernardo Veronese <bernardopveronese@gmail.com>
License: MIT License
         
         Copyright (c) 2025 Bernardo Porto Veronese
         
         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.
Classifier: Programming Language :: Python :: 3
Requires-Dist: pyyaml>=6.0.2
Requires-Python: >=3.10
Project-URL: Homepage, https://github.com/binado/pixi-sync-environment
Description-Content-Type: text/markdown

# pixi-sync-environment

[![Test](https://github.com/binado/pixi-sync-environment/actions/workflows/test.yml/badge.svg)](https://github.com/binado/pixi-sync-environment/actions/workflows/test.yml)

A pre-commit hook and CLI tool that generates conda `environment.yml` files from pixi projects using `pixi workspace export conda-environment`. Useful for maintaining compatibility with conda-based workflows and CI systems that don't support pixi.

The tool compares the generated environment with an existing `environment.yml` file (if present) and updates it only when changes are detected. In check mode, it reports differences without modifying files.

## Installation

```bash
pip install pixi-sync-environment
```

## CLI Usage

```bash
# Sync pixi environment to environment.yml
pixi_sync_environment pixi.toml

# Sync a specific pixi environment
pixi_sync_environment --environment dev pixi.toml

# Check mode (exits with code 1 if out of sync)
pixi_sync_environment --check pixi.toml
```

### Options

```
positional arguments:
  input_files                    Path to pixi.toml, pyproject.toml, environment.yml, or pixi.lock

options:
  --environment-file FILE        Output file name (default: environment.yml)
  --environment ENV              Pixi environment to export (default: default)
  --name NAME                    Environment name in output file
  --check                        Verify sync status without modifying files
```

## Pre-commit Hook

```yaml
# .pre-commit-config.yaml
repos:
  - repo: https://github.com/binado/pixi-sync-environment
    rev: v0.3.0
    hooks:
      - id: pixi-sync-environment
        # args: [--environment, dev, --environment-file, environment-dev.yml]
```

For check-only validation (useful in CI):

```yaml
repos:
  - repo: https://github.com/binado/pixi-sync-environment
    rev: v0.3.0
    hooks:
      - id: pixi-sync-check
```

## License

MIT
