Skip to main content

AppImage start script to convert the python application in full python environment

Project description

appimage

Overview

The appimage module simplifies starting Python applications within an AppImage using AppRun.

Many AppImages allow only the execution of a single command, which can be limiting for more complex applications. This module helps manage various entry points and virtual environments more effectively, making it easier to work with Python applications packaged as AppImages.

The SSH-MITM project uses this module to facilitate plugin development and simplify further development by providing access to the integrated Python environment.

Note: This module is used by the AppRun script of an AppImage and is not intended to be executed directly.

Features

  • Simplifies the startup process for Python applications inside an AppImage.
  • Works with virtual Python environments.
  • Makes it easy to update the application directly within the virtual environment.

Example: Creating a Simple AppImage

This example shows how to create a simple AppImage using the Python AppImage from the python-appimage project.

Steps

  1. Download and extract the Python AppImage:

    # Download the Python AppImage
    curl -LO "https://github.com/niess/python-appimage/releases/download/python3.11/python3.11.9-cp311-cp311-manylinux2014_x86_64.AppImage"
    chmod +x python3.11.9-cp311-cp311-manylinux2014_x86_64.AppImage
    ./python3.11.9-cp311-cp311-manylinux2014_x86_64.AppImage --appimage-extract
    
  2. Install the appimage package along with the desired application (e.g., ssh-mitm):

    ./squashfs-root/opt/python3.11/bin/python3.11 -m pip install appimage ssh-mitm
    
  3. Edit the existing AppRun script:

    Open the AppRun script located in squashfs-root/AppRun with a text editor (e.g., vim, nano, gedit). For example, using nano:

    nano squashfs-root/AppRun
    

    Then, change the last line to:

    # Call Python
    exec "$APPDIR/opt/python3.11/bin/python3.11" -m appimage --python-main ssh-mitm "$@"
    

    Save the changes and exit the editor.

  4. Create the new AppImage:

    # Download appimagetool
    curl -LO "https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage"
    chmod +x appimagetool-x86_64.AppImage
    
    # Create the new AppImage
    ./appimagetool-x86_64.AppImage squashfs-root/ ssh-mitm.AppImage
    
  5. Start the created AppImage

    ./ssh-mitm.AppImage server
    

You now have a new AppImage (ssh-mitm.AppImage) that includes the ssh-mitm package and uses the appimage module to start the application.

Usage

You can use the following options with the AppImage:

Parameter Description

  • --python-help Displays the help message and exits. Use this option to see the available commands and their usage.
  • --python-main Specifies the main (default) entry point for starting the application.
  • --python-interpreter Starts the Python interpreter included within the AppImage. This is useful for running Python commands interactively.
  • --python-venv PYTHON_VENV_DIR: Creates a virtual environment in the specified directory (PYTHON_VENV_DIR) that points to the Python installation within the AppImage. This virtual environment includes all the Python packages available in the AppImage, making it convenient for setting up an isolated environment with the necessary dependencies for your Python applications.
  • --python-entry-point PYTHON_ENTRY_POINT: Executes a specified Python entry point from the console scripts (e.g., ssh-mitm) or as a Python entry point (e.g., ssmitm.cli:main). This allows you to run specific commands or scripts packaged within the AppImage.

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

appimage-1.0.0.tar.gz (36.0 kB view details)

Uploaded Source

Built Distribution

appimage-1.0.0-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file appimage-1.0.0.tar.gz.

File metadata

  • Download URL: appimage-1.0.0.tar.gz
  • Upload date:
  • Size: 36.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for appimage-1.0.0.tar.gz
Algorithm Hash digest
SHA256 75933b9df5cd77dcdc8187fda3142dd84ea63ffc40712369ecc19652ea1ef3ac
MD5 34eb5da3e1646990818b59139b8760c3
BLAKE2b-256 5830625bf3d9cbb7b8736ea053b725bf72e55415cbe5ce4bf4c8971537fb5720

See more details on using hashes here.

File details

Details for the file appimage-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: appimage-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.12.3

File hashes

Hashes for appimage-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3603b2373d0afa1808df2d6ac357f3a9c5f69a39c318529c8dbcaf26f1da9feb
MD5 a468b53fbe68333e33f9871e882ed6f3
BLAKE2b-256 81fcba8a13eb01977dff3b73f1c6e0adfd736c75b711ceea9519685d0f27c54f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page