fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

9.8K
active users

#hatchling

0 posts0 participants0 posts today

W sumie mogę dać parę rekomendacji systemów budowania #PEP517.

Dla paczek w samym Pythonie:

1. #flit_core (pypi.org/project/flit-core/) — leciutki, prosty, i nie ma zależności (za wyjątkiem włączonego tomli dla starszych wersji Pythona).

2. #hatchling (pypi.org/project/hatchling/) — popularny, duża funkcjonalność, ale ma sporo włączonych zależności, a testy są zależne od reszty projektu hatch (przez co w #Gentoo się mocno z tym męczymy).

Dla paczek z rozszerzeniami w C: #meson-python (pypi.org/project/meson-python/) — połączenie szerokiej funkcjonalności i poprawności mesona z dobrą integracją z Pythonem.

Dla paczek z rozserzeniami w Ruście: #maturin (pypi.org/project/maturin/) — po prostu dobry system budowania dla tego typu paczek.

Stanowczo odradzam:

A. #setuptools — mnóstwo włączonych do projektu zależności, które wynajdują koło na nowo (które można zastąpić zewnętrznymi, które z kolei mają cykliczną zależność od setuptools), ciągłe wycofywanie starej funkcjonalności (której wciąż używa mnóstwo paczek), wiele nierozwiązanych problemów (np. równoległe budowanie plików C jest częściowo popsute), sporo długu technicznego, a jeżeli to nie wystarcza, to do tego strasznie powolny.

B. #poetry-core — trudny do poprawnego użycia system budowania, w którym bardzo łatwo popełnić błąd (a zgłaszałem już wiele pomyłek, które ludzie robili migrując swoje projekty).

C. Praktycznie każdy inny system budowania — pisanie nowych backendów stało się banalne, więc każdy musi mieć swój. Do tego często mają mnóstwo zależności, które wynajdują koło na nowo (jak już ktoś chce wynaleźć własny system budowania, to może równie dobrze pójść na całość i wynaleźć wszystko), brak doświadczenia i tym samym powtarzają te same błędy przeszłości. A jeżeli tego nie wystarczy, to dodawanie pod nie paczek do dystrybucji to tylko kupa roboty bez żadnej realnej korzyści.

PyPIflit-coreDistribution-building parts of Flit. See flit package for more information

I suppose I could use my experience to give some #PEP517 build system recommendations.

For pure #Python packages:

1. #flit_core (pypi.org/project/flit-core/) — it's lightweight and simple, and has no dependencies (in modern Python versions, for older Pythons it vendors tomli).

2. #hatchling (pypi.org/project/hatchling/) — it's popular and quite powerful, but has many vendored dependencies and no stand-alone test suite (which makes it painful to maintain in #Gentoo).

For Python packages with C extensions: #meson-python (pypi.org/project/meson-python/) — which combines the power and correctness of meson build system with good very Python integration.

For Python packages with Rust extensions: #maturin (pypi.org/project/maturin/) — which is simply a good builder for precisely that kind of packages.

Now, I strongly discourage:

A. #setuptools — lots of vendored NIH dependencies (that can alternatively be unvendored for cyclic deps), lots of deprecations over time (we're still seeing tons of deprecation warnings all over the place), many unsolved bugs (e.g. parallel C extension builds are broken in a few ways), a lot of technical debt, and if all that wasn't enough, it's slow.

B. #poetry-core — a very tricky build system with lots of pitfalls (I've reported a lot of mistakes done when migrating to it).

