Skip to main content

Python bindings for Majorsilence Reporting — render RDL reports to PDF, Excel, HTML and more via an in-process native library or subprocess runner

Project description

Majorsilence Reporting — Python Wrappers

Python bindings for Majorsilence Reporting — a .NET RDL report engine. Renders RDL reports to PDF, Excel, CSV, HTML, RTF, TIFF, and more via an in-process native library (no .NET runtime required) or a subprocess-based .NET runner.

Platform-specific wheels bundle the prebuilt rdlnative shared library for Linux x64/arm64, Windows x64, and macOS arm64. On other platforms, point load_library() at your own build of rdlnative.


Quick Start

python -m venv .venv
source .venv/bin/activate   # Windows: .venv\Scripts\activate
pip install majorsilence-reporting
from majorsilence_reporting import load_bundled_library
from majorsilence_reporting.report_native import Report

lib = load_bundled_library()
rpt = Report(lib, "/path/to/report.rdl")
rpt.set_connection_string("Data Source=/path/to/database.db")
rpt.set_parameter("Country", "Germany")

# Export to file
rpt.export("pdf", "/path/to/output.pdf")

# Or export to bytes for HTTP streaming (Flask, Django, FastAPI, …)
data = rpt.export_to_memory("pdf")

Platform-specific wheels bundle the prebuilt rdlnative shared library — no extra downloads on Linux x64/arm64, Windows x64, or macOS arm64.


Wrappers

Three wrappers are provided for generating reports from Python. Pick the one that matches how you deploy the reporting engine:

Wrapper Mechanism Requires
majorsilence_reporting.Report subprocess → RdlCmd (.NET DLL) .NET runtime on the host
majorsilence_reporting.ReportAot subprocess → RdlCmd (self-contained or AOT binary) nothing extra
majorsilence_reporting.report_native.Report in-process ctypes FFI → rdlnative shared library nothing extra

Python 3.10 or later is required (union type hints X | Y are used throughout).

No pip packages are needed at runtime. All three wrappers use the Python standard library only.


Setup

Install Python

Python 3.10 or later is required.

  • Linux (Debian/Ubuntu):
    sudo apt-get update && sudo apt-get install -y python3 python3-pip python3-venv
    python3 --version
    
  • macOS (via Homebrew):
    brew install python
    python3 --version
    
  • Windows — download the installer from python.org and ensure "Add Python to PATH" is checked, or install via winget:
    winget install Python.Python.3.13
    python --version
    

Create a virtual environment (recommended)

python3 -m venv .venv

# Activate — Linux/macOS:
source .venv/bin/activate

# Activate — Windows (PowerShell):
.venv\Scripts\Activate.ps1

Install the package

From the repo root:

pip install -e .                   # editable install from source
# or
pip install -e ".[dev]"            # also installs pytest

Or without installing, add src/ to your sys.path:

import sys, os
sys.path.insert(0, '/path/to/reporting-python/src')

Option 1 — Report (subprocess, .NET runtime required)

Use this when you have the .NET runtime installed on the host and want to run RdlCmd.dll through dotnet.

from majorsilence_reporting import Report

rpt = Report(
    report_path    = "/path/to/report.rdl",
    rdl_cmd_path   = "/path/to/RdlCmd.dll",   # or RdlCmd.exe on Windows
    path_to_dotnet = "dotnet",                  # omit on Windows with a native exe
)
rpt.set_connection_string("Data Source=/path/to/northwindEF.db")
rpt.set_parameter("Country", "Germany")

# Export to a file
rpt.export("pdf", "/tmp/output.pdf")

# Export to memory (bytes for binary formats, str for text formats)
data = rpt.export_to_memory("pdf")

Windows

rpt = Report(
    report_path  = r"C:\reports\report.rdl",
    rdl_cmd_path = r"C:\RdlCmd\RdlCmd.exe",
)

Option 2 — ReportAot (subprocess, no runtime required)

Use this with an AOT-compiled or self-contained RdlCmd binary. No path_to_dotnet argument — the binary runs directly.

Download the appropriate binary from the release:

  • majorsilence-reporting-rdlcmd-aot-linux.ziplinux-x64/ or linux-arm64/
  • majorsilence-reporting-rdlcmd-aot-osx.ziposx-x64/ or osx-arm64/
  • majorsilence-reporting-rdlcmd-aot-windows.zipwin-x64/ or win-arm64/

Or use the self-contained (non-AOT) build from majorsilence-reporting-rdlcmd-self-contained.zip.

from majorsilence_reporting import ReportAot

rpt = ReportAot(
    report_path  = "/path/to/report.rdl",
    rdl_cmd_path = "/path/to/RdlCmd",   # RdlCmd.exe on Windows
)
rpt.set_connection_string("Data Source=/path/to/northwindEF.db")
rpt.set_parameter("Country", "Germany")

rpt.export("pdf", "/tmp/output.pdf")
data = rpt.export_to_memory("xlsx")

On Linux/macOS, make the binary executable:

chmod +x /path/to/RdlCmd

Option 3 — report_native.Report (in-process FFI, no subprocess)

Use this for the lowest overhead: the reporting engine runs inside the Python process via ctypes. No subprocess is spawned.

Download the native shared library from the release (majorsilence-reporting-rdlnative-linux.zip, -osx.zip, or -windows.zip) and extract it. The directory will contain the shared library and all its sibling libraries.

Platform Library filename
Linux librdlnative.so
macOS librdlnative.dylib
Windows rdlnative.dll
from majorsilence_reporting.report_native import load_library, Report

# Load once per process — pass the full path to the shared library.
# All sibling libraries in the same directory are loaded automatically.
lib = load_library("/path/to/librdlnative.so")

