Python to interpretowany, dynamicznie typowany język programowania znany z czytelnej składni i ogromnego ekosystemu bibliotek. Jest numerem 1 w rankingach popularności (TIOBE, Stack Overflow) i standardem w AI/ML, data science i backend development.
W Assadante używamy Pythona do budowy API (Django, FastAPI), integracji AI (OpenAI, LangChain), przetwarzania danych i automatyzacji procesów biznesowych.
from dataclasses import dataclass
from datetime import datetime
@dataclass
class User:
name: str
email: str
age: int
created_at: datetime = datetime.now()
@property
def is_adult(self) -> bool:
return self.age >= 18
def display(self) -> str:
return f"{self.name} ({self.age})"
from fastapi import FastAPI, HTTPException
from pydantic import BaseModel, EmailStr
app = FastAPI()
class CreateUser(BaseModel):
name: str
email: EmailStr
age: int
@app.post("/users", status_code=201)
async def create_user(data: CreateUser):
# Pydantic automatycznie waliduje dane
user = await db.create_user(**data.dict())
return {"id": user.id, "name": user.name}
@app.get("/users/{user_id}")
async def get_user(user_id: int):
user = await db.get_user(user_id)
if not user:
raise HTTPException(404, "User not found")
return user
from openai import AsyncOpenAI
client = AsyncOpenAI()
async def summarize(text: str) -> str:
response = await client.chat.completions.create(
model="gpt-4o",
messages=[
{"role": "system", "content": "Podsumuj tekst w 3 zdaniach."},
{"role": "user", "content": text},
],
temperature=0.3,
)
return response.choices[0].message.content
# List comprehension
active_users = [u for u in users if u.is_active and u.age > 18]
# Pattern matching (Python 3.10+)
match command:
case {"action": "create", "data": data}:
return create_item(data)
case {"action": "delete", "id": id}:
return delete_item(id)
case _:
raise ValueError("Unknown command")
Django, FastAPI, Flask. REST, GraphQL, WebSockets. ORM (SQLAlchemy, Django ORM).
PyTorch, TensorFlow, scikit-learn, Hugging Face. Trenowanie modeli, inference, fine-tuning.
Pandas, NumPy, Matplotlib. Analiza danych, wizualizacje, raporty, ETL pipelines.
Scripting, web scraping (BeautifulSoup, Scrapy), task scheduling (Celery, APScheduler).
LangChain, OpenAI API, RAG, embeddings, chatboty, asystenci AI.
Ansible, Fabric, Click. Narzędzia CLI, deployment scripts, infrastructure automation.
Idealny gdy: budujesz backend API, integrujesz AI/ML, potrzebujesz szybkiego prototypu, przetwarzasz dane, budujesz chatboty i asystentów AI.
Nie najlepszy gdy: budujesz frontend (lepiej TypeScript), potrzebujesz ekstremalnej wydajności (lepiej Go/Rust), budujesz aplikację mobilną (lepiej Flutter).