Skip to main content

Dependency-free Python interface for cppkh with runtime C++ compilation.

Project description

cppkh-interface

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

Version 0.1.3 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]))

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]]"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cppkh_interface-0.1.3.tar.gz (36.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cppkh_interface-0.1.3-py3-none-any.whl (37.0 kB view details)

Uploaded Python 3

File details

Details for the file cppkh_interface-0.1.3.tar.gz.

File metadata

  • Download URL: cppkh_interface-0.1.3.tar.gz
  • Upload date:
  • Size: 36.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.5 Windows/11

File hashes

Hashes for cppkh_interface-0.1.3.tar.gz
Algorithm Hash digest
SHA256 3e2c70e53c26ac2eafedf4f50eea9583094698b2f10feded6da55fb4902ff4d4
MD5 ee6e6fc6e1f253b63863aacd59f5b977
BLAKE2b-256 85397f76d69b295ef510d6d26db95a21f594131980170c6bcd7249c28993a269

See more details on using hashes here.

File details

Details for the file cppkh_interface-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: cppkh_interface-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 37.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.13.5 Windows/11

File hashes

Hashes for cppkh_interface-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 2b5da0eece11befff10759c9c6cea4110da2773cbe7ddcf0a060b046bbea6567
MD5 ca573efba4e5f28f27578df2a9e84d17
BLAKE2b-256 83ee1fa9da064fb1597dc0216f44f2ec4cd223cc14c5d1a902dba546eb988145

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page