Metadata-Version: 2.4
Name: reshiki
Version: 0.14.0
Classifier: Development Status :: 3 - Alpha
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Rust
Classifier: Typing :: Typed
Classifier: Topic :: Scientific/Engineering :: Chemistry
Requires-Dist: openpyxl>=3.1,<4 ; extra == 'excel'
Requires-Dist: pillow>=10 ; extra == 'excel'
Requires-Dist: pandas>=2.0,<4 ; extra == 'pandas'
Provides-Extra: excel
Provides-Extra: pandas
Summary: Draw, convert and analyse chemical structures with the ReShiki engine
License-Expression: MIT OR Apache-2.0
Requires-Python: >=3.10
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Homepage, https://github.com/Ameyanagi/ReShiki
Project-URL: Issues, https://github.com/Ameyanagi/ReShiki/issues

# ReShiki for Python

Draw, convert and analyze chemical structures with the same Rust engine as the
ReShiki editor. Python 3.10 or later is required. The API is experimental until 1.0.

```sh
uv add reshiki  # or: pip install reshiki
```

```python
import reshiki

aspirin = reshiki.Molecule.from_smiles("CC(=O)Oc1ccccc1C(=O)O")
figure = aspirin.clean().with_style("JACS / ACS", font_size=12)
figure.save("aspirin.png", width=300)
print(aspirin.properties().formula)
```

Transforms return new objects. The original molecule keeps its geometry and
style. In Jupyter, displaying an object shows its SVG drawing.

## Spreadsheets

Install the Excel integration with `uv add 'reshiki[excel]'`, then add drawings
beside a column of SMILES:

```python
import reshiki

reshiki.excel.add_structures(
    "compounds.xlsx",
    smiles="A",
    into="B",
    out="compounds-drawn.xlsx",
    width=300,
    header=True,
)
```

The helper uses openpyxl and embeds PNG images. Editable Office pictures are a
follow-up to [issue #462](https://github.com/Ameyanagi/ReShiki/issues/462).
Use `header=False` for a sheet whose first row contains a structure, or
`start_row=` to choose an explicit first row.

## Other entry points

```python
crystal = reshiki.Drawing.open("rutile.vasp")
svg = crystal.svg()
png = reshiki.render("c1ccccc1O", format="png", width=300)
mol = reshiki.convert("CCO", to="mol")
properties = reshiki.properties("CCO")
pngs = reshiki.render_many(["CCO", "C1CC"], format="png", width=300)
print(pngs.errors)
```

`reshiki.parse(text, format=None)` detects chemical text, native drawings and
crystal structures. Explicit constructors include `from_smiles`, `from_molfile`,
`from_inchi`, `from_cdxml` and offline `from_name`. An online name lookup raises
`NotImplementedError`: the current PubChem client belongs to the desktop app.

PNG dimensions follow the drawing style's physical bond length and `dpi` by
default. `width` and `height` optionally fit the image into a pixel box without
changing its aspect ratio. `reshiki.styles()` lists the app's drawing presets;
`reshiki.Style(name, **overrides)` makes a reusable style.

Install `reshiki[pandas]` and explicitly `import reshiki.pandas` to register
the pandas Series `.reshiki` accessor with `png()`, `svg()` and `properties()`.
Optional dependencies load when their integration is used.
RDKit conversion uses `Molecule.from_rdkit(mol)` and
`molecule.to_rdkit()` when RDKit is already installed.

Outputs include PNG, SVG, PDF, CDXML, MOL/SDF, SMILES, InChI and native `.rsk`.
EMF raises `NotImplementedError` pending a headless exporter. Wheels for macOS,
Windows and Linux on x64 and ARM64 follow each ReShiki release.

See the [Python guide](../../docs/python.md) for the API and local build commands.

