A python interface to vinecopulib
Project description
pyvinecopulib
Introduction
What are vine copulas?
Vine copulas are a flexible class of dependence models consisting of bivariate building blocks (see e.g., Aas et al., 2009). You can find a comprehensive list of publications and other materials on vine-copula.org.
What is pyvinecopulib?
pyvinecopulib is the python interface to vinecopulib, a header-only C++ library for vine copula models based on Eigen. It provides high-performance implementations of the core features of the popular VineCopula R library, in particular inference algorithms for both vine copula and bivariate copula models. Advantages over VineCopula are
- a stand-alone C++ library with interfaces to both R and Python,
- a sleaker and more modern API,
- shorter runtimes and lower memory consumption, especially in high dimensions,
- nonparametric and multi-parameter families.
License
pyvinecopulib is provided under an MIT license that can be found in the LICENSE file. By using, distributing, or contributing to this project, you agree to the terms and conditions of this license.
Contact
If you have any questions regarding the library, feel free to open an issue or send a mail to info@vinecopulib.org.
Installation
With pip
The latest release can be installed using pip:
pip install pyvinecopulib
With conda
Similarly, it can be installed with conda:
conda install conda-forge::pyvinecopulib
Or with mamba:
mamba install conda-forge::pyvinecopulib
From source
Start by cloning this repository, noting the --recursive option which is needed for the vinecopulib and wdm submodules:
git clone --recursive https://github.com/vinecopulib/pyvinecopulib.git
cd pyvinecopulib
The main build time prerequisites are:
- scikit-build-core (>=0.4.3),
- nanobind (>=2.7.0),
- a compiler with C++17 support.
To install from source, Eigen and Boost also need to be available, and CMake will try to find suitable versions automatically.
The recommended way to install pyvinecopulib from source is to use conda or mamba.
A reproducible environment, also including requirements for the pyvinecopulib's development and documentation, can be created using:
python scripts/generate_requirements.py --format yml # from pyvinecopulib's root
mamba env create -f environment.yml
mamba activate pyvinecopulib
Alternatively, you can specify manually the location of Eigen and Boost using the environment variables EIGEN3_INCLUDE_DIR and Boost_INCLUDE_DIR respectively.
On Linux, you can install the required packages and set the environment variables as follows:
sudo apt-get install libeigen3-dev libboost-all-dev
export Boost_INCLUDE_DIR=/usr/include
export EIGEN3_INCLUDE_DIR=/usr/include/eigen3
Finally, you can build and install pyvinecopulib using pip:
pip install .
Stubs and documentation can then be generated using the custom scripts:
python scripts/generate_metadata.py --env pyvinecopulib
Or use the Makefile for convenience:
make metadata # Generate all (stubs, docstrings, examples)
make stubs # Generate type stubs only
make docstrings # Generate C++ docstrings only
Note that the generate_requirements.py script can also be used to generate a requirements.txt file for use with pip via the --format option:
python scripts/generate_requirements.py --format txt
Building the documentation
Documentation for the example project is generated using Sphinx and the "Read the Docs" theme. The following command generates HTML-based reference documentation; for other formats please refer to the Sphinx manual:
cd docs
python serve_sphinx.py
Development
This project includes comprehensive development tools including pre-commit hooks and a Makefile to streamline development workflow.
Quick Development Setup
-
Clone and setup environment:
git clone --recursive https://github.com/vinecopulib/pyvinecopulib.git cd pyvinecopulib make env-conda # Create conda environment conda activate pyvinecopulib # Activate environment
-
Setup development tools:
make dev-setup # Install dependencies and pre-commit hooks
-
Development workflow:
make quick-check # Run fast checks (lint, type-check, test) make check-all # Run comprehensive checks before commit
Development Commands
Use make help to see all available commands. Key commands include:
| Command | Description |
|---|---|
make install-dev |
Install development dependencies |
make test |
Run all tests |
make test-fast |
Run tests without coverage |
make test-examples |
Run example notebooks |
make lint |
Run code linting with ruff |
make format |
Format code with ruff |
make type-check |
Run type checking with mypy |
make docs |
Build documentation |
make docs-serve |
Serve documentation locally |
make clean |
Clean build artifacts |
make stubs |
Generate type stubs (custom script) |
make docstrings |
Generate C++ docstrings |
make metadata |
Generate all metadata (stubs, docstrings, examples) |
make examples |
Process and execute example notebooks |
make clear-cache |
Clear Python cache files |
Pre-commit Hooks
Pre-commit hooks automatically run code quality checks before each commit:
- Ruff: Python linting and code formatting
- MyPy: Type checking with project configuration
- Clang-format: C++ code formatting (src/ directory only)
- CMake-format: CMake file formatting
- General hooks: Trailing whitespace, YAML/TOML validation, etc.
Install hooks with:
make pre-commit-install
Run manually on all files:
make pre-commit
Development Workflow
-
Start new feature/fix:
git checkout -b feature/my-feature
-
During development (run frequently):
make quick-check # Fast feedback loop
-
Before committing:
make check-all # Comprehensive quality checks git add . git commit -m "Add new feature" # Pre-commit hooks run automatically
Code Style Guidelines
- Python: Follow PEP 8, enforced by ruff
- C++: Follow Google style guide, enforced by clang-format
- Type hints: Required for all Python code
- Documentation: Use docstrings for all public functions
Testing
- All tests:
make test - Fast tests:
make test-fast(for quick development feedback) - Example notebooks:
make test-examples - Performance benchmarks:
make benchmark
Environment Management
The project uses conda for environment management. The Makefile automatically detects conda environments:
make env-conda # Create new environment
conda activate pyvinecopulib # Activate environment
make env-update # Update existing environment
make update-deps # Update dependency files
Release Process
Before releasing, run comprehensive checks:
make release-check
This ensures all tests pass, documentation builds correctly, and examples work.
Troubleshooting
- Build issues:
make debug-build - Installation issues:
make debug-install - Project status:
make status - Clean everything:
make git-clean(⚠️ destructive)
Development Tips
- Use
make quick-checkfrequently during development for fast feedback - Pre-commit hooks automatically fix many formatting issues
- Run
make check-allbefore pushing changes to ensure quality
- Use
make metadatato regenerate stubs and docstrings after C++ changes - The project uses custom scripts in
scripts/for stub generation (not nanobind's default)
- Keep commits focused and write clear commit messages
- Add tests for new functionality
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyvinecopulib-0.7.5.tar.gz.
File metadata
- Download URL: pyvinecopulib-0.7.5.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b964b921ec8bc40526530a78ebce4875e2682e0efa1571de92d2573e8519cca0
|
|
| MD5 |
30f47ffb509d936ab317b45fc1969b78
|
|
| BLAKE2b-256 |
3870d6dd90017e46c6fc6a17a2a0d657391cd6765f10110ddfaa0616b21bc057
|
File details
Details for the file pyvinecopulib-0.7.5-cp312-abi3-win_amd64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp312-abi3-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.12+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6af25935a5342c330dc1793c22802b02df0cee620765b25c0fc117cb9833046d
|
|
| MD5 |
dde579826403d638add7d87ce96c5817
|
|
| BLAKE2b-256 |
5e24540a0898eecaea67adf2c4761eb1c99572f531e0ec6ccc762de2165852d9
|
File details
Details for the file pyvinecopulib-0.7.5-cp312-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp312-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.12+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c5825cdd407d4c48ae622bf55cd34e70b750e9323b1a1ad485ba0a7b09e8877
|
|
| MD5 |
0e637cc04d2d9e331d8ebba19d38f3a7
|
|
| BLAKE2b-256 |
9cb67cd8d6d1b539e82a594fb1e47d9fbb94ef97af2f721b0ed690f5277504d2
|
File details
Details for the file pyvinecopulib-0.7.5-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.12+, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01bef6e27ffd453c159ca16f35dddffc2234c2211dc6cbd547cd50713a5b6b55
|
|
| MD5 |
9b8a64081e0b0db00d9369028a3d54c7
|
|
| BLAKE2b-256 |
f221702cd8e9681c85bbcffa7963301f3b3ee6c16a3ed4b4bfc21e1018f96913
|
File details
Details for the file pyvinecopulib-0.7.5-cp312-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp312-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.12+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
217519b9e1241a1c3a06e16387cd0184da7fb3d767719c75d385bb29a0fa64e9
|
|
| MD5 |
2d8c00aa85d184ae1a104447382a53d1
|
|
| BLAKE2b-256 |
62fe750f2cff82548c9c9c0ce57ea48bed5e9d04737f83002aba73d80626419f
|
File details
Details for the file pyvinecopulib-0.7.5-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f65a693451f1045bc5195812ffee4aaa05a2737658d45e3b6249482a26c2e632
|
|
| MD5 |
13c86392b9e1a0205dbb424171cf1732
|
|
| BLAKE2b-256 |
6a951dbb95e4778fe2586eb400764f7d593f880b567f19185d86a3601881426f
|
File details
Details for the file pyvinecopulib-0.7.5-cp311-cp311-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp311-cp311-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.11, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
da5c6778a6b65af05004bc093155c7376132ef2abf52fee7cc89ec1960d42ddd
|
|
| MD5 |
6d1eb281495256267d678a4c4cd0ec30
|
|
| BLAKE2b-256 |
5923eeda2db6dc240a058266e687131563f47e35819a75ee9dc84b20d04a4009
|
File details
Details for the file pyvinecopulib-0.7.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.11, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
779d66f47f7f51a3c375d51782536b5932c9afdac42b7fe5355ff50f27415f48
|
|
| MD5 |
c3ee7c4a1cc729b14cca45255c0fff23
|
|
| BLAKE2b-256 |
d7b04d1b7aa65064fb0eac7c99c8522a51548f8abe0667fd56778f1bbd9ca00d
|
File details
Details for the file pyvinecopulib-0.7.5-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e07dc0734affd027ad1d3b714f5c45ed880a0c7a4c9b5304361b6be04c5ae3f5
|
|
| MD5 |
fac25b3ba0085dcdb1f4d9f61bb5c9fb
|
|
| BLAKE2b-256 |
fdbd23ebbb56f4fb24685cd37d73dfbccb6d61eb198a874bfe2cc420b8e64765
|
File details
Details for the file pyvinecopulib-0.7.5-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d8af26d4f4479584fc32caf73dad22569a8bcc5ffafbfa9a9c6f217e214175f
|
|
| MD5 |
3147ea5459261eca071a9f94edc3f412
|
|
| BLAKE2b-256 |
530cf932a88085ad33278d7e0e189e94ea0eaf21f619cc9030e89b06ada67e0f
|
File details
Details for the file pyvinecopulib-0.7.5-cp310-cp310-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp310-cp310-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.10, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a133f8d8cdb6a9c8e4937cc8f0f87d0747d9f8f338aad97ac2d450733a35bc5d
|
|
| MD5 |
95acec3ac6fa23df16b234971558fb51
|
|
| BLAKE2b-256 |
8025815f8992792486075d1d4bdbe302a26dda138da383e58b0f6cf46cf6beb9
|
File details
Details for the file pyvinecopulib-0.7.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.10, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
771164ea78f2a2f27b883e827a899f7757ab002333bab1040399d61b049ddcc9
|
|
| MD5 |
c7c21f055dbeada0c994da9db4c74588
|
|
| BLAKE2b-256 |
9591591e7dc6a83cd8aa0cd5b69b08ed76c2f695e8e810a16724c9c5b9732ea1
|
File details
Details for the file pyvinecopulib-0.7.5-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39e96d3c8947fdbc421a24bae2a6e84770ddd215e2adc028d8333f074427bd69
|
|
| MD5 |
fe34deb116bcee8c7f7a901c05b6504e
|
|
| BLAKE2b-256 |
01e25e6fb225af8539dd45815c19b8845187bb4434406942aacccafdf1e3a7bc
|
File details
Details for the file pyvinecopulib-0.7.5-cp39-cp39-win_amd64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
32ce79851de3d7754c3c939189bc3323f0dc0112c2599049440779ae805a9b4a
|
|
| MD5 |
3fdf9f19c444d9345e2eb12039aaa24c
|
|
| BLAKE2b-256 |
815d3dc615814b62162f5c143c9047289286955307441cb51eea49e96ceec627
|
File details
Details for the file pyvinecopulib-0.7.5-cp39-cp39-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp39-cp39-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.9, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7fdecf08412e55b30543c167f721ef48b41bc3ff2e27cd396d4072e58834a379
|
|
| MD5 |
9e13c062b586f2b6c68517c7ae65cba9
|
|
| BLAKE2b-256 |
5c2ea068b7fcf558f99867a18c5e91f7a0034bd7e6d2755cb39ead68c840c6cf
|
File details
Details for the file pyvinecopulib-0.7.5-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
- Upload date:
- Size: 1.6 MB
- Tags: CPython 3.9, manylinux: glibc 2.27+ x86-64, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4830bfe59882e8fee735e4d9f49193a0604a1ce2a12f271ffa96f994682495a
|
|
| MD5 |
b4108e59be0cf077b182ae9a75700f79
|
|
| BLAKE2b-256 |
4ecc2bd1f5de7fd357958d82e6ac2b093e1a085e8f098fff7bef4538b270484a
|
File details
Details for the file pyvinecopulib-0.7.5-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyvinecopulib-0.7.5-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.5 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
075b07d0ea7a0a907ea05556b76ebc562c8d5717c5136d69bad0cccce098ac59
|
|
| MD5 |
e10d593509cb2b07da91ba4e951ce455
|
|
| BLAKE2b-256 |
d6b578e078b57d242d2b8d5fe2bf4d02c4a153ab87aebe5bac233b20f5362bc3
|