Class PythonEmbedPlugin

java.lang.Object
io.github.howtis.pythonembed.gradle.PythonEmbedPlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class PythonEmbedPlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
Gradle plugin that creates a Python environment and installs specified packages at build time.

If system Python is available, a standard venv is used. If not, a portable CPython is auto-downloaded from python-build-standalone.

The venv can be embedded in the JAR as a classpath resource (default) or kept external and referenced via a generated properties file.

Usage:


 plugins {
     id 'io.github.howtis.python-embed' version '1.0.1'
 }
 pythonEmbed {
     packages = ['numpy==1.26.4']
     venvOutputDir = layout.buildDirectory.dir('my-venv')
 }
 
  • Constructor Details

    • PythonEmbedPlugin

      public PythonEmbedPlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>