Pre-release
This release is a pre-release and may not be stable for production use.
About
PowerRules allows you to define rules that automatically control the power state of your computer based on configurable conditions.
Rules are evaluated from top to bottom. The first matching rule executes its configured action.
Getting Started
Install with pip:
pip install powerrules
Create a policy file:
# yaml-language-server: $schema=https://raw.githubusercontent.com/LeoTN/PowerRules/main/assets/schema/powerrules_policy.schema.json
rules:
- name: "Shutdown after nightly weekend backup"
conditions:
and:
- process:
name: "backup.exe"
running: false
- datetime:
between:
start: "23"
end: "1:30"
- datetime:
weekday: ["Saturday", "Sunday"]
action:
type: shutdown
Validate the policy:
pwru policy validate
Show configured rules:
pwru policy show
Evaluate the policy once:
pwru policy run --once
Run continuously:
pwru policy run
Use a different policy file with --policy or -p:
pwru policy run --policy my-policy.yaml
Features
| Feature | Description |
|---|---|
| Rule-based power management | Define ordered rules with conditions and power actions |
| Process conditions | Match rules based on whether a process is running |
| Time conditions | Match time ranges and weekdays |
| Logical conditions | Combine conditions using and, or, and not |
| Power actions | Shutdown, sleep, hibernate, and reboot |
| Continuous evaluation | Evaluate policies repeatedly |
| First-match execution | Only the first matching rule executes once per match |
Supported Platforms
| Platform | Status |
|---|---|
| Windows 10/11 | ✅ |
| Linux | Planned |
| macOS | Planned |
Credits & License
- Pydantic → configuration validation
- PyYAML → YAML policy parsing
- Typer → command-line interface
- psutil → process information
- Inkscape → program used to design the logo
This repository is licensed under the MIT License.
Release files for powerrules 0.1.1b0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| powerrules-0.1.1b0.tar.gz | 12.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| powerrules-0.1.1b0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 29.9 kB
Release files / powerrules-0.1.1b0.tar.gz
| Download URL | powerrules-0.1.1b0.tar.gz |
|---|---|
| Size | 12.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
27581c8af66adaf2f6b2badce2a54e0a68c164b2ad960630cb7a076b760f335f
|
|
BLAKE2b-256 checksum How to use checksums |
089933d9f3b8874384e88172a5bcfa08f0e0785601cd67140c8f9ed218efe3f6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.3 Linux/6.17.0-1022-azure
|
Release files / powerrules-0.1.1b0-py3-none-any.whl
| Download URL | powerrules-0.1.1b0-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bbca3197f398efd87682c73a8748ddeed1b4ed99906e087b6f2484bda8a1cb3b
|
|
BLAKE2b-256 checksum How to use checksums |
471c8460e97986eeb9992ed68b88b19ffe28f7b65cf62be64fdf3dbcc9516f23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.4.1 CPython/3.12.3 Linux/6.17.0-1022-azure
|