Python3Android 311.22.1.19

dotnet add package Python3Android --version 311.22.1.19
                    
NuGet\Install-Package Python3Android -Version 311.22.1.19
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Python3Android" Version="311.22.1.19" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Python3Android" Version="311.22.1.19" />
                    
Directory.Packages.props
<PackageReference Include="Python3Android" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Python3Android --version 311.22.1.19
                    
#r "nuget: Python3Android, 311.22.1.19"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Python3Android@311.22.1.19
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Python3Android&version=311.22.1.19
                    
Install as a Cake Addin
#tool nuget:?package=Python3Android&version=311.22.1.19
                    
Install as a Cake Tool

Python3Android

A NuGet package that provides Python 3.11.13 runtime for Android applications. This package allows you to run Python code directly in your Maui Android applications.

Installation

Add the package to your .NET Android project using the NuGet Package Manager:

<PackageReference Include="Python3Android" Version="311.22.1.14" />

Or install via the Package Manager Console:

Install-Package Python3Android

Package Version Numbering

Python_Version.Min_Android_Framework.Package_Version

Python versions are squashed, so python 3.8 becomes 38. (Future: 3.10 → 310, 4.0 → 400)

Min_Android_Frame work is the minimum android framework that the Maui application must target. 22 is Android 5.1.

Requirements

  • .NET 9.0 or later
  • Android API 22 or later
  • .NET MAUI project

Usage

Here's a simple example of how to run Python code in your Android application:

using Python3Android;

public class PythonExample
{
    public async Task RunPythonCode()
    {
        // Install Python environment
        var androidPythonEnvironment = await AndroidPythonEnvironment.Create();

        // Run Python code
        string pythonCode = @"
def greet(name):
    return f'Hello, {name}!'

result = greet('Android')
print(result)
";
        string result = androidPythonEnvironment.RunCode(pythonCode);
        Console.WriteLine(result); // Outputs: Hello, Android!
    }
}

Features

  • Includes Python 3.11.13 runtime for Android
  • Native library support (.so files)
  • Python standard library included (python311.zip)
  • Compatible with Android API 22 and later

Package Contents

The package includes:

  • Native Python libraries (.so files)
  • Python standard library (python311.zip)
  • Build targets for proper integration

Notes

  • The Python runtime is automatically included in your Android application's assets
  • You need to call await AndroidPythonEnvironment.Create() to get a initialized AndroidPythonEnvironment instance which allows running Python code
  • The Python environment only needs to be installed once per app session.
  • AndroidPythonEnvironment.Create() will only run the install, if not already installed, or the nuget package has been updated. (So it's safe to run each time your app starts.)

License

This package is provided under the terms of the Python Software Foundation License.

Author

Created by hindlemail

Repository

Source code available at: https://hg.sr.ht/~hindlemail/PythonAndroidNuget

Product Compatible and additional computed target framework versions.
.NET net9.0-android35.0 is compatible.  net10.0-android was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net9.0-android35.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
311.22.1.19 174 7/30/2025
311.22.1.18 191 7/30/2025
311.22.1.17 190 7/29/2025
310.22.1.14 358 7/25/2025
38.22.1.12 150 7/15/2025
38.22.1.10 212 5/16/2025
38.22.1.9-alpha 188 5/16/2025
3.8.10-22-1.8 208 5/15/2025
3.8.10-22-1.0 216 5/12/2025