C. Practically any other build system — writing new backends is trivial, so everyone and their grandmother must have one. And then, they often carry a lot of NIH dependencies (if you're reinventing a build system, you may reinvent everything else), lack experience and reintroduce the same bugs. And if that wasn't enough, packaging them in distributions is a lot of work for no real benefit to anyone.

PyPIflit-coreDistribution-building parts of Flit. See flit package for more information

Jakiś czas temu dwa systemy budowania #PEP517 dorobiły się funkcji weryfikacji klasyfikatorów #PyPI ("trove classifiers"). Na pierwszy rzut oka, ma to sens: wszak warto poinformować autorów paczek od razu, jeżeli gdzieś popełniono błąd i paczka zostanie odrzucona. Problem stanowi jednak fakt, że ta weryfikacja dotyczy również budowania paczek lokalnie — a więc użytkowników #Gentoo.

Funkcję zbudowano w oparciu o paczkę "trove-classifiers". Ilekroć nowy klasyfikator dodawany jest do PyPI, wydawana jest nowa wersja tej paczki. Jeżeli używamy narzędzi takich jak `build` czy `pip`, każdorazowo z sieci instalowana jest najnowsza wersja tej paczki. Na Gentoo natomiast, o ile nie wymusimy tego zależnościami, użytkownik może mieć przestarzałą. Jeżeli wówczas spróbuje zainstalować paczkę Pythona, która używa nowszych klasyfikatorów, otrzyma mylący błąd o błędnym klasyfikatorze. Mylący, bowiem: 1) wbrew komunikatowi, klasyfikator jest poprawny; 2) nawet gdyby nie był, to problem nas w ogóle nie dotyczy.

Dlatego też wystąpiliśmy z prośbą o możliwości wyłączenia tej funkcji. Choć zajęło to trochę czasu, opiekun paczki #Hatchling wykazał zrozumienie dla naszego problemu i zaakceptował moją łatkę. Z kolei opiekun #setuptools… no cóż, podjął się długiej i bezowocnej debaty, która poskutkowała zignorowaniem trywialnego rozwiązania głównego problemu ("niepotrzebna komplikacja"). Zamiast tego, zaproponowano nam rozwiązanie dosyć wątpliwe — całkowite wyłączenie weryfikacji poprawności pliku `pyproject.toml`. Rozwiązanie nieakceptowalne z dwóch powodów: 1) dlatego, że setuptools polega na tej weryfikacji (a więc przy błędach w pliku moglibyśmy dostać zepsutą instalację zamiast błędu); 2) dlatego, że przy budowaniu każdej paczki rzuca paskudnym ostrzeżeniem. W praktyce więc znęcalibyśmy się nad użytkownikami Gentoo, zarzucając ich fałszywymi ostrzeżeniami, i niektórzy z nich prawdopodobnie niepotrzebnie zgłaszaliby problem autorom właściwej paczki.

Nie używajcie setuptools.

github.com/pypa/hatch/issues/1
github.com/pypa/setuptools/iss

GitHubPlease make trove classifier validation optional/non-fatal · Issue #1368 · pypa/hatchBy mgorny

Some time ago two #PEP517 build systems introduced #PyPI trove classifier verification. At a first glance, it makes sense. After all, if you made a mistake somewhere, you'd rather know early than when you try to upload the package. The problem is, that the verification fires for people building packages locally too — including #Gentoo users.

Now, this function was based on the #Python "trove-classifiers" package. Whenever a new classifier is introduced, a new release of the package is made. When you're building a package using tools such as `build` or `pip` (isolated build), the newest version of this package is being installed from the Internet. On the other, a Gentoo user may have an old version, unless we enforce an upgrade via package dependencies. Then building packages that use newer classifiers will fail, and with a confusing message too. Confusing because: 1) contrary to the message, the classifier is valid; and 2) even if it weren't, it doesn't affect us in any way.

And so we asked for an ability to disable this. While it took some time, the #Hatchling showed understanding and eventually merged my patch. On the other hand, the #setuptools maintainer… well, started a long and tedious debate that resulted in ignoring the trivial solution to the actual problem (as "unnecessary complexity"). Instead, we were given another option: we could entirely disable `pyproject.toml` validation. It's not really acceptable, for two reasons: 1) because setuptools actually rely on this validation (so removing it could result in broken package installs instead of an error, if the file is not valid), and 2) because it produces an awful warning on every package build. So we'd end up bullying Gentoo users with false warnings, and some of them would probably end up filing invalid bugs to various upstreams.

The bottom line is: don't use setuptools.

github.com/pypa/hatch/issues/1
github.com/pypa/setuptools/iss

GitHubPlease make trove classifier validation optional/non-fatal · Issue #1368 · pypa/hatchBy mgorny

