Metadata-Version: 2.4
Name: feynmangraph
Version: 0.1.0
Summary: Web frontend for building Feynman diagrams and exporting gammaloop-compatible .dot files
Project-URL: Homepage, https://github.com/ecavan/FeynmanGraph
Project-URL: Repository, https://github.com/ecavan/FeynmanGraph
Project-URL: Issues, https://github.com/ecavan/FeynmanGraph/issues
Author-email: Elijah Cavan <eli_cavan@live.ca>
Maintainer-email: Elijah Cavan <eli_cavan@live.ca>
License-Expression: MIT
License-File: LICENSE
Keywords: BSM,QFT,UFO,fastapi,feynman diagrams,forward scattering,gammaloop,linnet,particle physics,quantum field theory,reactflow
Classifier: Development Status :: 4 - Beta
Classifier: Framework :: FastAPI
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Physics
Classifier: Topic :: Scientific/Engineering :: Visualization
Requires-Python: >=3.11
Requires-Dist: fastapi>=0.115
Requires-Dist: networkx>=3.3
Requires-Dist: pydantic>=2.9
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: ufo-model-loader>=0.1
Requires-Dist: uvicorn[standard]>=0.32
Provides-Extra: dev
Requires-Dist: httpx>=0.27; extra == 'dev'
Requires-Dist: mypy>=1.13; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8; extra == 'dev'
Requires-Dist: ruff>=0.7; extra == 'dev'
Requires-Dist: types-networkx>=3.3; extra == 'dev'
Description-Content-Type: text/markdown

# feynmangraph

[![PyPI](https://img.shields.io/pypi/v/feynmangraph?label=PyPI&color=blue&cacheSeconds=300)](https://pypi.org/project/feynmangraph/)
[![Python](https://img.shields.io/pypi/pyversions/feynmangraph?cacheSeconds=300)](https://pypi.org/project/feynmangraph/)
[![License](https://img.shields.io/pypi/l/feynmangraph?cacheSeconds=300)](LICENSE)

Web frontend for building Feynman diagrams. Hand-draw them on a canvas with live conservation/legality checks, or type a process like `e+ e- → mu+ mu-` and have [gammaloop](https://github.com/alphal00p/gammaloop) enumerate the diagrams for you. Forward-scattering cuts, UFO models, and round-trip `.dot` export included.

![feynmangraph](examples/frontend.png)
*1-loop electron self-energy with forward-scattering glue between the incoming and outgoing legs.*

## Install

```bash
pip install feynmangraph
feynmangraph setup     # builds gammaloop (~15 min, one-time, needs Rust)
feynmangraph serve     # http://localhost:8000
```

The Canvas, Import, and Export tabs work without `gammaloop`; only the Generate tab needs it. Skip `setup` if you only want the editor.

## What it does

- **Canvas.** Drag vertices, connect propagators, place externals. Charge, lepton number, baryon number, and color triality are checked live, and each vertex is matched against the UFO interaction list — you can't build something that isn't a real diagram.
- **Generate.** Pick a process spec; gammaloop enumerates the diagrams. Speed-up controls: restrict to a particle subset and pick the numerator-isomorphism grouping mode (`no_grouping` for fastest).
- **Forward-scattering cuts.** Pair two externals via `isCut` from a single dropdown. Round-trips through `.dot` including Linnet's `node [isCut="X"]` shorthand.
- **UFO models.** Upload a `.tar.gz` or `.zip` — particles and vertex rules light up immediately.
- **Export.** Single diagram or whole gallery → gammaloop-format `.dot` with projector, half-port IDs, `lmb_id` chords, and `isCut` glue.

Built on [gammaloop](https://github.com/alphal00p/gammaloop) (diagram enumeration + `.dot` dialect), [FastAPI](https://fastapi.tiangolo.com/), [React](https://react.dev/) + [reactflow](https://reactflow.dev/).

## Out of scope

This is the editor and the front door to gammaloop. Amplitude evaluation, cross-sections, decay widths — all gammaloop's job. See <https://github.com/alphal00p/gammaloop>.

## License

MIT
