OSRS Bot Development SDK with game-native structure
Project description
ShadowLib
A Python SDK for Old School RuneScape (OSRS) bot development with an intuitive structure that mirrors the game's interface.
Features
- Game-Native Structure: Directory layout based on OSRS client interface (world, tabs, interfaces)
- Type-Safe: Full type hints for better IDE support and fewer runtime errors
- Well-Tested: Comprehensive test coverage with pytest
- Clean Code: Enforced coding standards with Ruff and custom naming convention checker
- Easy to Use: Intuitive API that matches how players think about the game
Installation
From Source
git clone https://github.com/shadowbot/shadowlib.git
cd shadowlib
pip install -e ".[dev]"
For Development
# Install with development dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
Quick Start
from shadowlib import Client
# Create and connect to the client
client = Client()
client.connect()
# Check connection status
if client.isConnected():
print("Connected to OSRS client!")
# Your bot logic here...
# Disconnect when done
client.disconnect()
Project Structure
shadowlib/
├── world/ # Game viewport entities (NPCs, objects, players, ground items)
├── tabs/ # Side panel tabs (inventory, equipment, skills, prayers)
├── interfaces/ # Overlay windows (bank, GE, shop, dialogue)
├── navigation/ # Movement systems (walking, teleports, webwalking)
├── interactions/ # Interaction systems (menu, clicking, hovering)
├── input/ # OS-level input (mouse, keyboard)
├── types/ # Type definitions, enums, models
├── utilities/ # Helper functions (timing, calculations, geometry)
├── resources/ # Game data (varps, objects, items, NPCs)
└── _internal/ # Bridge implementation (transport, protocol, cache)
Placement Rules
- Visible in the 3D world →
world/ - Side-panel tab →
tabs/ - Overlay window →
interfaces/ - Pathing/movement →
navigation/ - Interaction primitives →
interactions/
Development
Code Style
This project uses camelCase for function names (e.g., getFoo(), doSomething()), following the convention:
# ✅ Correct
def getPlayerName():
pass
def isInventoryFull():
pass
# ❌ Incorrect
def get_player_name():
pass
def is_inventory_full():
pass
Running Tests
# Run all tests
pytest
# Run with coverage
pytest --cov=shadowlib
# Run specific test file
pytest tests/test_client.py
# Run tests matching a pattern
pytest -k "test_client"
Linting and Formatting
# Run Ruff linter
ruff check .
# Auto-fix issues
ruff check --fix .
# Format code
ruff format .
# Check naming conventions
python check_naming.py
Pre-commit Hooks
The project uses pre-commit hooks to ensure code quality:
# Install hooks
pre-commit install
# Run manually
pre-commit run --all-files
Naming Conventions
- Functions/Methods:
camelCase(e.g.,getItem,moveToPosition) - Classes:
PascalCase(e.g.,Client,QueryBuilder) - Constants:
UPPER_CASE(e.g.,MAX_HEALTH,DEFAULT_TIMEOUT) - Private functions:
_camelCase(e.g.,_internalHelper) - Dunder methods:
__method__(e.g.,__init__,__repr__)
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes following the code style
- Run tests and linting
- Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Code Quality Checklist
Before submitting a PR, ensure:
- All tests pass (
pytest) - Code follows naming conventions (
python check_naming.py) - Linting passes (
ruff check .) - Code is formatted (
ruff format .) - New features have tests
- Documentation is updated
Architecture Decision Records (ADRs)
See docs/adr/ for architectural decisions, including:
- ADR-003: OSRS-Native SDK Structure
License
MIT License - see LICENSE file for details
Acknowledgments
- Inspired by OSBot, TRiBot, and other OSRS botting frameworks
- Built with love for the OSRS botting community
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 shadowlib-0.1.0.tar.gz.
File metadata
- Download URL: shadowlib-0.1.0.tar.gz
- Upload date:
- Size: 912.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5f4d7a8127b4f1eac0201ab224e41ef7e58f9f13cc3a0bf09e677e639e0ae56
|
|
| MD5 |
c94ea7593371a605f45673f65aac70f7
|
|
| BLAKE2b-256 |
81b2100b1471d82b469f92aa45be452a83f2f44fd4de4431abd6eac2099644cb
|
File details
Details for the file shadowlib-0.1.0-py3-none-any.whl.
File metadata
- Download URL: shadowlib-0.1.0-py3-none-any.whl
- Upload date:
- Size: 946.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
459d29297d7b2c6d903a39052f6553ee9b5fd003ad454e349f75527c90c6ff94
|
|
| MD5 |
8703f21e18f073d01d30c824617bb5a7
|
|
| BLAKE2b-256 |
9a123992ab3558cd64063566c2b29041d56190e107c77310012dbcd2107e7a86
|