Metadata-Version: 2.4
Name: py-rattler-build
Version: 0.60.0
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Rust
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Typing :: Typed
License-File: LICENSE
Summary: The fastest way to build conda packages programatically
Author-email: Wolf Vollprecht <w.vollprecht@gmail.com>
License-Expression: BSD-3-Clause
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/prefix-dev/rattler-build
Project-URL: Issues, https://github.com/prefix-dev/rattler-build/labels/python-bindings
Project-URL: Repository, https://github.com/prefix-dev/rattler-build

# py-rattler-build

Python bindings for [Rattler-Build](https://github.com/prefix-dev/rattler-build), the fast conda package builder.

`py-rattler-build` lets you build, inspect, test, and upload conda packages
directly from Python — no subprocess calls needed.

## Quick start

### Build a package from a recipe

```python
from rattler_build import Stage0Recipe, VariantConfig

recipe = Stage0Recipe.from_file("recipe.yaml")
results = recipe.run_build()

for result in results:
    print(f"Built {result.name} {result.version} in {result.build_time:.1f}s")
    for pkg in result.packages:
        print(f"  {pkg}")
```

### Render and build with variants

```python
from rattler_build import Stage0Recipe, VariantConfig

recipe = Stage0Recipe.from_file("recipe.yaml")
rendered_variants = recipe.render(VariantConfig())

for variant in rendered_variants:
    result = variant.run_build()
```

### Inspect an already built package

```python
from rattler_build import Package

pkg = Package.from_file("mypackage-1.0.0-py312h0_0.conda")
print(f"{pkg.name} {pkg.version} ({pkg.platform})")
print(f"Dependencies: {pkg.depends}")
print(f"Files: {len(pkg.files)}")
```

### Test a package

```python
from rattler_build import Package

pkg = Package.from_file("mypackage-1.0.0-py312h0_0.conda")
results = pkg.run_tests()
```

### Generate a recipe from PyPI

```python
from rattler_build import generate_pypi_recipe

recipe_yaml = generate_pypi_recipe("requests", version="2.31.0")
print(recipe_yaml)
```

### Build with progress reporting

```python
from rattler_build import Stage0Recipe, VariantConfig
from rattler_build.progress import RichProgressCallback

recipe = Stage0Recipe.from_file("recipe.yaml")
rendered_variants = recipe.render(VariantConfig())

for variant in rendered_variants:
    with RichProgressCallback(show_logs=True) as callback:
        result = variant.run_build(progress_callback=callback)
```

## Documentation

For the full reference, check out our
[website](https://rattler-build.prefix.dev/latest/py-rattler-build/reference/).

