Skip to main content

r4py

R, ready to roll.

A complete R runtime in a Python wheel.

PyPI Python 3.10+ R 4.6.2 Wheels Platforms Licenses: MIT and GPL-2.0-or-later

No system R installation. No runtime dependencies on Python packages. No downloads on import. No changes to your process environment.

Install

pip install r4py

Wheels contain R 4.6.2, base and recommended packages, libR, headers, help files, and R CMD tools. The Windows wheel omits the CRAN uninstaller and combined reference-manual PDF; individual package help and manuals remain included. Version 4.6.2.2 means R 4.6.2, packaging revision 2.

The release workflow targets:

Platform Architectures
Linux, glibc 2.28+ x86-64, ARM64
macOS 15+ Intel, Apple Silicon
Windows 10+ x86-64

Linux wheels are repaired with auditwheel; macOS wheels with delocate. Alpine/musl and Windows ARM64 are not supported. Python 3.10+ is required.

Python

from subprocess import run
from r4py import R, R_HOME, R_VERSION, RSCRIPT

print(R_HOME)  # pathlib.Path to the bundled R installation
print(R_VERSION)  # (4, 6, 2)

run([RSCRIPT, "--vanilla", "-e", "cat(mean(1:10))"], check=True)
run([RSCRIPT, "analysis.R", "input.csv"], check=True)
run([R, "CMD", "config", "CC"], check=True)

The executables locate their own runtime, even if the environment is moved. To override a system R environment or configure a child process:

from r4py import get_env

run(
    [RSCRIPT, "--vanilla", "-e", "cat(R.home())"],
    env=get_env({"R_LIBS_USER": "/path/to/my/R/library"}),
    check=True,
    capture_output=True,
    text=True,
)

get_env() copies os.environ, applies your overrides, then sets the bundled R home, include, share, and documentation paths. It removes inherited R sub-architecture and R loader overrides. It never changes os.environ.

This is a runtime distribution, not a Python-to-R object bridge. Use subprocesses, files, or an independently installed bridge such as rpy2.

Command line

r4py --vanilla -e 'cat(mean(1:10))'
r4py analysis.R input.csv
python -m r4py --vanilla -e 'cat(R.version.string)'
r4py-r                         # interactive R
r4py-r CMD config CC

r4py runs Rscript. r4py-r runs R. Arguments, standard streams, and exit codes are passed through. The launchers do not silently select a system R. R startup files behave normally; use --vanilla for isolated execution.

R packages

Recommended packages, including Matrix, MASS, survival, and lattice, are already included. Install additional packages into a writable library outside the wheel:

r4py --vanilla -e 'lib <- path.expand("~/r4py-library"); dir.create(lib, recursive=TRUE, showWarnings=FALSE); install.packages("jsonlite", lib=lib, repos="https://cloud.r-project.org")'

Set R_LIBS_USER to that directory for subsequent runs. Package installation uses the network. Unix wheels include a CA certificate bundle so HTTPS downloads do not depend on the build machine's certificate paths; set CURL_CA_BUNDLE to use your own PEM certificate bundle. Compiling source packages requires native build tools and any package-specific system libraries; Windows uses Rtools. R CMD config also requires make on Unix. These tools are not bundled. Neither RStudio nor a desktop GUI is included. Headless PDF and PNG graphics are supported.

Build and test

uv sync --no-install-project
uv run --no-sync ruff check .
uv run --no-sync pyright
uv run --no-sync pytest -m 'not runtime'
uv run --no-sync python build_r_runtime.py
uv build --wheel

Unix builds need a C/C++/Fortran toolchain, make, tar, a CA certificate bundle, and development files for curl, bzip2, xz, zlib, PCRE2, ICU, readline, Cairo, PNG, JPEG, and TIFF. For example, use the manylinux container recipe in the wheel workflow. --jobs N controls compilation parallelism. --source-archive PATH uses a local tarball with the same pinned SHA-256 verification.

On Windows, or to reuse a native R installation:

uv run --no-sync python build_r_runtime.py --runtime /path/to/R/home

The builder checks the R version, copies the installation, and makes the Unix launchers relocatable. It refuses to overwrite an existing runtime. Wheel builds fail if the runtime is missing or the R version does not match. Source distributions contain build tooling, not R.

Local builds inherit the host's OS and library requirements. On Unix, repair the wheel before distributing it; the release workflow does this automatically. For a local Linux build:

AUDITWHEEL_LD_LIBRARY_PATH="$PWD/src/r4py/r-runtime/lib" \
  uvx --from auditwheel --with patchelf auditwheel repair --strip \
  -w wheelhouse dist/r4py-*.whl
uv run --no-sync pytest
R4PY_REQUIRE_RUNTIME=1 uv run --no-sync pytest -m runtime
uv run --no-sync python tests/smoke_wheel.py wheelhouse/r4py-*.whl

Without a built runtime, integration tests skip. Release CI requires them, installs each repaired wheel in a path with spaces, hides the original runtime, and tests R execution, recommended native packages, graphics, R CMD on Unix, user-library package installation, and exit codes.

Licensing

r4py's Python code is MIT licensed. Bundled R is GPL-2.0-or-later; its packages and linked libraries retain their own licenses. Do not treat the wheel as MIT-only. The Unix wheel recipes retain dependency license notices and the exact RPM or Homebrew source-package inventory.

R source: R-4.6.2.tar.gz (SHA-256 c297040f6392b1dac6e5c0eb398422cfdaedf540ae2205edb9ad0d10cb10ee00). The build script contains the launcher modifications and is also included in the bundled runtime. Preserve R's COPYING and package notices when redistributing. Binary redistribution must comply with R and dependency source-distribution requirements; linking or embedding R may impose further GPL obligations.

