Skip to main content

toml version

Project description

NetScript

A simple python script to host a flask server to run python scripts and output over a network.

  • Version 2 has been overhauled to provide simple interface page and run multiple scripts, including streamlit.

URL's

  • name
    • file name
  • /start/name
  • /stop/name
  • /status/name
  • /log/name

Usage

"""
example netscript
"""

from netscript.script_server import ScriptSpec, ProcessManager
import sys
import os
from pathlib import Path

CWD = Path.cwd()
JOB_ROOT = Path(os.environ.get("JOB_ROOT", Path(__file__).resolve().parent)).resolve()
PY = sys.executable

pf1 = Path("freeze/library/pylibs/netscript/example_test/script_1.py")
pf2 = Path("stream_tools/stream.py")

scripts = {
    "Print-Loop": ScriptSpec(
        script_file=pf1,
        cmd=[
            PY,
            "-u",
            str(pf1),
        ],
    ),
    "Stream": ScriptSpec(
        script_file=pf2,
        cmd=lambda: [
            PY,
            "-m",
            "streamlit",
            "run",
            str(pf2),
            "--server.headless=true",
            "--server.address=0.0.0.0",
            "--server.port=8501",
        ],
    ),
}

mgr = ProcessManager(JOB_ROOT, scripts, reverse_log=True)
app = mgr.create_flask_app()

if __name__ == "__main__":
    app.run(host="0.0.0.0", port=5001)

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

netscript-2.0.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

netscript-2.0-py3-none-any.whl (5.8 kB view details)

Uploaded Python 3

File details

Details for the file netscript-2.0.tar.gz.

File metadata

  • Download URL: netscript-2.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for netscript-2.0.tar.gz
Algorithm Hash digest
SHA256 cb938a140c9bf74c430c3a3971cbed75dce029db2075dfb50f8c1c47c53e459d
MD5 4bf5216783b1c6b0d9ef85ef1fffd3d6
BLAKE2b-256 5551cdcdb5c09c9782a246cf2486953254c71db0e95f264bf3ad46dd7c89920b

See more details on using hashes here.

File details

Details for the file netscript-2.0-py3-none-any.whl.

File metadata

  • Download URL: netscript-2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for netscript-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5c9f64105166eba35433e913d185273a33ffbc69932a59d4afca56c875257149
MD5 9e8f9507ef77581bf5f352fe3f94934e
BLAKE2b-256 5692fb644f3eac64bc286a343153356389acf826a941f6e013622cdc2135f8e5

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