Ketcher editor as anywidget
Project description
ipyketcher
How to use
from ipyketcher import KetcherEditor
editor = KetcherEditor(
initial_molecule="OCC",
return_formats=["smiles", "molfile"],
)
editor
You can now draw a structure, and access the currently drawn molecule in smiles or molfile format via
editor.smiles or editor.molfile.
Other supported formats are: 'rxn', 'ket', 'smarts', 'cml', 'sdf', 'cdxml', 'cdx', 'inchi', 'inchi_key'. Set the format you want synchronized back to Python using the return_formats parameter, and observe the output via the corresponding attribute on the KetcherEditor instance.
Installation
pip install ipyketcher
or with uv:
uv add ipyketcher
Development
We recommend using uv for development. It will automatically manage virtual environments and dependencies for you.
uv run jupyter lab example.ipynb
Alternatively, create and manage your own virtual environment:
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
jupyter lab example.ipynb
The widget front-end code bundles it's JavaScript dependencies. After setting up Python, make sure to install these dependencies locally:
npm install
While developing, you can run the following in a separate terminal to automatically rebuild JavaScript as you make changes:
npm run dev
Open example.ipynb in JupyterLab, VS Code, or your favorite editor
to start developing. Changes made in js/ will be reflected
in the notebook.
Creating a new release:
- Bump the version in
pyproject.toml. - Create a new git tag with the version.
- Build and upload the package to PyPI:
npm build
hatch build
hatch publish -u __token__ -a pypi-<your-token>
Hot reloading
Set anywidget hot reloading on windows:
set ANYWIDGET_HMR=1
Resources
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 ipyketcher-0.1.0.tar.gz.
File metadata
- Download URL: ipyketcher-0.1.0.tar.gz
- Upload date:
- Size: 33.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7875c9d3cbc97feab4e39751ceb8f3a4baac27e7bac2878a45abee6fd0f41e9
|
|
| MD5 |
643316be8bfde136555360709ed3630a
|
|
| BLAKE2b-256 |
65cb82a3214ca99fc08c30d92a75e3430febfe22ff16f23686a5e74046439fc4
|
File details
Details for the file ipyketcher-0.1.0-py2.py3-none-any.whl.
File metadata
- Download URL: ipyketcher-0.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 15.7 MB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7db485bbaa49212b400a009c4a5ecb865a745fb1b15693018ba1e2e6f0466153
|
|
| MD5 |
e1a22a3f91b991e81efedf9fe2831ca1
|
|
| BLAKE2b-256 |
023f13cc551e4192a22530f8b0df3e565a1fb090a47b49c5142d6be408219673
|