Skip to main content

cppkh-interface

cppkh-interface is a Python package for computing integer Khovanov homology with the C++ cppkh implementation.

The package has no runtime Python-package dependencies. Link crossing signs, PD validation, R1 removal, and nugatory-crossing removal all use the bundled canonical cppkh C++ source and its SageMath-compatible orientation rules.

The package is compatible with the main javakh-interface function:

import cppkh_interface

pd_code = [[1, 5, 2, 4], [3, 1, 4, 6], [5, 3, 6, 2]]
print(cppkh_interface.solve_khovanov(pd_code, de_r1=True, de_k8=True))
print(cppkh_interface.solve_many_khovanov([pd_code, pd_code]))

For a multi-component oriented link, callers can compute several explicit crossing-sign variants without changing the existing APIs:

from cppkh_interface import compute_signed_variants

hopf = [[2, 3, 1, 4], [4, 1, 3, 2]]
results = compute_signed_variants(hopf, [[-1, -1], [1, 1]])
assert len(results) == 2

Each sign row must contain exactly one -1 or 1 for every crossing. This operation deliberately disables PD simplification because removing a crossing would invalidate the positional sign mapping. solve_khovanov and solve_many_khovanov retain their original signatures, inferred-sign behavior, and simplification defaults.

Unlike wrappers that ship a prebuilt DLL or shared object, this package ships the cppkh C++ source file in built distributions and compiles a local executable on first use using only Python's standard library. The compiled executable is cached for later calls.

In the repository checkout, the package does not keep a committed backup copy of the C++ source. The build backend copies ../../src/main.cpp into the package data directory only while the PEP 517 build is running, then removes that temporary copy.

Install

pip install cppkh-interface

A C++14 compiler must be available at runtime. The package looks at CPPKH_INTERFACE_CXX, then CXX, then searches PATH for g++, clang++, or c++. To select a compiler explicitly:

CPPKH_INTERFACE_CXX=clang++ python your_script.py

Windows PowerShell:

$env:CPPKH_INTERFACE_CXX = "C:\path\to\g++.exe"
python your_script.py

Build And Publish

From this directory:

python -m build
poetry publish

Do not use poetry build or poetry publish --build: Poetry's direct builder bypasses the source-synchronizing PEP 517 backend. Build first with python -m build, inspect/test the wheel, then publish the existing artifacts.

For local testing:

poetry run python -m cppkh_interface "[[1,5,2,4], [3,1,4,6], [5,3,6,2]]"

Metadata

Release files for cppkh-interface 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cppkh-interface 0.2.1
File Size Uploaded
cppkh_interface-0.2.1.tar.gz 38.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cppkh-interface 0.2.1
File Interpreter ABI Platform
cppkh_interface-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 77.2 kB

Release files / cppkh_interface-0.2.1.tar.gz

Download URL cppkh_interface-0.2.1.tar.gz
Size 38.5 kB
Tags Source
SHA-256 checksum
How to use checksums
638309976631988ddd02e136f395399002947b145979740694f09d374ec5942d
BLAKE2b-256 checksum
How to use checksums
7d6e5755c848735103ccfc2e59888e6ca797a2ee668cf4b091a35b79f268a1f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release files / cppkh_interface-0.2.1-py3-none-any.whl

Download URL cppkh_interface-0.2.1-py3-none-any.whl
Size 38.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
361f7b1122f5238e939717f3c58ad3120af8007242e53e4727c372ea0f6075b9
BLAKE2b-256 checksum
How to use checksums
3485061e2dbea7529de4035b440389335d5d4c8196b806bb4998e66d6459c72a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.11.15 Windows/10

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page