Metadata-Version: 2.4
Name: sanction-simulator
Version: 0.1.2
Summary: Sanction Simulator — interactive GUI and model based on the paper 'Political Power in International Trade' by Ashwin Bhattathiripad and Vipin P. Veetil, with the OECD ICIO 2022 benchmark network included
Author: Ashwin Bhattathiripad, Vipin P. Veetil
Maintainer-email: "Vipin P. Veetil" <vipin@iimk.ac.in>
License: MIT
Keywords: sanctions,international trade,input-output,production networks
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Intended Audience :: Science/Research
Classifier: Topic :: Scientific/Engineering
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24
Requires-Dist: pandas>=2.0
Requires-Dist: streamlit>=1.32
Requires-Dist: plotly>=5.18
Dynamic: license-file

# Sanction Simulator

Interactive sanction simulator based on the paper **“Political Power in
International Trade”** by **Ashwin Bhattathiripad** and **Vipin P.
Veetil**. The package bundles

- the estimation model (`power_trade_estimation.py`: two-sided RAS
  rerouting + CES capacity-rationing equilibrium on the world
  input–output network),
- the pre-built benchmark network from the **OECD ICIO 2025 release
  (year 2022)**, and
- a point-and-click GUI for composing and solving arbitrary sanction
  scenarios.

## Install (macOS / Linux / Windows)

```sh
python3 -m pip install sanction-simulator
```

Python ≥ 3.10. Dependencies (numpy, pandas, streamlit, plotly) are
installed automatically.

## Run the GUI

```sh
sanction-simulator
```

This opens the simulator in your browser (default port 8601; override
with `SANCTION_SIM_PORT`). Pick the sanctioning coalition, the targeted
countries, the instrument (full embargo / export ban / import ban), an
optional sector scope, and the structural parameters (τ, δ, ρ, ϱ), then
press **Solve scenario**. A typical scenario solves in one or two
seconds and reports output losses by country and sector, a world map,
and solver diagnostics.

## Programmatic use

```python
import sys
import sanction_simulator as ss
sys.path.insert(0, ss._PKG_DIR)
import power_trade_estimation as pte

bench = pte.Benchmark(ss.data_dir(), cache=ss.bench_cache())
iu, ic = bench.cidx["USA"], bench.cidx["CHN"]
sb = pte.ScenarioBatch(bench, [pte.bilateral_legs(iu, ic)],
                       tau=0.30, delta=0.10)
sb.balance()
res = sb.solve(rho=-1.0)
loss = bench.s - res["s_omega"][0]          # gross-output loss, USD mn
```

## Full pipeline

`sanction-simulator-estimate` exposes the paper's estimation stages
(`--stage validate|baseline|sensitivity|all`). The packaged data
contains the pre-built benchmark cache only; a from-scratch rebuild
additionally needs the raw OECD ICIO file `2022_SML.csv` placed in the
`--datadir` directory.

## Data note

The benchmark cache (`bench_cache.npz`) is a lossless, compressed copy
of the network constructed from the OECD Inter-Country Input–Output
tables, 2025 release, reference year 2022 (80 countries × 50 sectors).
Source: OECD Inter-Country Input–Output Database,
<https://www.oecd.org/en/data/datasets/inter-country-input-output-tables.html>.
The OECD is the source of the underlying data; use of the derived
benchmark network is subject to the OECD's terms and conditions.

## License

The code is released under the MIT License (see `LICENSE`). Copyright
(c) 2026 Ashwin Bhattathiripad and Vipin P. Veetil. If you use this
package in academic work, please cite the paper *Political Power in
International Trade*.
