This guide collects the installation, verification, and C extension build details that were previously embedded in the main README.
This package has been tested only on Linux and macOS.
To install just the package for use:
pip install -e .To install the package and run tests:
pip install -e ".[test]"
python run_tests.pyFor convenience, you can install and test in one step:
python install_and_test.pyTo verify installation and see basic usage:
python getting_started.pyThe package includes automatic post-installation verification that runs regression tests during pip install. You can also verify manually:
from combinatorial_codes import verify_installation
verify_installation()This verification covers:
- package imports and C extension detection
- computational correctness using reference examples
- performance benchmarking of key operations
- verification of
add_empty_word()
The verification typically takes 4-6 seconds.
This package includes optional C extensions for performance-critical operations. The package still works without them, but large computations will be slower.
Linux or macOS:
# Ubuntu/Debian
sudo apt-get install build-essential python3-dev
# CentOS/RHEL
sudo yum groupinstall "Development Tools"
sudo yum install python3-devel
# macOS
xcode-select --installThe C extensions are compiled automatically during installation.
If compilation fails, the package falls back to Python or Numba implementations. You can inspect the status with:
from combinatorial_codes import check_c_extension_status
check_c_extension_status()No module named 'combinatorial_codes.translated_functions'
- The C extension did not compile.
- Install the required build tools for your platform.
- Make sure Python development headers are available.
clang: error: unsupported option
- Update the Xcode command line tools with
xcode-select --install. - Confirm that your Python version is compatible with the local toolchain.
Cross-platform moves:
- C extensions are built for a specific Python version and architecture.
- If you move the repo between systems, reinstall the package:
pip uninstall combinatorial_codes
pip install -e .- With C extensions: roughly 5-10x faster on large codes
- Without C extensions: slower, but still functional through Numba JIT compilation
To force a rebuild of the extensions:
pip install -e . --force-reinstall --no-depsRun all tests:
python run_tests.py
pytest tests/ -vRun only the key example tests:
python run_tests.py --milo