Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Tests

on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]

jobs:
test:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest

- name: Run tests
run: |
pytest test_trashclaw.py -v --tb=short

- name: Verify zero dependencies
run: |
python -c "
import ast
import sys

with open('trashclaw.py', 'r') as f:
tree = ast.parse(f.read())

imports = []
for node in ast.walk(tree):
if isinstance(node, ast.Import):
for alias in node.names:
imports.append(alias.name)
elif isinstance(node, ast.ImportFrom):
imports.append(node.module)

# Allowed stdlib modules
ALLOWED = {
'os', 'sys', 'json', 'subprocess', 'urllib.request', 'urllib.error',
're', 'glob', 'difflib', 'traceback', 'time', 'signal', 'datetime',
'typing', 'base64', 'random', 'platform', 'hashlib', 'readline',
'pyreadline3' # Windows optional
}

external = [i for i in imports if i and not any(i.startswith(a) for a in ALLOWED)]
if external:
print(f'ERROR: External dependencies found: {external}')
sys.exit(1)
else:
print('✓ Zero external dependencies verified')
"
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ See `plugins/example_weather.py` for a complete example.

See [WINDOWS_COMPATIBILITY.md](WINDOWS_COMPATIBILITY.md) for detailed setup.

> **Pro Tip:** Use [Windows Terminal](https://aka.ms/terminal) (free from Microsoft Store) for the best experience with colors and Unicode support.

```powershell
pip install pyreadline3 # Optional: enables command history
python trashclaw.py
Expand Down
Loading