2.3 KiB
2.3 KiB
CRUSH.md for /home/user/git/ppf
Project Overview
This is a Python 2.7 project focused on proxy fetching and management. Code MUST be Python 2 exclusive, optimized for low-end hardware, using only standard library modules. No external libraries allowed.
Build/Lint/Test Commands
- Build: No formal build process; run scripts directly with
python script.py. - Lint: Use built-in tools or manual checks (e.g., PEP8 compliance via code review). No external linters like pylint due to restrictions.
- Test: Use
python -m unittest discoverfor running all tests (if tests exist). For single test:python -m unittest test_module.TestClass.test_method. - Note: Currently no test files in repo; add using
unittestmodule as per guidelines. - Typecheck: Python 2 has no static typing; rely on runtime checks.
Code Style Guidelines
- PEP8 Adapted: 79-char lines, 4-space indentation, descriptive names. Use Python 2 syntax (e.g., print statement, xrange).
- Imports: Standard library only (e.g., os, sys, threading). Import from local modules as needed (e.g., from config import Config).
- Formatting: Consistent spacing, no trailing whitespace. Use with statements for resources.
- Types: Dynamic typing; add type hints in comments if clarifying (e.g., # param: str).
- Naming Conventions: Snake_case for variables/functions, CamelCase for classes. Descriptive, e.g., process_user_input.
- Error Handling: try/except with specific exceptions (e.g., except IOError). Use logging module, avoid print for errors.
- Threading: Use threading module, avoid time.sleep; use Event/Lock/Queue. Limit to 2-4 threads.
- Memory Optimization: Use generators (xrange), iterative approaches, stream data in chunks.
- Security: Validate inputs, manual checks for vulnerabilities (EOL Python 2.7).
- Comments/Docstrings: Comprehensive docstrings for functions/classes. Inline comments for complex sections.
Copilot Rules Integration
Follow .github/copilot-instructions.md strictly: Python 2 exclusivity, low-end optimization, no external libs, multi-threading efficiency with GIL awareness.
Additional Notes
- Testing Emphasis: Focus on threading and memory in unit tests.
- Maintenance: Track community patches for Python 2.7 security.
(24 lines)