86 lines
2.0 KiB
Markdown
86 lines
2.0 KiB
Markdown
# Setup & IDE Configuration
|
|
|
|
## Python Version Requirement
|
|
|
|
This project **requires Python 3.10 or higher**.
|
|
|
|
The code uses Python 3.10+ features including:
|
|
- Structural pattern matching
|
|
- Union type syntax (`X | Y`)
|
|
- Improved type hints
|
|
- Modern async/await patterns
|
|
|
|
## IDE Configuration
|
|
|
|
### PyCharm / IntelliJ IDEA
|
|
|
|
If your IDE shows "Python 2.7 syntax" warnings, configure it for Python 3.10+:
|
|
|
|
1. **File → Project Structure → Project Settings → Project**
|
|
- Set Python SDK to 3.10 or higher
|
|
|
|
2. **File → Settings → Project → Python Interpreter**
|
|
- Select Python 3.10+ interpreter
|
|
- Click gear icon → Add → System Interpreter → Browse to your Python 3.10 installation
|
|
|
|
3. **File → Settings → Editor → Inspections → Python**
|
|
- Ensure "Python version" is set to 3.10+
|
|
- Check "Code compatibility inspection" → Set minimum version to 3.10
|
|
|
|
### VS Code
|
|
|
|
Add to `.vscode/settings.json`:
|
|
```json
|
|
{
|
|
"python.pythonPath": "path/to/python3.10",
|
|
"python.analysis.typeCheckingMode": "basic",
|
|
"python.languageServer": "Pylance"
|
|
}
|
|
```
|
|
|
|
## Installation
|
|
|
|
```bash
|
|
# Check Python version
|
|
python --version # Should be 3.10+
|
|
|
|
# Install dependencies
|
|
pip install -r requirements.txt
|
|
|
|
# Install Playwright browsers
|
|
playwright install chromium
|
|
```
|
|
|
|
## Verifying Setup
|
|
|
|
```bash
|
|
# Should print version 3.10.x or higher
|
|
python -c "import sys; print(sys.version)"
|
|
|
|
# Should run without errors
|
|
python main.py --help
|
|
```
|
|
|
|
## Common Issues
|
|
|
|
### "ModuleNotFoundError: No module named 'playwright'"
|
|
```bash
|
|
pip install playwright
|
|
playwright install chromium
|
|
```
|
|
|
|
### "Python 2.7 does not support..." warnings in IDE
|
|
- Your IDE is configured for Python 2.7
|
|
- Follow IDE configuration steps above
|
|
- The code WILL work with Python 3.10+ despite warnings
|
|
|
|
### Script exits with "requires Python 3.10 or higher"
|
|
- You're running Python 3.9 or older
|
|
- Upgrade to Python 3.10+: https://www.python.org/downloads/
|
|
|
|
## Version Files
|
|
|
|
- `.python-version` - Used by pyenv and similar tools
|
|
- `requirements.txt` - Package dependencies
|
|
- Runtime checks in scripts ensure Python 3.10+
|