Pure Python chemistry library with zero dependencies
Project description
chiralipy
Chiralipy is a pure Python library for SMILES/SMARTS parsing, canonicalization, and molecular manipulation.
Installation
pip install -e .
Quick Start
from chiralipy import parse, canonical_smiles
# Parse and canonicalize
mol = parse("C(C)CC")
print(canonical_smiles(mol)) # CCCC
# Substructure matching
from chiralipy.match import substructure_search
mol = parse("c1ccccc1CCO")
pattern = parse("[OH]")
matches = substructure_search(mol, pattern) # [(7,)]
# BRICS decomposition
from chiralipy.decompose import brics_decompose
mol = parse("CCOc1ccc(CC)cc1")
fragments = brics_decompose(mol)
print(sorted(fragments))
# ['[16*]c1ccc([16*])cc1', '[3*]O[4*]', '[4*]CC', '[8*]CC']
Features
- SMILES/SMARTS parsing with full stereochemistry support
- Canonical SMILES generation
- Substructure matching (RDKit-compatible)
- BRICS decomposition for retrosynthetic fragmentation
- Aromaticity perception based on Hückel's 4n+2 rule
- Ring detection (SSSR algorithm)
- Zero dependencies — pure Python
Core API
from chiralipy import parse, canonical_smiles, to_smiles
from chiralipy.match import substructure_search, has_substructure
from chiralipy.decompose import brics_decompose, get_scaffold
from chiralipy.rings import find_sssr
from chiralipy.transform import kekulize
Benchmark: BRICS Decomposition
Comparison against RDKit (C++ implementation):
Molecule Atoms Bonds RDKit ms chiralipy ms Ratio
----------------------------------------------------------------
small_ether 5 4 0.37 0.60 1.62x
medium_drug 15 15 0.88 1.89 2.13x
drug_like 37 41 3.54 5.05 1.43x
large_complex 84 98 5.04 13.33 2.64x
Average: ~2x slower than RDKit
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file chiralipy-0.1.0.tar.gz.
File metadata
- Download URL: chiralipy-0.1.0.tar.gz
- Upload date:
- Size: 77.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c3f8b778f22499a32207369a608e996b2d1e2e4c39a0f3871dd557396a4f347d
|
|
| MD5 |
fd265cb10843a424aa27d6013bebab39
|
|
| BLAKE2b-256 |
7e3ef8ced9735fb5803a358ef04726e023a12c7c19180d45d55ae877f6d0393f
|
Provenance
The following attestation bundles were made for chiralipy-0.1.0.tar.gz:
Publisher:
python-publish.yml on levlai/chiralipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chiralipy-0.1.0.tar.gz -
Subject digest:
c3f8b778f22499a32207369a608e996b2d1e2e4c39a0f3871dd557396a4f347d - Sigstore transparency entry: 737934646
- Sigstore integration time:
-
Permalink:
levlai/chiralipy@6c8af048c25e4cd9137302321909f32b315874ce -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/levlai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6c8af048c25e4cd9137302321909f32b315874ce -
Trigger Event:
release
-
Statement type:
File details
Details for the file chiralipy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: chiralipy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 63.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
060babf409566f728f6992a08617d733ece3804f22387c7b12ce128a2e2900b0
|
|
| MD5 |
6a49a453825aaa9dccac6f2c0ce1607a
|
|
| BLAKE2b-256 |
5631e50a5a2b991a174abac2850763c6bd1811399d91173c2f9673cc7b918e33
|
Provenance
The following attestation bundles were made for chiralipy-0.1.0-py3-none-any.whl:
Publisher:
python-publish.yml on levlai/chiralipy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
chiralipy-0.1.0-py3-none-any.whl -
Subject digest:
060babf409566f728f6992a08617d733ece3804f22387c7b12ce128a2e2900b0 - Sigstore transparency entry: 737934658
- Sigstore integration time:
-
Permalink:
levlai/chiralipy@6c8af048c25e4cd9137302321909f32b315874ce -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/levlai
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@6c8af048c25e4cd9137302321909f32b315874ce -
Trigger Event:
release
-
Statement type: