Python

Guida di stile Python completa per progetti PANDEV general purpose, con Black, flake8 e mypy per qualità e type safety.

🎯 Overview

Python è utilizzato per progetti general purpose in PANDEV. Questa guida copre:

  • General Purpose: Scripting, web development, data science, automation

  • Tools: Black, flake8, mypy, isort

  • Versions: Python 3.9+ e 3.11+

  • Best Practices: PEP 8, type hints, testing

📋 Standard Adottati

Formatter: Black

Black per formattazione automatica del codice:

# pyproject.toml
[tool.black]
line-length = 100
target-version = ['py39', 'py311']
include = '\.pyi?$'
extend-exclude = '''
/(
  migrations
  | venv
  | \.venv
)/
'''

Linter: flake8

flake8 per code quality e PEP 8 compliance:

Type Checker: mypy

mypy per type checking statico:

🛠️ Setup Rapido

1. Installazione Dependencies

2. File pyproject.toml PANDEV

3. File .flake8

4. Scripts e Makefile

🐍 Python Version Support

Multi-Version Development

Version-Specific Features

📝 Code Style Guidelines

1. Type Hints

2. Naming Conventions

3. Error Handling

🏗️ Project Structure

init.py Pattern

🧪 Testing Guidelines

pytest Configuration

Test Examples

🚀 Performance Best Practices

Efficient Code Patterns

🔧 Development Tools Integration

Pre-commit Hooks

VS Code Configuration

📚 Risorse

Documentazione Ufficiale

Python Version Guides

Per configurazioni dettagliate, consulta le sezioni dedicate:

Last updated