Skip to main content

A python interface to vinecopulib

Project description

pyvinecopulib

Documentation License: MIT Build Status DOI

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

  1. 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
    
  2. Setup development tools:

    make dev-setup                    # Install dependencies and pre-commit hooks
    
  3. 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

  1. Start new feature/fix:

    git checkout -b feature/my-feature
    
  2. During development (run frequently):

    make quick-check                  # Fast feedback loop
    
  3. 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-check frequently during development for fast feedback
  • Pre-commit hooks automatically fix many formatting issues
  • Run make check-all before pushing changes to ensure quality
  • Use make metadata to 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


Download files

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

Source Distribution

pyvinecopulib-0.7.6.tar.gz (3.2 MB view details)

Uploaded Source

Built Distributions

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

pyvinecopulib-0.7.6-cp312-abi3-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.12+Windows x86-64

pyvinecopulib-0.7.6-cp312-abi3-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.12+musllinux: musl 1.2+ x86-64

pyvinecopulib-0.7.6-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyvinecopulib-0.7.6-cp312-abi3-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12+macOS 11.0+ ARM64

pyvinecopulib-0.7.6-cp311-cp311-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.11Windows x86-64

pyvinecopulib-0.7.6-cp311-cp311-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.11musllinux: musl 1.2+ x86-64

pyvinecopulib-0.7.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyvinecopulib-0.7.6-cp311-cp311-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

pyvinecopulib-0.7.6-cp310-cp310-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.10Windows x86-64

pyvinecopulib-0.7.6-cp310-cp310-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.10musllinux: musl 1.2+ x86-64

pyvinecopulib-0.7.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyvinecopulib-0.7.6-cp310-cp310-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

pyvinecopulib-0.7.6-cp39-cp39-win_amd64.whl (1.4 MB view details)

Uploaded CPython 3.9Windows x86-64

pyvinecopulib-0.7.6-cp39-cp39-musllinux_1_2_x86_64.whl (2.1 MB view details)

Uploaded CPython 3.9musllinux: musl 1.2+ x86-64

pyvinecopulib-0.7.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

pyvinecopulib-0.7.6-cp39-cp39-macosx_11_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

File details

Details for the file pyvinecopulib-0.7.6.tar.gz.

File metadata

  • Download URL: pyvinecopulib-0.7.6.tar.gz
  • Upload date:
  • Size: 3.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for pyvinecopulib-0.7.6.tar.gz
