Lens python
Stack lens para Python. Use durante Discovery quando pyproject.toml, setup.py ou requirements.txt for detectado. Cobre FastAPI, Django, Flask, Litestar, Celery workers, data apps, packaging src/ vs flat.From its SKILL.md
npx -y skills add vynazevedo/first-plan --skill lens-pythonAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 21 stars21 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.3 KB, as published. Nobody here has run it
Lens Python
Detecção fina
| Sinal | Variante |
|---|---|
manage.py na raiz | Django |
fastapi em deps | FastAPI |
flask em deps | Flask |
litestar em deps | Litestar |
celery em deps | Worker |
streamlit em deps | Data app |
dagster, airflow, prefect | Data pipeline |
setup.py apenas | lib legacy |
pyproject.toml com [tool.poetry] | Poetry |
pyproject.toml com [tool.uv] ou uv.lock | uv |
pyproject.toml com [build-system] setuptools | setuptools moderno |
Pipfile | pipenv |
Extração de padrões
Packaging
- Layout
src/vs flat - Namespace package vs regular
- Versão Python suportada (
requires-python) - Optional dependencies / extras
Type checking
- mypy / pyright / pyre / ty
- Configuração strictness (
strict = true?) - Cobertura de tipos visível
Validação
- Pydantic (v1 ou v2?) - dominante em FastAPI
- attrs (validação opcional)
- marshmallow
- dataclasses + manual validation
Async
asynciodiretoanyio(compatibilidade)trio- async libs (httpx vs requests, asyncpg vs psycopg)
Testing
- pytest (dominante) ou unittest stdlib
conftest.pyem pasta tests/ -> fixtures globais- Markers customizados (
pytest.mark.integration) - Coverage tool (coverage.py)
- Mocks:
unittest.mock,pytest-mock,responses(HTTP)
Web frameworks - padrões
FastAPI:
- Routers em
app/routers/ - Dependency injection via
Depends() - Pydantic schemas em
app/schemas/ - ORM tipicamente SQLAlchemy + Alembic migrations
Django:
- Apps em
app/<name>/commodels.py,views.py,urls.py,admin.py - Settings em
<project>/settings.py - Migrations geradas
- Templates em
templates/
Flask:
- Application factory pattern (
create_app())? - Blueprints
- Extensions (Flask-SQLAlchemy, Flask-Login, etc)
ORM
- SQLAlchemy 1.x vs 2.x (style mudou drasticamente)
- Django ORM
- Tortoise ORM (async)
- Peewee
- Raw SQL via psycopg / sqlite3
Logging
- stdlib
logging(dominante) - structlog (estruturado)
- loguru (alternativa moderna)
Linters / formatters
- black + ruff (configuração comum)
- ruff replacing flake8/isort
- mypy / pyright
Workers / async tasks
- Celery (broker Redis ou RabbitMQ)
- Dramatiq
- arq (asyncio-based)
- RQ
Output em .first-plan/
Padrão. Adicional:
01-topology/boundaries.md- rotas FastAPI/Django/Flask, tasks Celery02-conventions/di.md- Depends() vs constructor vs factory
Confidence rules
Aumentar:
[tool.mypy] strict = true+ arquivos sem# type: ignore-> alta confiança em "tipagem estrita"pyproject.tomlbem definido com tools configuradas
Reduzir:
- Mistura de Python 2 e 3 styles (e.g.,
super(Cls, self).__init__()ao lado desuper().__init__()) - Sem type hints em código novo
Anti-padrões comuns
from x import *(smell)except:ouexcept Exception:sem logar nem re-raise- Imports circulares mascarados com import dentro de função
- Mutable default args (
def f(x=[]):) - Mistura sync e async sem critério
assertem produção (removido compython -O)