Skip to main content

Python interface to the CLP Core Features through CLP's FFI

Project description

clp-ffi-py

This module provides Python packages to interface with CLP Core Features through CLP's FFI (foreign function interface). At present, this library supplies built-in functions for encoding/decoding log messages using CLP.

Compatibility

Tested on Python 3.8, 3.9 and 3.10, and it should work on any Python version >= 3.6.

Building/Packaging

To manually build a package for distribution, run the following steps. This process will generate both .tar.gz package and .whl package under ./dist/ directory.

# 1. Create and enter a virtual environment
python -m venv venv && . ./venv/bin/activate

# 2. Install development dependencies
pip install -r requirements-dev.txt

# 3. Pull all submodules in preparation for building
git submodule update --init --recursive

# 4. Build
python -m build

Testing

# 1. Create and enter a virtual environment
python -m venv venv && . ./venv/bin/activate

# 2. Install development dependencies
pip install -r requirements-dev.txt

# 3. Pull all submodules in preparation for building
git submodule update --init --recursive

# 4. Install
pip install -e .

Build and Test with cibuildwheel

This project utilizes cibuildwheel configuration. Whenever modifications are made and committed to GitHub, the cibuildwheel Action will automatically initiate, building this library for several Python environments across diverse OS and architectures. You can access the build outcomes (wheel files) via the GitHub Action page. For instructions on customizing the build targets or running cibuildwheel locally, please refer to the official documentation of cibuildwheel.

Contributing

Before submitting a pull request, run the following error-checking and formatting tools (found in [pyproject.toml]):

  • mypy: mypy clp_ffi_py
    • mypy checks for typing errors. You should resolve all typing errors or if an error cannot be resolved (e.g., it's due to a third-party library), you should add a comment # type: ignore to silence the error.
  • Black: black clp_ffi_py
    • This formats the Python code according to Black's code-style rules. You should review and add any changes to your PR.
  • clang-format: clang-format -i src/clp_ffi_py/**
    • This formats the C++ code according to the code-style rules specified in .clang-format. You should review and add any changes to your PR.

Additionally, the following tools can be useful during development. However, they cannot be installed using pip. Developers need to install them using other package management tools such as apt-get:

  • clang-tidy: clang-tidy --extra-arg=-std=c++17 PATH_TO_THE_FILE
    • This static analysis tool catches improper coding behaviors based on the rules specified in .clang-tidy, and sends suggestions corresponding to each warning. Developers should manually review all the warnings and try with their best effort to fix the reasonable ones.
  • bear: bear python setup.py build
    • This tool generates a JSON compilation database on the project's root directory named compile_commands.json. This file will be used by clang-tidy to execute the static analysis. It also helps IDEs to configure code completion (such as VSCode).

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

clp_ffi_py-0.0.0b1.tar.gz (253.9 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page