The logo included in the source distribution combines the Python two-snakes device, a trademark of the Python Software Foundation, with the R logo, copyright 2016 The R Foundation. The R artwork and composite arrangement are CC BY-SA 4.0; the R artwork is scaled and layered with the Python device. The Python device retains its original shape and colors and remains subject to the PSF trademark usage policy. Neither foundation's endorsement is implied.

Releases and PyPI

Release each supported stable R version separately: r4py 4.6.2.2 and tag v4.6.2.2 bundle R 4.6.2, with packaging revision 2. Packaging-only fixes increment the fourth component. Keep previous releases available so users can pin their R runtime.

For the first PyPI upload, add a pending publisher at PyPI account publishing:

Field Value
PyPI project name r4py
Repository owner JGalego
Repository name r4py
Workflow filename wheels.yml
Environment name pypi

The workflow's display name is Wheels, but PyPI needs its filename, wheels.yml, without the .github/workflows/ prefix. No PyPI API token is needed.

A release tag builds and tests the source distribution and five wheels without publishing. Once trusted publishing is configured and the release's corresponding source materials are available, run Wheels manually on that tag with publish enabled:

gh workflow run wheels.yml --ref v4.6.2.2 -f publish=true

Publishing uses the pypi GitHub environment. Add required reviewers if the repository's billing plan supports them; otherwise the explicit manual publish input is the release gate. Before publishing, verify third-party notices and make the exact corresponding sources for R and bundled dependencies available alongside the binaries.

Metadata

Release files for r4py 4.6.2.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for r4py 4.6.2.2
File Size Uploaded Provenance Actions
r4py-4.6.2.2.tar.gz 32.2 kB With provenance Details for r4py-4.6.2.2.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for r4py 4.6.2.2
File Actions
r4py-4.6.2.2-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for r4py-4.6.2.2-py3-none-win_amd64.whl
r4py-4.6.2.2-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for r4py-4.6.2.2-py3-none-manylinux_2_28_x86_64.whl
r4py-4.6.2.2-py3-none-manylinux_2_28_aarch64.whl Python 3 none Linux glibc 2.28+ ARM64 Details for r4py-4.6.2.2-py3-none-manylinux_2_28_aarch64.whl
r4py-4.6.2.2-py3-none-macosx_15_0_x86_64.whl Python 3 none macOS 15.0+ x86-64 Details for r4py-4.6.2.2-py3-none-macosx_15_0_x86_64.whl
r4py-4.6.2.2-py3-none-macosx_15_0_arm64.whl Python 3 none macOS 15.0+ ARM64 Details for r4py-4.6.2.2-py3-none-macosx_15_0_arm64.whl

Total release size: 428.5 MB

Release files / r4py-4.6.2.2.tar.gz

Download URL r4py-4.6.2.2.tar.gz
Size 32.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e9745f1d114e455d24030621777e57f901cdbb71cd98ff7950018261cb5d751f
BLAKE2b-256 checksum
How to use checksums
5355416f667d3e3db313fadaf56eaa0ec97755f3be36f1380b1d545159a90fd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.2-py3-none-win_amd64.whl

Download URL r4py-4.6.2.2-py3-none-win_amd64.whl
Size 99.1 MB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
d88e527c5f4d16b2b622f3c80a5872ee860c5413d5c579c040344cda0b416cf3
BLAKE2b-256 checksum
How to use checksums
7396a556707dab175380ff5ee34f61f67e915d660df23329f9b568fdbfd1f0ae
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.2-py3-none-manylinux_2_28_x86_64.whl

Download URL r4py-4.6.2.2-py3-none-manylinux_2_28_x86_64.whl
Size 82.2 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
946f976f641c584ecb8bd630f28248af7b4683a9e9e415523cb23208c441ffd7
BLAKE2b-256 checksum
How to use checksums
58d75de4831aac15f1be3df3e25e51ad6c49ee5f4ba6e9b97bcc1df471adc52a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.2-py3-none-manylinux_2_28_aarch64.whl

Download URL r4py-4.6.2.2-py3-none-manylinux_2_28_aarch64.whl
Size 80.6 MB
Tags Linux glibc 2.28+ ARM64 Python 3
SHA-256 checksum
How to use checksums
ee1409d352b5475412799753515a45e6fdbeb3b0a89393ecb2d325425647df74
BLAKE2b-256 checksum
How to use checksums
0db55c955a5382787202d0834e422823d9627232f397c77ca2cb0fac66521bf1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.2-py3-none-macosx_15_0_x86_64.whl

Download URL r4py-4.6.2.2-py3-none-macosx_15_0_x86_64.whl
Size 84.1 MB
Tags Python 3 macOS 15.0+ x86-64
SHA-256 checksum
How to use checksums
1cb2698901e375907634f28f41968d8899cebc5489bb7bc0eda4addd2e6e0f29
BLAKE2b-256 checksum
How to use checksums
bd78929636bbf1aed705698208819dbf513c226a96d723388f71ee1e134f9635
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Release files / r4py-4.6.2.2-py3-none-macosx_15_0_arm64.whl

Download URL r4py-4.6.2.2-py3-none-macosx_15_0_arm64.whl
Size 82.3 MB
Tags Python 3 macOS 15.0+ ARM64
SHA-256 checksum
How to use checksums
db9f9597d150d505150d7d0c6d227e0daa078e848022aec43fb2bc124c7c58d3
BLAKE2b-256 checksum
How to use checksums
e0767a7f69ba858e7d382f1f5f6fd1ffebfd9b49ff5bebd4120637f9944dc3fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

Security for r4py 4.6.2.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 6 files in this release have been uploaded with provenance metadata.

Select from 6 files

Attestation for r4py-4.6.2.2.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page