Skip to main content

Simple utilities for building and installing Python extensions for Blender.

Project description

Hatch Latest Release License Pipeline Status Pylint PyPI PyPI Downloads

Synopsis

This is a small Python package that installs a command-line utility to facilitate extension installation in Blender. It currently provides the following functionality:

  • Validate and build Blender extensions, including their dependency wheels.
  • Generate a shell environment file for setting the PYTHONPATH environment variable to match Blender's Python path.
  • Print information about Blender and its internal Python environment.
  • Install Python packages directly into Blender's modules directory.

Links

GitLab

Other Repositories

Usage

Install this package, preferably in a Python virtual environment.

# Create the virtual environment.
python3 -m venv

# Activate it.
source venv/bin/activate

# Ensure that pip is installed and up-to-date.
python3 -m ensure pip
pip install -U pip

# Install this package.
pip install -U Blender Python Utils

blender-pytuils Executable

The package will install the blender-pyutils command that accepts different subcommands as arguments.

usage: blender-pyutils [-h] {build,env,info,pip} ...

Utility script for validating and packaging Blender extensions.

positional arguments:
  {build,env,info,pip}

options:
  -h, --help            show this help message and exit

build Subcommand

The build subommand will validate and build a Blender extension. If a requirements.txt file is found in the extension directory then it will also download the dependency wheels to the wheels subdirectory and add them to the blender_manifest.toml.

usage: blender-pyutils build [-h] [-p PATH]

Validate and build an extension. If a requirements.txt file is found in the
extension directory then the wheels for its dependencies will be downloaded to
the wheels directory and the manifest will be updated to include them.

options:
  -h, --help            show this help message and exit
  -p PATH, --path PATH  The path to the extension's root directory. If not
                        given, the current working directory is assumed.

env Subcommand

The env subcommand generates a sourceable shell file that can be used to match the shell's PYTHONPATH environment variable to Blender's internal Python path. Sourcing the file will allow scripts and code editors to find Blender's internal Python packages.

usage: blender-pyutils env [-h] [--example] [-o OUT]

Create a soureable shell configuration file that will set the Python path
environment variable to match Blender's Python path. This will allow scripts
and editors to detect Blender's internal Python modules.

options:
  -h, --help         show this help message and exit
  --example          Mask user name in home directory paths for example
                     output.
  -o OUT, --out OUT  The output path. If not specified, the file will be
                     printed to STDOUT.

Example Output

#!/usr/bin/sh
export PYTHONPATH=/usr/share/blender/4.5/scripts/startup:/usr/share/blender/4.5/scripts/modules:/usr/lib/python313.zip:/usr/lib/python3.13:/usr/lib/python3.13/lib-dynload:/usr/lib/python3.13/site-packages:/usr/share/blender/4.5/scripts/freestyle/modules:/home/user/.config/blender/4.5/scripts/addons/modules:/usr/share/blender/4.5/scripts/addons_core


info Subcommand

The info subcommand will print information about Blender's version, module directory path and configured Python executable.

usage: blender-pyutils info [-h] [--example] [-j]

Print Blender information.

options:
  -h, --help  show this help message and exit
  --example   Mask user name in home directory paths for example output.
  -j, --json  Use JSON output format.

Example Output

Blender module directory: /home/user/.config/blender/4.5/scripts/modules
Blender version: 4.5.5 LTS
Python executable: /usr/bin/python3.13
Python path: /usr/share/blender/4.5/scripts/startup:/usr/share/blender/4.5/scripts/modules:/usr/lib/python313.zip:/usr/lib/python3.13:/usr/lib/python3.13/lib-dynload:/usr/lib/python3.13/site-packages:/usr/share/blender/4.5/scripts/freestyle/modules:/home/user/.config/blender/4.5/scripts/addons/modules:/usr/share/blender/4.5/scripts/addons_core
Python version: 3.13.7

{
  "Blender module directory": "/home/user/.config/blender/4.5/scripts/modules",
  "Blender version": "4.5.5 LTS",
  "Python executable": "/usr/bin/python3.13",
  "Python path": "/usr/share/blender/4.5/scripts/startup:/usr/share/blender/4.5/scripts/modules:/usr/lib/python313.zip:/usr/lib/python3.13:/usr/lib/python3.13/lib-dynload:/usr/lib/python3.13/site-packages:/usr/share/blender/4.5/scripts/freestyle/modules:/home/user/.config/blender/4.5/scripts/addons/modules:/usr/share/blender/4.5/scripts/addons_core",
  "Python version": "3.13.7"
}

pip Subcommand

The pip subcommand will install Python packages directly to Blender's modules directory. It accepts the same commands as pip.

# Example: install scipy using pip
blender-pyutils pip install scipy

# Example: install scipy using uv
blender-pyutils pip --uv install scipy

# Example: use "--" to pass through options to pip, such as a requirements.txt file
blender-pyutils pip -- install -U -r requirements.txt
usage: blender-pyutils pip [-h] [--path PATH] [--uv] <PIP ARG> [<PIP ARG> ...]

Install Python packages to Blender's module directory. Additional arguments as
passed through to pip.

positional arguments:
  <PIP ARG>    Arguments to pass through to pip. Precede these arguments with
               "--" if any of them begin with "-".

options:
  -h, --help   show this help message and exit
  --path PATH  Installation directory for Python packages. If not given, the
               default Blender module directory will be used. Use the "info"
               command to show the path to the module directory.
  --uv         Use "uv pip" instead of pip.

Caveats

Legacy Script

This repository originally only provided blender-pip_install.sh as a wrapper around pip install and uv pip install. It has been superceded by blender-pyutils pip and users should migrate accordingly.

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

blender_pyutils-2025.6.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

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

blender_pyutils-2025.6-py3-none-any.whl (12.3 kB view details)

Uploaded Python 3

File details

Details for the file blender_pyutils-2025.6.tar.gz.

File metadata

  • Download URL: blender_pyutils-2025.6.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for blender_pyutils-2025.6.tar.gz
Algorithm Hash digest
SHA256 cfe2d61e0ae8998999d0e9393714521ff43396d1a78887b610571a4121fbdf4e
MD5 a34e64ff8cb7698eea774a6576da1ae2
BLAKE2b-256 7500ac26119d1c87e98711c179e2afb7be8c571c97a37194f6d04c0cf9d96cf0

See more details on using hashes here.

File details

Details for the file blender_pyutils-2025.6-py3-none-any.whl.

File metadata

File hashes

Hashes for blender_pyutils-2025.6-py3-none-any.whl
Algorithm Hash digest
SHA256 3370d4ccbf97a6a520389d5ce389fe402b136b4c5746aa33178fb0c62698b27f
MD5 d08ce46fff3fef02f1f6f7535e60e775
BLAKE2b-256 d7fd7abd046ad137ba2367eb61a9124a45c82968a244739073f9ccc99524cc9c

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