Adaptive waiting and execution engine — replaces time.sleep() with system-aware, deterministic waiting.
Project description
Stop using time.sleep(). Use Intelligence.
NanoWait is an adaptive execution engine that replaces static waits with an intelligent system that observes your hardware and learns over time.
⚡ Why NanoWait?
The traditional time.sleep(2) is dumb: it waits 2 seconds on both a supercomputer and a Raspberry Pi.
NanoWait observes your CPU, Memory, and Network usage to calculate the necessary real-time.
-
Faster: On powerful machines, it cuts down on wait time.
-
Safer: On overloaded machines, it increases resilience to prevent failures.
-
Self-Adjusting: It learns from each execution and calibrates itself.
📦 Installation
pip install nano-wait
🚀 How to use (In 30 seconds)
1. The Intelligent Sleep Replacement
Instead of locking your script for a fixed time, let NanoWait decide the best timing based on the hardware.
``python from nano_wait import wait
Automatically adapts to PC and Network load
wait(2, smart=True)
### 2. Wait Conditions (Polling)
Wait until something happens (e.g., a button appears) without frying your processor.
```python
# Try at each adaptive interval until it succeeds or times out
wait(lambda: button.is_visible(), timeout=10)
3. Execution with Superpowers (Execute)
The ultimate way to run unstable functions (APIs, Web Automation).
``python from nano_wait import execute
result = execute(my_unstable_function, timeout=10)
if result.success:
print(f"Success in {result.duration}s with {result.attempts} attempts!")
---
## 🛠 Ready-to-Use Profiles
Choose the ideal behavior for your scenario:
| Profile | Focus | When to use? |
| :--- | :--- | :--- |
| `ci` | ⚡ Speed | GitHub Actions/GitLab Pipelines |
| Testing | ⚖️ Balance | Local QA Testing |
| RPA | 🛡️ Stability | Automation of slow or legacy websites |
---
## 🧠 How does it think?
NanoWait uses an **Opportunity Cost** formula:
`End Time = (Base Time / System Health) * Aggressiveness`
It monitors:
- 💻 **CPU & RAM:** If the PC is slow, it waits longer.
- 🌐 **Wi-Fi:** If the network is unstable, it increases tolerance.
- 📈 **History:** It saves a `~/.nano_wait_learning.json` file to become smarter with each round.
---
## 💡 Philosophy
> "Don't wait blindly. Execute intelligently."
--
Created for developers who hate unstable automations.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nano_wait-6.1.0.tar.gz.
File metadata
- Download URL: nano_wait-6.1.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e76385d5e95970cb46ae909d3fb8792e7f0b94cc1ec05292b20128babae1944a
|
|
| MD5 |
e438b1a6bcee402b622c19e0e0d074da
|
|
| BLAKE2b-256 |
8fe864e6ada3842af137c66fb89d67b09e03b2355488745a47194b1c3aee35fb
|
File details
Details for the file nano_wait-6.1.0-py3-none-any.whl.
File metadata
- Download URL: nano_wait-6.1.0-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
319807b695db247dfae85c5d4df9a13ad9c3a78f0ebcbb201c6818815c67922a
|
|
| MD5 |
d0b0f0531329bd897b4fc166f6787e34
|
|
| BLAKE2b-256 |
a144535160c37d95c9fa622edf1d8fb3e6bcf13afe66f15970b8299143708d73
|