I've been working on getting my #WaitWait Stats API to work with #Pydantic 2 and was wondering why it was erroring out on one specific endpoint.
Turns out, it was a bug I introduced back when I was trying to optimize the `wwdtm` library and, if there was no data returned from a query, the key would be set to an empty list.
The problem? It's supposed to be an empty dictionary.
I had typed `[]` instead of `{}`.
😒😒😒
#waitwait #pydantic #python #fail
🐱 On this #Caturday we just wanted to share this adorable issue we've had sometime ago. It's the purr-fect one for today. 😻
We need more cats as avatars 🐾
#caturday #pydantic #opensource #furbuddies #catsofgithub
Spreading the good vibes at the Sentry + FastAPI Berlin Meetup by @getsentry with the incredible trio: @marcelotryle, @samuelcolvin, and @hasanramezani! 💫✨
Learning, connecting, and having fun together as a team.
#Meetup #Pydantic #Sentry #FastAPI #OpenSource #GoodVibesOnly" 📸🤝😄
#meetup #pydantic #sentry #fastapi #opensource #goodvibesonly
BTW, there is a brief road map for the near future of Pydantic development. If you would like to take a glimpse into a couple of future Pydantic releases then here it is https://github.com/pydantic/pydantic/issues/7324.
#pydantic #opensource #roadmap
There are many ways you can ask for help using Pydantic. Here are some of them:
- 💬 reply to this message
- 🏷️ share a post in Fediverse tagging it #Pydantic
- :github: ask a question on GIthub Discussions https://github.com/pydantic/pydantic/discussions
- 🎙️ join our Discord server https://discord.gg/FYb2EtV2
Anyway, follow this account and have a nice week! 👋🏻
#pydantic #python #opensource #community #programming
Hey all!
How is you Monday going so far? How are you doing migrating from Pydantic v1 to Pydantic v2?
Today is a good time to tell us about issues you have migrating to v2 or just using Pydantic in general.
🧵⏩
#pydantic #python #opensource #community #programming
@jcristharif Msgspec is great, thank you for your work. I also praised msgspc a few months ago:
https://t.me/itgram_channel/597
Do you have plans to update benchmarks to use #pydantic v2? I'm curious how well it holds up.
Myślicie, że jest wam dzisiaj gorąco?
Najpierw walczyłem z nowym segfaultem w #pydantic 2 z Pythonem 3.12. Nie udało mi się zajść daleko, co najwyżej ustalić, że to #heisenbug.
https://github.com/pydantic/pydantic/issues/7181
Potem testowałem świeży snapshot #LLVM — tylko po to, by odkryć, że testy znów padly na 32-bitowych platformach. Po bisect'cie, okazało się, że przyczyną była zmiana "NFCi" (niezamierzająca zmian funkcjonalnych) do logiki hashowania — wygląda na to, że LLVM drukuje teraz funkcje w kolejności zależnej od platformy.
https://reviews.llvm.org/D158217#4600956
Na koniec walczyłem z segfaultem w testach #trimesh. Najwyraźniej jest to regresja związana z betą #numpy 1.26.0, więc wypracowałem backtrace i zgłosiłem błąd.
#python #gentoo #numpy #trimesh #llvm #heisenbug #pydantic
Wrestling with #DjangoRestFramework to make an adapter serializer that uses #pydantic for validation.
DRF embodies all the worst things about Java-style OOP. There are base classes, mixins, attributes that must not be used before you call a specific methods, nothing is documented, and, of course, not annotated. Even drf-stubs project that supposed to annotate DRF is full of Any. And then we also stuck with pydantic v1 where you can't have custom serializers.
What a day.
#djangorestframework #pydantic
I just published a first prototype of a #Griffe extension for #Pydantic: https://mkdocstrings.github.io/griffe-pydantic/
My sponsors can immediately start using it 🙂 It's version 1.0.0a0, so still experimental!
It will change a bit the look of Pydantic models within mkdocstrings:
сегодня для одного своего проекта сделал енкодер, который позволяет #pydantic BaseSettings сериализовывать в валидный toml.
Что это дает?
1. Вы можете не описывать отдельно файл настроек и его шаблон, и все время сверять, правильно ли матчится файл со структурой данных, а просто сгенернировать файл настроек из структуры, заполненный дефолтными значениями.
2. Добавил функцию добавления описания каждого параметра настроек из аттрибутов Field.title и Field.description в виде ведущих комментариев. Теперь не нужно отдельно лезть на сайт, что бы посмотреть описание параметров - они все уже есть в сгенерированном файле настроек!
В качестве примера:
Допустим, у нас есть вот такая структура данных:
```python
class ImportsSettings(BaseSettings):
is_sorted: bool = Field(
default=True,
title='Сортировка импортов',
description=(
'Определяет, будет ли отсортированы строки импорта. Сортирует в пределах каждой области видимости. '
'Т.е. сортировка будет выполнена независимо для модуля, каждой функции и класса с любой степенью вложения. '
'По-умолчанию True.'
),
)
class StyleSettings(BaseSettings):
line_length: int = Field(80, title='Длинна строки', description='Максимальная длинна одной строки кода')
imports: ImportsSettings = Field(default_factory=ImportsSettings, title='Настройки ипортов')
```
после генерации получим вот такой toml-файл
```toml
### Длинна строки
# Максимальная длинна одной строки кода
line_length = 80
[imports]
### Сортировка импортов
# Определяет, будет ли отсортированы строки импорта. Сортирует в пределах
# каждой области видимости. Т.е. сортировка будет выполнена независимо для
# модуля, каждой функции и класса с любой степенью вложения. По-умолчанию
# True.
is_sorted = true
```
🎧 Hey! There is the official Pydantic Discord server if you fancy it.
👉🏻 Join via link: https://discord.gg/FYb2EtV2
🏷️ #Pydantic #Python #Community #Discord #OpenSource #Programming
#pydantic #python #community #discord #opensource #programming
I've completely reworked the extension system of #Griffe, to make it easier to use.
To test it before releasing anything, I prototyped a #Pydantic extension. Here's a preview of the result in #mkdocstrings 🤩
#Griffe #pydantic #mkdocstrings
Co więcej, #pydantic 2 wymaga #RustLang. Musiałem zamaskować 6 paczek, i wyłączyć niektóre funkcje w 4 kolejnych na profilach #Gentoo WD40.
Jakimś cudem jeszcze nie straciliśmy #setuptools (było blisko).
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0cfabe9eb60a4c01ba1b242f1db8a2fac279c170
#python #setuptools #gentoo #rustlang #pydantic
Wiecie, że #Pydantic 2 wyszło parę dni temu? Dziś wziąłem się za przetestowanie wstecznych zależności w #Gentoo i zaraz wyjdzie na ~arch.
A teraz rant:
Wielki korpoprojekt z budżetem i zatrudnionymi programistami: dodają "< 2" do zależności, nic się od tego czasu nie dzieje.
Mały hobbystyczny projekt: daje "< 2" jako chwilowe rozwiązanie, naprawia zgodność dnia następnego.
@berkes @ashwinvis My guess is that they will create other tools with a #rust backend.
They show how the GH stars grew so quickly (VC love this)
My other guess is that this will make the company valuable enough they will see a fast exit from a larger player buying them.
You'll see this happening with #pydantic too likely.
I have released `datamodel-code-generator` version `0.21.0` for #pydantic v2.
The version can generate the #pydantic v2 models from JSONSchema/OpenAPI/JSON/YAML
Also, The version can be run in #pydantic V2.
The changes are in the link.
https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.21.0
#pydanticV2
Can someone familiar with #langchain advise whether I need to use #pydantic in langchain and JSON Schema for OpenAI functions? Or if I can get away with just pydantic and make the specific #LLM less important? #GPT
#langchain #pydantic #llm #gpt