Python para desenvolvedores TypeScript
Type hints, Pydantic, asyncio e uv para apps de IA
Você escreve TypeScript todo dia, e agora o trabalho com IA que tem pela frente é em Python. Não precisa começar do zero. O livro parte do que você já sabe e dedica as páginas às diferenças do Python.
Minimum price
$7.99
$12.99
You pay
Author earns
About
About the Book
Você escreve TypeScript todo dia, e agora o trabalho com IA que tem pela frente é em Python. Não precisa começar do zero. O livro parte do que você já sabe e dedica as páginas às diferenças do Python.
Primeiro, você configura um projeto com uv como faria com npm. Depois, aprende a sintaxe que parece familiar, mas se comporta de outro jeito, de truthiness, None e igualdade a argumentos nomeados e à armadilha dos valores padrão mutáveis. Em seguida vêm generators e decorators. Você adiciona type hints e os confere com mypy em modo estrito, além de modelar dados com dataclasses. Entradas não confiáveis passam pelo Pydantic, o Zod de Python, que também gera o JSON Schema exigido pela definição de ferramenta de um LLM.
O capítulo sobre asyncio explica o tema para quem pensa em Promises. Ele começa pelo fato de que uma coroutine não faz nada até receber await, e mostra como executar chamadas a modelos de forma concorrente, com um limite. Depois, você usa o SDK Python da Anthropic para respostas tipadas, saída estruturada, streaming e ferramentas. O livro termina com pytest, ruff e um comando instalável.
Todos os exemplos com saída foram executados no Python 3.13, e a saída no livro é o que eles imprimiram. O que o texto diz sobre TypeScript e Node foi conferido no Node 22.
Python é marca registrada da Python Software Foundation. TypeScript é marca da Microsoft Corporation. Claude e Anthropic são marcas da Anthropic, PBC. Este livro é independente e não tem afiliação, endosso ou patrocínio da Python Software Foundation, da Microsoft ou da Anthropic.
Author
About the Author
30labs publishes practical guides for developers who build with AI: coding agents, model APIs, tool servers and the languages around them. Every code example in a 30labs book is run before publication, and the output printed under it is what the program produced. Books in English and Brazilian Portuguese.
Contents
Table of Contents
The Leanpub 60 Day 100% Happiness Guarantee
Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.
See full terms...
Earn $8 on a $10 Purchase, and $16 on a $20 Purchase
We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.
(Yes, some authors have already earned much more than that on Leanpub.)
Learn more about writing on Leanpub
Free Updates. DRM Free.
If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).
Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.
Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.
Learn more about Leanpub's ebook formats and where to read them
Write and Publish on Leanpub
You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!
Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.
Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.