docs(cursor): add uv rules, formatting

This commit is contained in:
smypmsa
2025-07-18 12:03:00 +00:00
parent a5a92fbf4b
commit 536a5dd6a5
28 changed files with 2746 additions and 784 deletions
+89
View File
@@ -0,0 +1,89 @@
---
description: Package management and command execution guidelines using uv. Apply when installing dependencies, running scripts, or managing the Python environment.
globs: "**/*"
alwaysApply: true
---
# Package Management with UV
## Overview
This project exclusively uses `uv` as the package manager for all Python operations. UV is a fast Python package installer and resolver, written in Rust, that serves as a drop-in replacement for pip and other Python package managers.
## Core Principles
1. **Use `uv` for all package operations** - Never use pip, pipenv, poetry, or conda
2. **Use `uv run` for script execution** - Ensures proper virtual environment activation
3. **Maintain consistency** - All documentation and examples should reference uv commands
## Package Installation
### Installing Dependencies
```bash
# Install all project dependencies
uv sync --extra dev
# Install additional packages
uv add package-name
# Install from requirements file
uv add -r requirements.txt
```
### Managing Virtual Environments
```bash
# Create virtual environment
uv venv
# Activate virtual environment (if needed manually)
source .venv/bin/activate
```
## Script Execution
### Running Bot Scripts
```bash
# Primary method: Use the installed command
pump_bot
# Alternative: Run bot_runner.py directly
uv run src/bot_runner.py
```
### Running Test Scripts
```bash
# Run listener performance tests
uv run tests/test_geyser_listener.py
uv run tests/test_logs_listener.py
uv run tests/test_block_listener.py
# Run comparative analysis
uv run tests/compare_listeners.py
uv run tests/compare_listeners.py 60
```
### Development and Testing
```bash
# Run linting
uv run ruff check src/
# Run formatting
uv run ruff format src/
```
## Project Structure Integration
The project is configured to work seamlessly with uv:
- `pyproject.toml` - Defines project dependencies and the `pump_bot` command
- `uv.lock` - Locks dependency versions for reproducible builds
- `.venv/` - Virtual environment managed by uv
## Environment Configuration
UV automatically detects and uses the virtual environment when running commands.
+8 -2
View File
@@ -20,6 +20,12 @@ The main codebase is organized as follows:
- @src/bot_runner.py: Entry point for bot execution
- @src/config_loader.py: Configuration loading and validation
### Package Command
The project provides a convenient command-line interface:
- `pump_bot`: Installed command that runs all enabled bots (defined in @pyproject.toml)
- Alternative: `uv run src/bot_runner.py` for direct script execution
#### Core Components
- @src/core/: Blockchain interaction and protocol abstractions
@@ -90,7 +96,7 @@ The main codebase is organized as follows:
## Development Flow
1. Configure bot parameters in @bots/*.yaml
2. Launch bot using @src/bot_runner.py
2. Launch bot using `uv run pump_bot` or `uv run src/bot_runner.py`
3. Monitor execution in @logs/
4. Review trade outcomes in @trades/trades.log
@@ -106,4 +112,4 @@ The main codebase is organized as follows:
- @README.md: Project overview and setup instructions
- @MAINTAINERS.md: Maintenance guidelines and procedures
- @CLAUDE.md: Integration with Claude AI for strategy development
- @CLAUDE.md: Development rules for Claude Code
+8 -8
View File
@@ -23,7 +23,7 @@ Each listener has a dedicated test script for standalone performance analysis:
```bash
# Run Geyser listener test for 30 seconds
python tests/test_geyser_listener.py
uv run tests/test_geyser_listener.py
```
### Logs Listener Test
@@ -35,7 +35,7 @@ python tests/test_geyser_listener.py
```bash
# Run logs listener test
python tests/test_logs_listener.py
uv run tests/test_logs_listener.py
```
### Block Listener Test
@@ -47,7 +47,7 @@ python tests/test_logs_listener.py
```bash
# Run block listener test
python tests/test_block_listener.py
uv run tests/test_block_listener.py
```
## Comparative Performance Analysis
@@ -62,10 +62,10 @@ python tests/test_block_listener.py
```bash
# Compare all listeners for 60 seconds
python tests/compare_listeners.py 60
uv run tests/compare_listeners.py 60
# Default 60-second comparison
python tests/compare_listeners.py
uv run tests/compare_listeners.py
```
### Performance Metrics
@@ -123,19 +123,19 @@ export GEYSER_API_TOKEN="your-api-token"
### Quick Performance Check
```bash
# 30-second comparison of all listeners
python tests/compare_listeners.py 30
uv run tests/compare_listeners.py 30
```
### Extended Performance Analysis
```bash
# 10-minute deep analysis
python tests/compare_listeners.py 600
uv run tests/compare_listeners.py 600
```
### Individual Listener Validation
```bash
# Test specific listener implementation
python tests/test_geyser_listener.py
uv run tests/test_geyser_listener.py
```
## Use Cases