Jak uprzejmie zasugerować komuś, że stworzony przezeń system budowania #PEP517 to typowe #NIH? Można tak:

github.com/repo-helper/whey/is

No i tak, kompletne NIH, wymaga ConsoleKit (serio?!), wymaga kilku innych paczek NIH tego autora, i ma stale bota. No i praktycznie rzecz biorąc, jedynie autor używa tego wynalazku.

Więc dlaczego się tym przejmuję? Bo ten sam autor stworzył wtyczkę dla systemu budowania #Hatchling, hatch-requirements-txt, i ta wtyczka zależy od paczek, które używają wheya. No więc tak, mamy tu kolejny przykład osoby, która zrobiła jedną potencjalnie użyteczną paczkę (ja jej za taką nie uważam, ale inne projekty używają), i za jej pomocą wymusza na innych całą resztę swoich NIH-projektów.

GitHub[Documentaton] What makes whey different? · Issue #52 · repo-helper/wheyBy danieldjewell

How to politely point out that somebody's #PEP517 build system is utter #NIH? Here's one whey… err, way:

github.com/repo-helper/whey/is

And yes, it's complete NIH, with a dependency on ConsoleKit (seriously?!), a bunch of NIH packages, and a stale bot. On top of that, it's practically used only by its author.

So why do I care? Because the same person also made hatch-requirements-txt #Hatchling plugin, and said plugin depends on NIH packages (of course it does) using whey. So yeah, another case of making one potentially useful package (actually, I don't consider it useful, but random projects depend on it now) and using it to force your NIH projects on everyone.

GitHub[Documentaton] What makes whey different? · Issue #52 · repo-helper/wheyBy danieldjewell

Essentially, distro developers are firefighters, putting out fires made by careless upstreams.

What I've wasted time on, today:

- making the non-standalone test suite of #Hatchling (sigh) work without #UV again, so that a critical build dependency of a growing number of #Python packages could be tested everywhere

gitweb.gentoo.org/repo/gentoo.
bugs.gentoo.org/930662

- fixing effectively dead (but with a promise of revival) #PassLib not to break random stuff via printing warnings when using newer #BCrypt versions

gitweb.gentoo.org/repo/gentoo.
bugs.gentoo.org/925289

- hacking the test suite of #ImageIO work using an offline copy of test data, rather than cloning its git repository at the beginning of tests

gitweb.gentoo.org/repo/gentoo.

I really wish people would consider donating to distro developers more often, rather than to projects that create this thankless work for us.

gitweb.gentoo.orgrepo/gentoo.git - Official Gentoo ebuild repositoryBrowse the Gentoo Git repositories

W gruncie rzeczy, devowie distro są jak strażacy, walczący z pożarami wywołanymi przez nieostrożnych twórców oprogramowania.

Dzisiaj zmarnowałem czas na:

- naprawienie testów systemu budowania #Hatchling (które nie są wyodrębnione od testów Hatcha, wzdych), by działały znów bez #UV, abyśmy powtórnie mogli wszędzie testować tę krytyczną zależność rosnącej liczby paczek Pythona

gitweb.gentoo.org/repo/gentoo.
bugs.gentoo.org/930662

- naprawianie praktycznie martwej (ale z obietnicą resuscytacji) biblioteki #PassLib, by nie psuła przypadkowych paczek, wypisując ostrzeżenia z nowszymi wersjami biblioteki #BCrypt

gitweb.gentoo.org/repo/gentoo.
bugs.gentoo.org/925289

- obchodzenie upierdliwości w #ImageIO tak, by dało się tę bibliotekę testować offline, z pobranymi wcześniej danymi, zamiast przy każdym uruchomieniu testów klonować repozytorium git

gitweb.gentoo.org/repo/gentoo.

Naprawdę chciałbym, by ludzie częściej rozważali wsparcie devów distro, a nie tylko projektów, które tworzą im tę niewdzięczną pracę.

gitweb.gentoo.orgrepo/gentoo.git - Official Gentoo ebuild repositoryBrowse the Gentoo Git repositories

