Metadata-Version: 2.4
Name: sheaf-lang
Version: 1.2.0
Summary: A functional language for differentiable programming
Author: Damien Boureille
License: MIT
Project-URL: Homepage, https://sheaf-lang.org
Project-URL: Documentation, https://sheaf-lang.org
Project-URL: Repository, https://github.com/sheaf-lang/sheaf
Project-URL: Issues, https://github.com/sheaf-lang/sheaf/issues
Keywords: lisp,jax,neural-networks,symbolic-ai,deep-learning,dsl
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Compilers
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: jax>=0.4.0
Requires-Dist: jaxlib>=0.4.0
Requires-Dist: safetensors>=0.4.0
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: black; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Provides-Extra: examples
Requires-Dist: streamlit; extra == "examples"
Requires-Dist: numpy; extra == "examples"
Requires-Dist: matplotlib; extra == "examples"
Dynamic: license-file

<img width="479" height="154" alt="Screenshot 2026-01-27 at 22 55 15" src="https://github.com/user-attachments/assets/b79b4f7f-dc77-459e-a3a6-987bda4e70f2" />

Sheaf is a functional language for differentiable computation.
It is inspired by Clojure and is designed to operate within the Python/JAX machine learning ecosystem.

Sheaf has three main goals:

- Clojure Paradigm: Homoiconicity (code is data), immutability and minimalist syntax.
- Native XLA Performance: Sheaf code runs on GPUs/TPUs through JAX.
- Seamless Interop with Python: Compiled to pure JAX functions natively callable from Python.

### Sample code:

```clojure
(defn transformer-block [x layer-p config]
  (as-> x h
    (-> h   ;; 1. Self-Attention
        (layer-norm (get layer-p :ln1) 2)
        (multi-head-attention layer-p config)
        (first)  ;; Attention output
        (+ h))   ;; Residual 1

    (-> h   ;; 2. MLP
        (layer-norm (get layer-p :ln2) 2)
        (mlp (get layer-p :mlp))
        (+ h)))) ;; Residual 2
```

### Python interoperability

```python
from sheaf import Sheaf
shf = Sheaf("mlp.shf")

for x, y in zip(X, shf.forward(X, params)):
    print(f"  {x} -> {y[0]:.3f}")
```

- [Website](http://sheaf-lang.org/)
- [Reference documentation](http://sheaf-lang.org/starting/)
- [Quick Start guide](http://sheaf-lang.org/reference/)