rpt = Report(lib, "/path/to/report.rdl")
rpt.set_connection_string("Data Source=/path/to/northwindEF.db")
rpt.set_parameter("Country", "Germany")

# Export to a file
rpt.export("pdf", "/tmp/output.pdf")

# Export to memory — returns bytes directly from the native buffer (no temp file)
data = rpt.export_to_memory("pdf")

load_library() sets RDLNATIVE_LIB_DIR and pre-loads sibling .so/.dylib files with RTLD_GLOBAL so that .NET's P/Invoke resolver can find them. Call it once at startup before creating any Report instances.


Supported export formats

All three wrappers accept the same format strings:

Format Description
pdf PDF (default if unrecognised format given)
csv Comma-separated values
xlsx Excel workbook
xlsx_table Excel workbook (table style)
xml XML
rtf Rich Text Format
tif TIFF image
tifb TIFF image (black & white)
html HTML
mht MHTML

Running the tests

The test suite (tests/test_report_native.py) covers report_native. It requires a published rdlnative shared library and is skipped automatically if the library is not found.

# Build the native library first (from the main Reporting repo)
dotnet publish RdlNative -c Release-DrawingCompat -r linux-x64 -f net10.0 \
    --self-contained true -p:PublishAot=true \
    -o /tmp/rdlnative-pub

# Run tests (set REPORTING_REPO_ROOT to the Reporting repo clone)
RDLNATIVE_LIB=/tmp/rdlnative-pub/librdlnative.so \
REPORTING_REPO_ROOT=/path/to/Reporting \
    python -m pytest -v

On macOS replace linux-x64 with osx-arm64 (or osx-x64) and librdlnative.so with librdlnative.dylib.


Examples

See the Examples/ subdirectory for runnable scripts:

  • test1.py — basic PDF export to file
  • test2-parameters.py — passing report parameters
  • test3-streaming.py — exporting to memory for streaming responses

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

majorsilence_reporting-26.0.1.tar.gz (18.3 kB view details)

Uploaded Source

Built Distributions

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

majorsilence_reporting-26.0.1-py3-none-win_amd64.whl (15.0 MB view details)

Uploaded Python 3Windows x86-64

majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_x86_64.whl (19.2 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_aarch64.whl (18.4 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

majorsilence_reporting-26.0.1-py3-none-macosx_11_0_arm64.whl (21.7 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

majorsilence_reporting-26.0.1-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file majorsilence_reporting-26.0.1.tar.gz.

File metadata

  • Download URL: majorsilence_reporting-26.0.1.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for majorsilence_reporting-26.0.1.tar.gz
Algorithm Hash digest
SHA256 e3bc17011d0dd4f4f488b057edc2247290f5ba994f492828acc7ef11385eee2e
MD5 0e5922cb45ef0634a55ced34fcd42dee
BLAKE2b-256 743cc827794d72debd65d335a0035bbb19813f8ae64ff9248cb423b08ebe74b6

See more details on using hashes here.

Provenance

The following attestation bundles were made for majorsilence_reporting-26.0.1.tar.gz:

Publisher: publish.yml on majorsilence/reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file majorsilence_reporting-26.0.1-py3-none-win_amd64.whl.

File metadata

File hashes

Hashes for majorsilence_reporting-26.0.1-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 40128b2fe0add51bfbe90332df0497fa6d7e3734c5695b32a113d3f7d9505fab
MD5 751518bcd170692019f9966e824194ba
BLAKE2b-256 e9b1a7dfa083fa36fe51ae85814b0f80fd37f26c85dfb00c880a9b6b900adc8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for majorsilence_reporting-26.0.1-py3-none-win_amd64.whl:

Publisher: publish.yml on majorsilence/reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 631d3ccb671401c5b45c8a21b8c91ab82a3e300ec243466b461b544c8fc06bab
MD5 641ef2694b619a61dc23d6634df43390
BLAKE2b-256 94ecf8d984d42f8e77b646a62875da0c42178c6dc27a925ae6f157adcc001574

See more details on using hashes here.

Provenance

The following attestation bundles were made for majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_x86_64.whl:

Publisher: publish.yml on majorsilence/reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_aarch64.whl.

File metadata

File hashes

Hashes for majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_aarch64.whl
Algorithm Hash digest
SHA256 feb96d3bc32c4da955c9f5561ba2f8a10c2489221bac820494933b818a738d40
MD5 db90352f18933f0e9e6eaf73270e1f18
BLAKE2b-256 06959b8efdb3b087a0a7040eccf02c348fefb4a1c7772836987ce2ae5c4f442d

See more details on using hashes here.

Provenance

The following attestation bundles were made for majorsilence_reporting-26.0.1-py3-none-manylinux_2_17_aarch64.whl:

Publisher: publish.yml on majorsilence/reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file majorsilence_reporting-26.0.1-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for majorsilence_reporting-26.0.1-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 55fae91e4204d7905b659395393832ea33645e84c905b9f2c37b2fed9509dce3
MD5 70dad636c6e16a89d4b735ad760a287b
BLAKE2b-256 d9a2b778d5992484e2707c5f35385e2c9336fa06625d76fb86cd56f1513f68d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for majorsilence_reporting-26.0.1-py3-none-macosx_11_0_arm64.whl:

Publisher: publish.yml on majorsilence/reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file majorsilence_reporting-26.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for majorsilence_reporting-26.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 63c7df201d90dd933671502b28535f74aff8b7fafcb2259205036d438351ec92
MD5 3de3aef3438072ac1b3d9d70e8383e83
BLAKE2b-256 4655428570f30e69b958bdad4178c7a328696282405de40742a912b6845c4bf2

See more details on using hashes here.

Provenance

The following attestation bundles were made for majorsilence_reporting-26.0.1-py3-none-any.whl:

Publisher: publish.yml on majorsilence/reporting-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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