Po otrzymaniu kolejnego zgłoszenia błędu, że pythonowa paczka (tym razem #VirtualEnv) nie buduje się, bo użytkownik nie ma dostatecznie nowej wersji paczki #TroveClassifiers, zgłosiłem wniosek o to, by #Hatchling uczyniło weryfikację "trove classifiers" opcjonalną, albo przynajmniej nie traktowało jej niepowodzenia jako błędu.

W tej chwili z tym się po prostu nie da ujechać. Technicznie rzecz biorąc, każda paczka musiałaby deklarować *minimalną* wersję paczki `trove-classifiers`, która dostarcza niezbędne im identyfikatory, a my musielibyśmy kopiować te specyfikacje do ebuildów w #Gentoo. Jednakże to mało prawdopodobne, więc w praktyce zmuszeni jesteśmy sprawdzać wszystkie identyfikatory, używane przez paczki, i dopasowywać je do wersji `trove-classifiers`. Albo — bardziej realistycznie — zawsze wymagać najnowszej dostępnej wersji, i mieć nadzieję, że nie zapomnimy regularnie aktualizować tej zależności.

github.com/pypa/hatch/issues/1
bugs.gentoo.org/928447

GitHubPlease make trove classifier validation optional/non-fatal · Issue #1368 · pypa/hatchBy mgorny

After getting yet another bug report about #Python package (this time #VirtualEnv) failing to build, because the user did not have new enough #TroveClassifiers installed, I've filed a bug asking #Hatchling to make trove classifier validation either optional or non-fatal.

Right now this simply is not feasible. Technically, every package would need to specify a *minimal* `trove-classifiers` package dependency based on the classifiers they used, and we would have to keep these versions in every #Gentoo ebuild. However, that's unlikely to ever happen, so we'd actually have to check all listed trove classifiers and map them back to package versions. Or, more realistically, just always depend on the newest trove-classifiers available and hope we don't forget to update the dependency.

github.com/pypa/hatch/issues/1
bugs.gentoo.org/928447

GitHubPlease make trove classifier validation optional/non-fatal · Issue #1368 · pypa/hatchBy mgorny

To quote myself:

"""
Honestly, I think the biggest problem here is that #Python #packaging is infinitely complex and counter-intuitive, which means that anyone involved on either end is surprised to find a very high barrier of entry. The #Gentoo Python Guide has already 300 KiB of .rst files, and it is by no means comprehensive. At this point, distribution developers pretty much can't really package anything written in Python without getting a special training and/or senior developer review, and even senior developers have a hard time following the constantly changing landscape.

At the same time, Python framework in Gentoo has already a bunch of safety checks included to detect the most common pitfalls. Again, it is by no means comprehensive and I keep extending it whenever we discover yet another counterintuitive pitfall. This thread makes me think that we will need to add another check to make sure that PKG-INFO is dealt with when pyproject.toml is patched.
"""

discuss.python.org/t/respectin

Discussions on Python.org · Respecting Core Metadata 2.2 when building from source distributionsOn reflection, I think that the issue here around unpacked sdists is somewhat orthogonal to the intent behind Metadata 2.2. As far as the spec is concerned, the key is that if a tool is given a sdist, and it builds a wheel from it, then the resulting wheel will contain metadata that matches what’s in the PKG-INFO of the sdist. The spec has no interest in what happens if you unpack a sdist, modify it, and then build - it’s an accident of implementation that the sdist is unpacked by one tool (the ...

Cytując siebie (i tłumacząc):

"""
Szczerze mówiąc, uważam, że największym problemem jest to, że dystrybucja oprogramowania w Pythonie jest nieskończenie skomplikowana i nieintuicyjna, co oznacza, że każda osoba, która chce się tym zająć z którejkolwiek strony, ku swojemu zaskoczeniu odkryje bardzo wysoki próg wejścia. #Gentoo #Python Guide ma już 300 KiB plików .rst, i w żaden sposób nie jest kompletne. W tej chwili, przeciętny dev nie jest w stanie wrzucić czegokolwiek napisanego w Pythonie do dystrybucji, nie przechodząc wcześniej specjalnego szkolenia i/lub otrzymując przeglądu kodu od kogoś bardziej doświadczonego, a i owi seniorzy mają sporą trudność w nadążaniu za ciągłymi zmianami.

Jednocześnie, framework Pythona w Gentoo ma już sporo zabezpieczeń, które wykrywają najczęstsze błędy. To jednak też nie jest w żaden sposób kompletne, i dokładam kolejne, ilekroć odkrywamy kolejną nieintuicyjną pułapkę. Z tego wątku odnoszę wrażenie, że będziemy musieli dodać kolejne zabezpieczenie, które będzie upewniać się, że kiedy pyproject.toml jest modyfikowany, zajęto się również PKG-INFO.
"""

discuss.python.org/t/respectin

Discussions on Python.org · Respecting Core Metadata 2.2 when building from source distributionsOn reflection, I think that the issue here around unpacked sdists is somewhat orthogonal to the intent behind Metadata 2.2. As far as the spec is concerned, the key is that if a tool is given a sdist, and it builds a wheel from it, then the resulting wheel will contain metadata that matches what’s in the PKG-INFO of the sdist. The spec has no interest in what happens if you unpack a sdist, modify it, and then build - it’s an accident of implementation that the sdist is unpacked by one tool (the ...

Trwa aktualnie dyskusja w temacie Pythona o tym, jak pliki `pyproject.toml` i `PKG-INFO` mają być używane w archiwach sdist. Pokrótce rzecz ujmując, nowa wersja #Hatchling zaczęła traktować `PKG-INFO` jako autorytatywne źródło metadanych. Dla dystrybucji, oznacza to, że jeżeli wprowadzaliśmy zmiany do `pyproject.toml`, to te zmiany nagle przestaną działać. I tak np. jeżeli pozbywaliśmy się przypiętych starych wersji zależności, to Hatchling cichaczem przywróci je z `PKG-INFO`.

Dyskusja nadal trwa, ale już pojawiły się niepokojące komentarze. Takie jak np. sugestia, że jeżeli coś zmieniamy, to powinniśmy zmodyfikować też wersję paczki…

discuss.python.org/t/respectin

Discussions on Python.org · Respecting Core Metadata 2.2 when building from source distributionsBasically, this issue: Persistent dynamic core metadata breaks user assumptions · Issue #1334 · pypa/hatch · GitHub Hatchling now uses the PKG-INFO file to derive metadata in an effort to comply with the spec. My assumption was that using that file was the way to achieve that based on my reading of the standard even though that file is not explicitly mentioned there but rather in the living document for the source distribution format. I think Flit is compliant because metadata is static (or at...

There's an open discussion in #Python packaging how `pyproject.toml` and `PKG-INFO` should interact in sdist. Long story short, new version of #Hatchling started taking `PKG-INFO` for granted. For distribution packagers, this means that patching `pyproject.toml` after unpacking sdist suddenly stopped working, and e.g. if you fixed dependency pins in it, hatchling would instead silently used pinned dependencies from `PKG-INFO`.

The discussion is still open, but there's already been some worrying comments, such as people should modify package versions when they patch them…

discuss.python.org/t/respectin

Discussions on Python.org · Respecting Core Metadata 2.2 when building from source distributionsBasically, this issue: Persistent dynamic core metadata breaks user assumptions · Issue #1334 · pypa/hatch · GitHub Hatchling now uses the PKG-INFO file to derive metadata in an effort to comply with the spec. My assumption was that using that file was the way to achieve that based on my reading of the standard even though that file is not explicitly mentioned there but rather in the living document for the source distribution format. I think Flit is compliant because metadata is static (or at...

Wygląda na to, że #Hatchling 1.22* ma mały błąd, który może sprawić, że paczki (np. #black) będą instalowane bez skryptów ("entry points"). Z jakiegoś powodu, generowane archiwum sdist zawiera plik PKG-INFO bez listy ingresji, a hatchling używa go, by utworzyć archiwum wheel bez ingresji. Problem nie występuje, jeśli budujesz wheel wprost ze źródeł, w których nie ma PKG-INFO.

github.com/pypa/hatch/issues/1

GitHubHatchling 1.22.1 doesn't produce entry points for `black-24.3.0` (via `PKG-INFO`) · Issue #1325 · pypa/hatchBy mgorny