Skip to content

Instantly share code, notes, and snippets.

@meyt
Last active December 12, 2022 02:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meyt/5c64842f1a2ca1e218b621829d8f922d to your computer and use it in GitHub Desktop.
Save meyt/5c64842f1a2ca1e218b621829d8f922d to your computer and use it in GitHub Desktop.
pex build example

showmyip/__init__.py

# showmyip/__init__.py
from pyray import *
import requests

def main():
    init_window(200, 200, "Whats My IP?")
    while not window_should_close():
        begin_drawing()
        clear_background(WHITE)
        ip = requests.get('http://ident.me').text
        draw_text(ip, 50, 90, 20, VIOLET)
        end_drawing()
    close_window()

setup.py

from setuptools import setup, find_packages

setup(
    name="showmyip",
    version='2.0.0',
    packages=find_packages(),
    install_requires=["raylib", "requests"],
)

deploy.sh

#!/bin/bash

HERE=`dirname "$(readlink -f "$BASH_SOURCE")"`
SRC_DIR="${HERE}"
HOST_NAME="myhost"

set -e
set -x

pushd "${SRC_DIR}"
  pex . -e showmyip:main -o showmyip.pex
popd

rsync -azP --checksum "${SRC_DIR}/showmyip.pex" "${HOST_NAME}:/opt/showmyip"

Run: /usr/bin/python /opt/showmyip/showmyip.pex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment