Skip to main content

Pause your scripts automatically when gaming or running heavy apps.

Project description

PyPI Python License

English  •  Português


What is FortScript?

Have you ever left a bot, an API, or a script running in the background while gaming, only to notice the game started lagging? Or forgot about processes silently consuming memory until your PC slowed down?

FortScript solves this automatically. It pauses your scripts when you open a game or resource-heavy application, and resumes them when you close it. Simple as that.

How it works

  1. You define which scripts you want to manage (Python bots, Node.js projects, etc.)
  2. You define which applications are "heavy" (games, video editors, etc.)
  3. FortScript monitors and does the rest: pauses when needed, resumes when possible.

Installation

FortScript can be used in two ways: as a Python library or via command line (CLI). Both come in the same package.

Installation as a project dependency

Use this option if you want to integrate FortScript into an existing Python project:

# UV (recommended)
uv add fortscript

# Poetry
poetry add fortscript

# pip
pip install fortscript

Global installation (CLI)

Use this option if you want to use the fort command directly in the terminal, without writing code:

pipx install fortscript

Prerequisites

  • Python 3.10+
  • Node.js (only if managing JavaScript/TypeScript projects)

Configuration

Regardless of how you use FortScript (code or CLI), configuration is done through a config.yaml file:

# Scripts that FortScript will manage
projects:
  - name: "My Discord Bot"
    path: "./bot/main.py"
  - name: "Node API"
    path: "./api/package.json"

# Applications that will pause the scripts above
heavy_processes:
  - name: "GTA V"
    process: "gta5"
  - name: "OBS Studio"
    process: "obs64"

# Pause scripts if RAM exceeds this limit (%)
ram_threshold: 85

Explanation:

  • projects: List of scripts/projects that FortScript will start and manage.
  • heavy_processes: When any of these applications open, scripts are paused.
  • ram_threshold: If system RAM exceeds this value, scripts are also paused.

Supported project types

Type Extension Behavior
Python .py Automatically detects .venv in the script's folder
Node.js package.json Runs npm run start

How to Use

Option 1: Via Python code

Ideal for integrating FortScript into an existing project or having programmatic control:

from fortscript import FortScript

app = FortScript(config_path="config.yaml")
app.run()

Option 2: Via CLI (terminal)

Ideal for quick use without writing code:

# Navigate to the folder with your config.yaml
cd my_project

# Run
fort

Note: The CLI currently runs FortScript from the config.yaml. Additional commands like fort add are planned for future versions.


Practical Example

Imagine you have the following project structure:

my_project/
├── discord_bot/
│   ├── .venv/
│   └── main.py
├── express_api/
│   ├── node_modules/
│   └── package.json
├── config.yaml
└── manager.py

The manager.py would be:

from fortscript import FortScript

app = FortScript(config_path="config.yaml")
app.run()

When you open GTA V, FortScript automatically:

  1. Pauses the Discord bot
  2. Pauses the Express API
  3. Displays the pause reason in the terminal

When you close GTA V, everything resumes automatically.


Roadmap

Library

  • .exe support: Manage executables directly.
  • Configuration via arguments: Pass projects, heavy_processes, and ram_threshold directly in code, without needing a YAML file.
  • Custom functions: Manage Python functions beyond external files.
  • Games module: Pre-defined list of popular games.

Games module preview:

from fortscript import FortScript
from fortscript.games import GAMES

# GAMES contains dozens of popular games
app = FortScript(heavy_processes=GAMES)
app.run()
Included games
Minecraft, GTA V, Fortnite Counter-Strike 2, Valorant, League of Legends
Roblox, Apex Legends ...and many more

CLI

  • System Tray: Run minimized in the system tray.
  • Additional commands:
    • fort add <path> - Add project to config
    • fort list - List configured projects
    • fort remove <name> - Remove project

Current Features

  • Automatic pause when detecting heavy applications
  • Automatic pause by RAM limit
  • Python script support with .venv detection
  • Node.js project support via npm run start
  • Safe process termination (tree-kill)

Contributing

Contributions are welcome! See the Contributing Guide to get started.

License

MIT - See LICENSE for details.


Made with ❤️ by WesleyQDev

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

fortscript-0.2.5.tar.gz (72.1 kB view details)

Uploaded Source

Built Distribution

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

fortscript-0.2.5-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

Details for the file fortscript-0.2.5.tar.gz.

File metadata

  • Download URL: fortscript-0.2.5.tar.gz
  • Upload date:
  • Size: 72.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fortscript-0.2.5.tar.gz
Algorithm Hash digest
SHA256 dae3415d42989b5ce9015bb4d75b2182ebfc20ddca79eb70a5df0ec7da452b38
MD5 6a997ccf6aac92e0ca21be8981b3c1e1
BLAKE2b-256 ea2081030a13f79407bff86d348928a083091c1f1546a3aa4efabdedda17425e

See more details on using hashes here.

Provenance

The following attestation bundles were made for fortscript-0.2.5.tar.gz:

Publisher: release.yml on WesleyQDev/fortscript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fortscript-0.2.5-py3-none-any.whl.

File metadata

  • Download URL: fortscript-0.2.5-py3-none-any.whl
  • Upload date:
  • Size: 8.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fortscript-0.2.5-py3-none-any.whl
Algorithm Hash digest
SHA256 36d758fc7af6f14c92668d657e73bf41c63563d97ae0f97ca0a52baf319c187b
MD5 758365ac64ea9c398c368b18305b2b3c
BLAKE2b-256 a20c61e6112d2b9c8d1ab0c17d28483848aaf1152d954f4bf1ba089b6c9eaedc

See more details on using hashes here.

Provenance

The following attestation bundles were made for fortscript-0.2.5-py3-none-any.whl:

Publisher: release.yml on WesleyQDev/fortscript

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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