This document provides guidance on how to get started with rawpy development and how to perform releases.
- Python: 3.11 or higher
- Git: For cloning the repository and submodules
- C/C++ Compiler:
- Linux: GCC
- macOS: Xcode Command Line Tools
- Windows: Visual Studio 2017 or higher
libraw-dev(optional, can also build from source via git submodules)pkg-configcmake(if building LibRaw from source)
- Xcode Command Line Tools
- LibRaw is built automatically as part of the build process
- Visual Studio 2017 or higher
- CMake is downloaded automatically during build
git clone https://github.com/letmaik/rawpy.git
cd rawpy
git submodule update --initThe git submodule update --init command clones the LibRaw library and related submodules into the external/ directory.
pip install -r dev-requirements.txtThis installs:
- Build dependencies:
wheel,cython,delocate(macOS) - Runtime dependencies:
numpy - Optional dependencies:
scikit-image - Test dependencies:
pytest,imageio,setuptools - Documentation dependencies:
sphinx,sphinx_rtd_theme
On Ubuntu/Debian:
sudo apt-get install libraw-dev
pip install -e .pip install -e .This will automatically:
- Build LibRaw from the git submodules
- Compile the Cython extension
- Install rawpy in editable mode
Note: On Linux, you may need to update the library cache:
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/99local.conf
sudo ldconfigpython -c "import rawpy; print(rawpy.__version__); print(rawpy.libraw_version)"The project uses GitHub Actions for building wheels across multiple platforms. To build locally:
# Inside manylinux container
.github/scripts/build-linux.sh.github/scripts/build-macos.sh.github/scripts/build-windows.ps1pytest test/pytest test/test_basic.pyAfter building wheels:
.github/scripts/test-linux.sh.github/scripts/test-macos.sh.github/scripts/test-windows.ps1sphinx-build -b html docs dist-docsThe generated HTML documentation will be in dist-docs/.
python -m http.server --directory dist-docs 8000Then open http://localhost:8000 in your browser.
rawpy/- Python package source code_rawpy.pyx- Cython wrapper around LibRaw_version.py- Version informationenhance.py- Bad pixel detection and repair functionality
external/- Git submodules for LibRaw and related librariestest/- Test files and test datadocs/- Sphinx documentation source.github/- GitHub Actions workflows and build scriptsworkflows/ci.yml- Main CI/CD workflowscripts/- Platform-specific build and test scripts
- Stable releases (e.g.,
0.25.0): Built against a stable LibRaw release - Pre-releases (e.g.,
0.25.0a1,0.25.0b1): Built against recent LibRaw snapshots
-
Update Version Number
Edit
rawpy/_version.py:__version__ = "X.Y.Z" # e.g., "0.26.0"
-
Update LibRaw Submodule (if needed)
cd external/LibRaw git fetch --tags git checkout 0.21.2 # or desired stable tag cd ../.. git add external/LibRaw
-
Commit Changes
git add rawpy/_version.py git commit -m "Release vX.Y.Z" -
Create and Push Tag
git tag vX.Y.Z # e.g., v0.26.0 git push origin main --tags -
Automated Build and Release
GitHub Actions will automatically:
- Build wheels for all supported platforms (Linux, macOS, Windows)
- Run tests on all platforms
- Build documentation
- Publish wheels to PyPI (if tests pass)
- Deploy documentation to GitHub Pages
Pre-releases follow the same process but use a pre-release version number:
-
Update Version Number
Edit
rawpy/_version.py:__version__ = "X.Y.Za1" # Alpha pre-release (e.g., "0.26.0a1") # or __version__ = "X.Y.Zb1" # Beta pre-release (e.g., "0.26.0b1")
-
Update LibRaw to Snapshot (if desired)
cd external/LibRaw git fetch git checkout main # or a specific commit cd ../.. git add external/LibRaw
-
Follow steps 3-5 from stable release process
Users can install pre-releases with:
pip install --pre rawpyThe .github/workflows/ci.yml workflow handles:
-
Build Job: Builds wheels for:
- Linux (x86_64 and aarch64)
- macOS (Apple Silicon)
- Windows (x86_64 and ARM64)
- Python versions: 3.11, 3.12, 3.13, and 3.14 (when available)
-
Test Job: Tests all built wheels across platforms
-
Docs Job: Builds Sphinx documentation
-
Publish Jobs:
- Only triggered on tag push (
refs/tags/v*) - Publishes wheels to PyPI
- Deploys documentation to GitHub Pages
- Only triggered on tag push (
RAWPY_BUILD_GPL_CODE=1- Include GPL demosaic packs (macOS/Windows only)RAWPY_USE_SYSTEM_LIBRAW=1- Use system LibRaw instead of building from sourcePKG_CONFIG- Path to pkg-config binaryPYTHON_VERSION- Python version for build scripts (e.g., "3.12")PYTHON_ARCH- Architecture (e.g., "x86_64", "aarch64", "arm64")NUMPY_VERSION- NumPy version constraint (e.g., "2.0.*")MACOS_MIN_VERSION- Minimum macOS version for build (e.g., "11.0")
If you get "ImportError: libraw.so: cannot open shared object file":
echo "/usr/local/lib" | sudo tee /etc/ld.so.conf.d/99local.conf
sudo ldconfig- Ensure all git submodules are initialized:
git submodule update --init - Check that you have the required compilers installed
- On Windows, ensure Visual Studio environment is properly set up
- Ensure you have test dependencies installed:
pip install -r dev-requirements.txt - Check that test data files are present in
test/directory
The CI workflow implements several security best practices:
- Read-only GITHUB_TOKEN permissions by default
- Minimal use of third-party actions
- Separate jobs for testing and building to prevent dependency contamination
- Trusted publishing to PyPI using OIDC (no API tokens required)
- Issues: https://github.com/letmaik/rawpy/issues
- API Documentation: https://letmaik.github.io/rawpy/api/
- Tutorials: https://github.com/letmaik/rawpy-notebooks