Skip to main content

Python interface for cpp-pd-code-simplify with runtime C++ compilation.

Project description

cpp-pd-code-simplify-interface

cpp-pd-code-simplify-interface is a Python package for calling the cpp-pd-code-simplify C++ implementation from Python.

The package is designed for PyPI distribution:

pip install cpp-pd-code-simplify-interface

It ships the C++ source code inside the wheel and source distribution. On first use, the package compiles a cached local dynamic library through cpp-simple-interface; later calls reuse that library through ctypes. A C++14 compiler compatible with g++ must be available at runtime.

Calls use the C++ library's default preprocessing pipeline: R1-move removal followed by nugatory-crossing removal.

Example

import cpp_pd_code_simplify_interface as simplify

pd_code = "PD[X[1,5,2,4],X[3,1,4,6],X[5,3,6,2]]"
result = simplify.simplify(pd_code)
print(result["simplification_found"])

Batch use:

results = simplify.simplify_many([pd_code, "PD[]"])

To select a compiler:

CXX=clang++ python your_script.py

Windows PowerShell:

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

On Windows, use a compiler whose target architecture matches Python. A 64-bit Python process needs a 64-bit compiler target.

Command-line use also supports multi-line PD-code files:

python -m cpp_pd_code_simplify_interface --pd-file inputs.pd --max-paths 100

Build And Publish

From this directory:

poetry build
poetry publish

Use poetry publish --build to build and upload in one command.

For local testing:

poetry run python -m cpp_pd_code_simplify_interface "PD[]"

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

cpp_pd_code_simplify_interface-0.1.1.tar.gz (21.1 kB view details)

Uploaded Source

Built Distribution

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

File details

Details for the file cpp_pd_code_simplify_interface-0.1.1.tar.gz.

File metadata

File hashes

Hashes for cpp_pd_code_simplify_interface-0.1.1.tar.gz
Algorithm Hash digest
SHA256 bf5a36080a33f37879bd2099dd61c3683bc658b111b7137d49eca280e94b5ced
MD5 aa4eb029a04e58fa807682a682b486c2
BLAKE2b-256 78eacecdf246bb4ec0b40057da9a064d2a167f3fd90b77b84e1cfe888dfa38d4

See more details on using hashes here.

File details

Details for the file cpp_pd_code_simplify_interface-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for cpp_pd_code_simplify_interface-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0982ee3eb2c3b0d6faf39624143a4d2b011f7443142d00c40af9159ee37b5de3
MD5 7863d2f8d7ea0bee0cc57a0279c6da0b
BLAKE2b-256 34aa624d75fca8321afccb72677f76c231cd5efacfa94073875d02be03a5eaf6

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