Algorithm Hash digest
SHA256 d3823a825c3cb3998d516f4b160181c2971cb419ddcdc6511303ccc86ee61992
MD5 0b139e98750c92f8e8bfb7753bc531aa
BLAKE2b-256 d86bcfd84cbad1455b74f09bf4b7fc1d74664677635e341d1db9eb9dfe149c51

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp312-abi3-win_amd64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 79f656a9c76cfa2cc57a8be3f5039a71f9a4068a2374bc2dfd1a9e050301d8f9
MD5 b1ccbff004d78ad8322a67b1ed7eacd7
BLAKE2b-256 7479b66076da7731ee716b066adba5f8dc155261f25e2478aba39e8fea9b319a

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp312-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 db7c83a28bce5e91e65fb0d426e43b5344302a61361edfc2710545dc6d880d6e
MD5 fcdad079d704c8dc2897565374ca6ef9
BLAKE2b-256 8c6dbde5fbe2f7c1d7703d4bdf37c2a5a40ddcd6f8e40866c7bd6d4b882eb446

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a3f511ac467bef00169a279c20fab42aae11a768f53ab0f23b3b6533600d66c6
MD5 4f5c9059aff92dead08d1bdef9ecb50c
BLAKE2b-256 1cae3e40e2b718b44e3784a5fb9f30eb809dcb0e6426f7c5aac57857d1d8fd42

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp312-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp312-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 af02aac146209d7872eaa8988d79a73ab0f4ce68d299111cc1f61455de7e91f8
MD5 692dcee76132d791bd1657d9966b70bb
BLAKE2b-256 39c4917c9cd6e5de7e34796e992345aa2fdbe2e1a06bca2490d3d429280deb44

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 1683cf1078e0baca8bc0d68691c6396cbc20bec3f064fba7ca1af1c3c9c42d7e
MD5 7f8b937b4d1cb5c4e40519829d70bd55
BLAKE2b-256 60ffba8451d5ff1fcd35bc17d50f2b5da9c1315ae1af26247f98d478ed0ab92b

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp311-cp311-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 28435a8e81d381a359955744148fbd865b300b729d110a14441a9ac3ef5c1e52
MD5 1018ed71084523fe37e0188642ea23c6
BLAKE2b-256 09ea7ab962340f055ae43f5a09686677db9cf65d1db712183d1273a6e0e012ab

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp311-cp311-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 85c23e3a8f4879f58818b9849edead3aa567bbb4e97488c6ed7d08692b89e634
MD5 a77c3a59dee59e1dfa906fa174a161f7
BLAKE2b-256 11b7a15bfcc2534ddbb4370d0df6de01bf8b2b5c373816c587fdb30116709e1c

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f1f232794f8a63941c1b7182805144eff8590b94c2ac64e6c35bce8a89da4528
MD5 a5ef100cf545906e2bce36cf58f532d3
BLAKE2b-256 426fb70541ec5ae6117152b4d918a5f4da14dd86c78d6a9789bc134bed542670

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp310-cp310-win_amd64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 6a9014acc94075df36b054a7f20ec79add57c89b36ee60972aa20d2625e13317
MD5 d9d9fab6847fc4a1ee55fc107c899bd9
BLAKE2b-256 49e33b927d9f0df68d95bd8478e11707f3b5a007313bb0d8f4326ffe6435e424

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp310-cp310-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 c931e6459d545f18ce8b4dff3083c212892ae6e49ff75d96d21a4feca3062f54
MD5 1944aef6d602f8a0bb7b9d201818b3e1
BLAKE2b-256 266ee26d0e2828242091e9f5444e408a909e69b4d40952c6ddbe7bb41d68c12c

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp310-cp310-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9c964a7c1cc25d1abcb5d73db1f4ea84df4c68285c0f457da776732620e12337
MD5 d4d93f014b5c43897f35abff86872f8c
BLAKE2b-256 ed81400aecd859fff930da1a5cfe329befab375475f8f8c70697edb4077f5c1a

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4c6c2bf57260710c2e490756ebbdef908d66dbf1a274e648ebe3da8370218bb1
MD5 fd6306b0cad79ced5b33eea85cc225ae
BLAKE2b-256 dc4f23c00666d9fe53af67098821e24d90a3077d558b38f15118499da4f7fc64

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp39-cp39-win_amd64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 73e42fa5435733b4da4a7d3479b70344c62904ab0ecba0e2448058b26eb38eca
MD5 3c6125949967bb54c3e0efc94d95f2b2
BLAKE2b-256 32fdb0ff2b790367eeee6436a211f0f0c0e474e6b05cc7734c3eb6616cfd6199

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp39-cp39-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 a810ba23663fbd99bc3674a46dfe5b16e155151eab9958c3786d0c7367d5c336
MD5 ae57d654e96c68c6500e8e4655c9cbee
BLAKE2b-256 bfd72579f1104d401dcbeff85f5effc69276e8228e693b3ffa17a1dd9d560e03

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp39-cp39-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8f6151a12897175c554275b2edd3e314421784af4f1790f3b62ac7c091e60662
MD5 61560cc5be92ab1a9e86f7932931ce9c
BLAKE2b-256 1de4fe0a1364f10d11130b0d915c793b3630aec09a905a2ed5c99ed148184beb

See more details on using hashes here.

File details

Details for the file pyvinecopulib-0.7.6-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyvinecopulib-0.7.6-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ede470e7bfdf53ef131f93d07fb89bbc5898adc13c12d0f1a31bbf2c79cfdb36
MD5 7475d26beed1ea10b2a47c8a985d31ed
BLAKE2b-256 a53fa6b61773a06e056f79463a210d8127c5fcb09fd8940ad45c3d41eedaabf0

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