semvec/pypi-packages huggingface dataset:
statsim-compiler 0.1.0
StatSim compiler — parse .sm models and compile to PyMC, Stan, TFP.js, Z3
License: MIT
Requires Python: >=3.9
Keywords: statsim, probabilistic-programming, bayesian, compiler, pymc, stan

# statsim-compiler

Compiler for the [StatSim](https://statsim.com) modeling language. Parses `.sm` models and compiles them to multiple probabilistic programming backends.

## Install

```bash
pip install statsim-compiler
```

## Usage

```python
from statsim_compiler import parse, compile, model

# Parse and compile to PyMC code
blocks = parse('p ~ Beta(1, 1)\nx ~ Bin(10, p) | 7\nsample(5000)')
result = compile(blocks, 'pymc')
print(result['code'])        # PyMC source code
print(result['param_names']) # ['p']

# High-level: parse + compile + get a runner
runner = model('p ~ Beta(1, 1)\nx ~ Bin(10, p) | 7\nsample(5000)')
print(runner.code)           # generated PyMC code
trace = runner.run()         # run MCMC inference (requires pymc)
```

## Targets

| Target | Output |
|--------|--------|
| `pymc` | PyMC Python code |
| `stan` | Stan code |
| `tfpjs` | TensorFlow Probability (JavaScript) |
| `z3` | Z3 constraint solver (Python) |

## API

- `parse(source)` — parse `.sm` source, returns a `BlockList`
- `compile(blocks, target)` — compile to target, returns `dict` with `code`, `data_names`, `param_names`, `inference_mode`
- `compile_script(blocks, target)` — compile to raw code string
- `model(source, target)` — parse + compile + return a runner (PyMC runner for `target='pymc'`)

## Runner API (PyMC)

```python
runner = model(source, 'pymc')
runner.code                    # generated source
runner.run(data, **kwargs)     # run inference, returns InferenceData
runner.build(data, **kwargs)   # get pm.Model for extension
```

## Language

One line, one concept. Math notation:

```
p ~ Beta(1, 1)                    # prior
x ~ Bin(10, p) | 7                # observation
delta = p_B - p_A                 # deterministic
y[i] ~ N(mu, sigma), i=1:N       # plated
sample(5000)                      # directive
```

See the [language reference](https://statsim.com/docs) for the full spec.

## License

MIT
rectangle-packer 2.0.6
Pack a set of rectangles into a bounding box with minimum area
License: MIT
Requires Python: >=3.9
Keywords: pack rectangle packing rectangles enclosing 2D

================
rectangle-packer
================

Fast rectangle packing for Python.

Given a set of rectangles with fixed orientations, ``rectangle-packer`` finds
an enclosing bounding box with small area and no overlaps.

Installation
============

.. code:: sh

    python3 -m pip install rectangle-packer

Quick start
===========

.. code:: python

    import rpack

    sizes = [(58, 206), (231, 176), (35, 113), (46, 109)]
    positions = rpack.pack(sizes)
    print(positions)

The output contains ``(x, y)`` coordinates for each rectangle's lower-left
corner.

Documentation and source
========================

* Documentation: https://rectangle-packer.readthedocs.io/en/latest/
* Source code: https://github.com/Penlect/rectangle-packer