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.2.0.tar.gz (9.5 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.2.0-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cppkh_interface-0.2.0.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Windows/10

File hashes

Hashes for cppkh_interface-0.2.0.tar.gz
Algorithm Hash digest
SHA256 1dc7eff61e0d00c442d876655f9a4be0abeaf21e4b777e1c9dc0601d41ef8715
MD5 ecec4f94492bf8ab7f3999e5bd3bb8cd
BLAKE2b-256 0976a092de407d4d30d34a93b1a60ea00f12ac7b858499115701a591f1164f3e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cppkh_interface-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 8.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.4.1 CPython/3.11.15 Windows/10

File hashes

Hashes for cppkh_interface-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 19b77452781c107e2857768fa45c6b46eadedf4a51066cdf62ebee4e72b123b5
MD5 51f6caf8783006a66bcf46b2b8998646
BLAKE2b-256 80bbbd681de462b896461e3e9e1bcc9b7dbbae80a3889330b3a96229c10dbb8b

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