xpict
Molecule depiction for publication-quality vector graphics — Rust,
Python, or the web with JavaScript. Shared paint in Rust
(xpict-core); each language owns RDKit layout at its edge.
| Language | Package |
|---|---|
| JS/TS | @xenosite/xpict |
| Python | xpict |
| Rust | xpict / xpict-core |
Public API
Two first-class surfaces — same paint:
- Single molecule —
mol→render→toSvg(JS, Rust): one structure, options,align_to. - Declarative document — nested JSON (
type: "mol"/group+children): batching and a document model that is still expanding toward fullPictSpec.
Chem label markup: docs/label-markup.md.
Full walkthrough with images: https://swamidasslab.github.io/xenosite-pict/
Single molecule
import { xpict } from "@xenosite/xpict";
const benzene = xpict.mol("c1ccccc1");
const rendered = await xpict.render(benzene, {
color: "#0b6e4f",
atom_shade: [0, 0, 0.2, 0, 0, 0.9],
star_labels: ["$R_1$"], // when the mol has *
});
const svg = xpict.toSvg(rendered.scene);
const aligned = await xpict.render(xpict.mol("Cc1ccccc1"), {
align_to: benzene, // or align_to: rendered
});
use xpict::{mol, MolRenderOptions};
let mut m = mol("CCO")?;
let rendered = m.render(MolRenderOptions {
color: Some("#0b6e4f".into()),
atom_shade: Some(vec![0.0, 0.2, 0.9]),
..Default::default()
})?;
let svg = rendered.to_svg();
render options
| Option | Effect |
|---|---|
color |
Backbone / label ink |
atom_shade / bond_shade |
Plot-dot shading scores (layout order) |
star_labels |
Labels for * atoms (encounter order); chem markup supported |
weight |
Ink weight relative to house (1); min 2/3 |
scale |
Uniform diagram scale (1 = house size) |
align_to |
Template pose (Mol / Rendered in JS; molblock string in Rust) |
id |
Optional molecule id on the paint ABI |
When star_labels is omitted, CXSMILES |$…$| aliases apply by atom index.
Declarative document
const [r] = await xpict.depict({
type: "mol",
smiles: "CCO",
color: "#0b6e4f",
shade: { atoms: [0.0, 0.2, 0.9], vmin: 0, vmax: 1 },
});
const svg = xpict.toSvg(r.scene);
const batch = await xpict.depict({
type: "group",
children: [
{ type: "mol", cxsmiles: "*c1ccccc1Cl |$R1;;;;;$|" },
{ type: "mol", cxsmiles: "*c1ccc(O)cc1 |$R1;;;;;$|" },
],
});
from xpict import render
svg = render({
"type": "mol",
"smiles": "CCO",
"shade": {"atoms": [0.0, 0.2, 0.9], "vmin": 0.0, "vmax": 1.0},
})
use xpict::{depict, DepictSpec, MolNode};
let results = depict(&DepictSpec::Group {
id: None,
children: vec![
MolNode {
smiles: Some("CCO".into()),
..Default::default()
},
],
})?;
Contract: DepictSpec / MolNode in xpict.contracts.depict. Document fields
today: structure, id, color, shade. Nested diagrams / ELK / reaction
chrome stay under xpict.future until they graduate.
Docs & demo
https://swamidasslab.github.io/xenosite-pict/
JS align demo: https://swamidasslab.github.io/xenosite-pict/js/demo/
Architecture
┌─────────────────┐
│ xpict-core │ paint (no RDKit)
└────────┬────────┘
┌───────────────────┼───────────────────┐
▼ ▼ ▼
xpict-py / WASM @xenosite/xpict xpict (native)
(Python / JS) (RDKit.js) (RDKit + FFI)
License
MIT
Metadata
Release files for xpict 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xpict-0.3.0.tar.gz | 1.9 MB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| xpict-0.3.0-cp311-abi3-win_arm64.whl | CPython 3.11 | abi3 | Windows ARM64 | Details |
| xpict-0.3.0-cp311-abi3-win_amd64.whl | CPython 3.11 | abi3 | Windows x86-64 | Details |
| xpict-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| xpict-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.11 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| xpict-0.3.0-cp311-abi3-macosx_11_0_arm64.whl | CPython 3.11 | abi3 | macOS 11.0+ ARM64 | Details |
| xpict-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl | CPython 3.11 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 26.5 MB
Release files / xpict-0.3.0.tar.gz
| Download URL | xpict-0.3.0.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
be521d0e6c9d0fef052d6d630c6e587727b678d3ab84a5623423fd3a14ec8ef0
|
|
BLAKE2b-256 checksum How to use checksums |
5b2c9e81fe67f5a99b0c2274d1bd1fcf5d98561f0f8ceeae645fe0e1ce242941
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.15.0
|
Release files / xpict-0.3.0-cp311-abi3-win_arm64.whl
| Download URL | xpict-0.3.0-cp311-abi3-win_arm64.whl |
|---|---|
| Size | 3.8 MB |
| Tags | CPython 3.11 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
a5e2610bab662bdbc01439cf8260edbc4f1df7577b4145ffb2cc95e88e56fb73
|
|
BLAKE2b-256 checksum How to use checksums |
8f3f019cde030c2f2a8bc981bf55fee88ef3f8a12e87455489f5619ba03ef0d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.15.0
|
Release files / xpict-0.3.0-cp311-abi3-win_amd64.whl
| Download URL | xpict-0.3.0-cp311-abi3-win_amd64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.11 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
b958b7c439784f7b009fc2507564e2018fe9220cb91485c7785be9855b727890
|
|
BLAKE2b-256 checksum How to use checksums |
632cdb3cc6c2224687bbfbc32a1a48fff8592c6087525d827624d9685fc02852
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.15.0
|
Release files / xpict-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | xpict-0.3.0-cp311-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 4.3 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
cddf782207fe25482069dc75c287949488b4171001100f6c7c1d00d1a85b9e9d
|
|
BLAKE2b-256 checksum How to use checksums |
3a24e29ae0b809be3ff9ebc89f56cf059ed70401644b006854741fe4afb9188e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.15.0
|
Release files / xpict-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | xpict-0.3.0-cp311-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.11 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
896bf12b773727ada3bd900db119376246d2e27d17fb06c22dcac1779d21ba0d
|
|
BLAKE2b-256 checksum How to use checksums |
5be1b118f42793907fe20425f8d6fe3cf1a24a36032e841432d90947bdad983f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.15.0
|
Release files / xpict-0.3.0-cp311-abi3-macosx_11_0_arm64.whl
| Download URL | xpict-0.3.0-cp311-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 4.0 MB |
| Tags | CPython 3.11 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
631c385824daa6aa34fb01addeca68fd54c43d2f0ecc8caf1387c108b41ba1e0
|
|
BLAKE2b-256 checksum How to use checksums |
c879f4fa87ed1385792a54749676be5135232a9e6acf843c29636060b27bd08d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.15.0
|
Release files / xpict-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl
| Download URL | xpict-0.3.0-cp311-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 4.2 MB |
| Tags | CPython 3.11 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
21ebb871dae5fea8962e5931a111f773577bfa2fe7801a2e7891e342a0e1bbac
|
|
BLAKE2b-256 checksum How to use checksums |
caee8d297a528b3bca614e843d116c6d51253de61e8088857e1156ee1d6538e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
maturin/1.15.0
|