Hatch v1.8.0¶Hatch v1.8.0¶
Hatch v1.8.0 brings Python distribution management, static analysis and formatting backed by Ruff, and binaries for every platform.Hatch v1.8.0 は、Pythonの配布管理、Ruffによる静的解析とフォーマット、すべてのプラットフォーム向けのバイナリを提供します。
Installation made easy¶インストールが簡単に¶
One thing that has been a perpetual problem for Hatch and other Python applications is that Python itself is a dependency. You, and more importantly your users, need to in some way get Python before your software can even be used. The recommended way to go about that is platform-dependent and even differs based on your target audience. I viewed this as a central UX problem for Hatch and so severe that I took a bit of a hiatus to solve it.Hatchや他のPythonアプリケーションにとって永続的な問題の一つは、Python自体が依存関係であることです。あなたと、そしてより重要なことにあなたのユーザーは、ソフトウェアを使用する前に何らかの形でPythonを取得する必要があります。それを行うための推奨方法はプラットフォームに依存し、ターゲットオーディエンスによっても異なります。私はこれをHatchの中心的なUXの問題と見なし、それを解決するために少しの休止を取りました。
Luckily, I have to my satisfaction solved this problem in the form of PyApp. It is a runtime installer for Python projects written in Rust. Apps are distributed as standalone executables as users have come to expect and bootstrapping occurs upon the first invocation. Here is an example of what you would see the first time you run a binary from this release:幸運なことに、私はこの問題をPyAppという形で満足のいくように解決しました。これはRustで書かれたPythonプロジェクトのためのランタイムインストーラーです。アプリは、ユーザーが期待するようにスタンドアロンの実行可能ファイルとして配布され、初回の呼び出し時にブートストラップが行われます。ここに、このリリースからバイナリを初めて実行したときに表示されるものの例があります:
Now that we have binaries, creating installers for different platforms becomes trivial. Starting with this release not only are binaries available for every platform but also we have installers for Windows and macOS. The installer for macOS is signed using a certificate from the same account used to sign the official distributions from https://www.python.org, so users will not get any security pop-ups. Shout out to @ewdurbin for their extreme generosity in setting up multiple certificates in their free time!バイナリがあるので、異なるプラットフォーム向けのインストーラーを作成することが簡単になります。このリリースからは、すべてのプラットフォーム向けにバイナリが利用可能であるだけでなく、WindowsとmacOS向けのインストーラーもあります。macOS向けのインストーラーは、https://www.python.orgからの公式配布に署名するために使用されるのと同じアカウントからの証明書を使用して署名されているため、ユーザーはセキュリティポップアップを受け取ることはありません。複数の証明書を設定してくれた@ewdurbinに感謝します!
These installers and binaries are now the recommended way to install and update Hatch. These binaries have built-in management so you can update to the latest version by running hatch self update.これらのインストーラーとバイナリは、現在、推奨される方法としてHatchをインストールおよび更新するためのものです。これらのバイナリには組み込みの管理機能があり、hatch self updateを実行することで最新バージョンに更新できます。
Windows signingWindows署名
In future we will sign the installers for Windows but I did not have time to look into how that works. macOS signing took way longer than I anticipated 将来的にはWindows用のインストーラーに署名を行いますが、その仕組みを調べる時間がありませんでした。macOSの署名には予想以上に時間がかかりました
Python management¶Python管理¶
For a long time I and other users have desired that Hatch gain the ability to manage Python distributions. In my mind this was always blocked on a better installation experience because there was sort of a chicken-or-egg problem where you want a Python manager but you first need Python. No longer is that the case!長い間、私や他のユーザーはHatchがPythonディストリビューションを管理できるようになることを望んでいました。私の考えでは、これは常により良いインストール体験にブロックされていました。なぜなら、Pythonマネージャーが必要ですが、まずPythonが必要という鶏と卵の問題があったからです。しかし、もはやそのようなことはありません!
The new python command group allows for easy installation of various distributions to arbitrary locations which are then added to your PATH by default. Hatch supports CPython and PyPy distributions:新しいpythonコマンドグループは、さまざまなディストリビューションを任意の場所に簡単にインストールできるようにし、それらはデフォルトでPATHに追加されます。HatchはCPythonおよびPyPyディストリビューションをサポートしています:
Virtual environment Python resolution¶仮想環境のPython解決¶
The virtual environment type is now far more intelligent when resolving the parent distribution to use and guarantees that, when no specific version is requested, the resolved distribution will always be compatible with the project.virtual環境タイプは、使用する親ディストリビューションを解決する際に、はるかに賢くなり、特定のバージョンが要求されない場合、解決されたディストリビューションが常にプロジェクトと互換性があることを保証します。
Additionally, when a requested version cannot be found on PATH it will automatically be downloaded and managed internally.さらに、要求されたバージョンがPATH上で見つからない場合、それは自動的にダウンロードされ、内部で管理されます。
Static analysis¶静的解析¶
There is a new fmt command, backed entirely by Ruff, that checks and fixes your code for formatting and linting issues.新しいfmtコマンドが追加され、完全にRuffによってサポートされており、コードのフォーマットやリンティングの問題をチェックして修正します。
Starting with this release, Hatch maintains default settings that are guaranteed to be up-to-date and represent best practices for programming in modern Python. The idea is to provide defaults that are so broadly applicable that the majority of users will maintain little if any of their own overrides.このリリースから、Hatchは最新の状態であり、現代のPythonプログラミングのベストプラクティスを表すことが保証されたデフォルト設定を維持します。このアイデアは、ほとんどのユーザーが自分自身のオーバーライドをほとんど維持しないほど広く適用可能なデフォルトを提供することです。
The default behavior is internal management of settings to provide an OOTB experience that works. It is recommended however that you persist the default config file in version control so that other tools like IDEs can utilize your full configuration.デフォルトの動作は、設定の内部管理を行い、機能するOOTB(Out Of The Box)体験を提供します。ただし、他のツール(IDEなど)が完全な構成を利用できるように、デフォルトの設定ファイルをバージョン管理に永続化することをお勧めします。
Since Ruff is now provided as a built-in feature, new project templates no longer have such configuration and are much less verbose.Ruffが組み込み機能として提供されるようになったため、新しいプロジェクトテンプレートにはそのような設定がなく、はるかに冗長性が少なくなりました。
Build improvements¶ビルドの改善¶
Building projects that do not use Hatchling as a backend is now supported and such builds are managed with the standard build tool.Hatchlingをバックエンドとして使用しないプロジェクトのビルドがサポートされるようになり、そのようなビルドは標準のbuildツールで管理されます。
The bridge between Hatch and the Hatchling CLI has been removed. Previously, the builder would send serialized messages to Hatch that would contain the desired content and style for each line of output. This was done in an effort to allow builder and build hook plugins to output pretty messages without actually requiring a dependency like Rich. A problem that arises with this is that builders that invoke subprocesses will not display ANSI codes as one might expect and will lose out on the interactive experience of such invocations, like the built-in binary builder plugin calling cargo build. So now everything is simpler at the expense of no colored output without manual logic, or adding a dependency if you're a third-party plugin.HatchとHatchling CLIの間のブリッジが削除されました。以前は、ビルダーがHatchにシリアライズされたメッセージを送信し、出力の各行の望ましい内容とスタイルを含んでいました。これは、ビルダーとビルドフックプラグインがRichのような依存関係を実際に必要とせずに美しいメッセージを出力できるようにするために行われました。この問題は、サブプロセスを呼び出すビルダーがANSIコードを期待通りに表示せず、そのような呼び出しのインタラクティブな体験を失うことです。たとえば、組み込みのバイナリビルダープラグインがcargo buildを呼び出す場合です。したがって、手動のロジックなしで色付きの出力がなくなる代わりに、すべてがシンプルになりました。サードパーティプラグインの場合は依存関係を追加する必要があります。
Faster environment usage¶環境使用の高速化¶
Spawning a shell or running commands within environments always first checks that your project's dependencies are satisfied and if not synchronizes the environment with what is defined. Previously, this had the potential to be quite slow for projects that have many dependencies.シェルを起動するかコマンドを実行する際には、常に最初にプロジェクトの依存関係が満たされているかを確認し、満たされていない場合は定義された内容と環境を同期します。以前は、多くの依存関係を持つプロジェクトにとってかなり遅くなる可能性がありました。
Now the set of dependency definitions is hashed and no check is performed if the hash is the same as before, significantly speeding up environment usage in most cases.現在、依存関係の定義セットはハッシュ化され、ハッシュが以前と同じであればチェックは行われず、ほとんどの場合、環境使用が大幅に高速化されます。
Hatchling¶Hatchling¶
Hatch now depends on Hatchling v1.19.0, which was also just released.Hatchは現在、Hatchling v1.19.0に依存しており、これも最近リリースされました。
Better defaults¶より良いデフォルト¶
Hatchling is all about providing the best possible defaults, even at the expense of backward compatibility. In this release, there are two breaking changes that provide a much better user experience and were in fact requested by users.Hatchlingは、後方互換性を犠牲にしてでも、可能な限り最良のデフォルトを提供することに重点を置いています。このリリースでは、ユーザーから実際に要求された、はるかに良いユーザーエクスペリエンスを提供する2つの破壊的変更があります。
- Both the
force-includeoption and theforce_include_editablewheel build data setting now raise errors if source paths do not exist.両方のforce-includeオプションとforce_include_editableホイールビルドデータ設定は、ソースパスが存在しない場合にエラーを発生させるようになりました。 - The
wheelbuild target now raises an error when no file inclusion options have been defined and none of its heuristics to determine what to ship are satisfied.wheelビルドターゲットは、ファイルインクルージョンオプションが定義されておらず、そのヒューリスティックのいずれも満たされていない場合にエラーを発生させるようになりました。
Binary build target¶バイナリビルドターゲット¶
A new binary build target is now stable that allows for the building of standalone binaries for projects. This is what Hatch itself uses for its binaries.プロジェクトのスタンドアロンバイナリをビルドするための新しいbinaryビルドターゲットが安定しました。これがHatch自体がバイナリに使用しているものです。
Meta¶メタ¶
Why Hatch?¶なぜHatchなのか?¶
A new page has been introduced that discusses the value proposition of Hatch and Hatchling in comparison to alternatives. Currently, it only addresses a few features but in future this page will become more comprehensive.新しいページが導入され、HatchとHatchlingの価値提案が代替品と比較して議論されています。現在はほんのいくつかの機能にしか触れていませんが、将来的にはこのページがより包括的になる予定です。
Future¶未来¶
Upcoming features include a test command, commands to manage dependencies, and workspaces functionality similar to Cargo that will make managing monorepos far easier.今後の機能には、testコマンド、依存関係を管理するためのコマンド、およびモノレポの管理をはるかに簡単にするCargoに似たワークスペース機能が含まれます。
Next year there will be two large efforts that you should expect to see:来年は、期待すべき2つの大きな取り組みがあります:
-
A significant amount of my free time (and some at work) will be devoted to introducing lock file functionality in Hatch and trying to get whatever that happens to be standardized.私の自由時間のかなりの部分(および仕事の一部)は、Hatchにロックファイル機能を導入し、それが標準化されるように努めることに費やされる予定です。
I met with @brettcannon about his thoughts post-PEP 665 and about mousebender. I also met with the prefix.dev team about rip and was fortunate enough to be shown a demo before its official announcement.@brettcannonと、PEP 665後の彼の考えや、mousebenderについて話しました。また、prefix.devチームとも、ripについて話し、公式発表前にデモを見せてもらう幸運に恵まれました。
At the moment, the two options I see are to either go all in and contribute to mousebender or rely on the Prefix folks and use rip. The latter has the benefit of potentially supporting Conda as a side effect with the downside of being quite new with the spec firmly out of our control. The former has the benefit of being able to easily gain institutional support from the Python packaging team and each of our employers with the downside being a significant amount of work needing to be done.現時点で私が考えている2つの選択肢は、mousebenderに全力で貢献するか、Prefixの人々に頼ってripを使用するかです。後者は、潜在的にCondaを副次的にサポートする利点がありますが、仕様が私たちの制御外にあるため、かなり新しいという欠点があります。前者は、Pythonパッケージングチームや私たちの雇用主からの制度的サポートを容易に得られる利点がありますが、かなりの作業が必要になるという欠点があります。
-
When @henryiii is able to get some free time away from teaching I plan to work with him once again and push very hard for the Python build ecosystem to adopt the extensionlib approach.@henryiiiが教えることから少し自由な時間を得たら、再び彼と一緒に作業し、Pythonビルドエコシステムがextensionlibアプローチを採用するように強く推進するつもりです。
I am of the opinion that the Python community has not fully completed the expressed outcome of PEP 517 in that build backends are still (for the most part) reliant on setuptools for building non-Python code bases.私は、PythonコミュニティがPEP 517の表現された成果を完全に達成していないと考えています。というのも、ビルドバックエンドは依然として(ほとんどの場合)非Pythonコードベースをビルドするためにsetuptoolsに依存しているからです。
Basically, there are components that interact with compilers to produce extension modules and components that pack files into an archive which we call a build backend. These are two distinct pieces of functionality and my view is that there should be an API that allows backends to consume extension module builders to find out where things got created and where they should be shipped inside archives.基本的に、拡張モジュールを生成するためにコンパイラと相互作用するコンポーネントと、ファイルをアーカイブにパックするコンポーネントがあり、これをビルドバックエンドと呼びます。これらは2つの異なる機能であり、私の見解では、バックエンドが拡張モジュールビルダーを消費して、どこで作成されたか、アーカイブ内でどこに出荷されるべきかを知ることができるAPIが必要です。
In this hypothetical future any build backend would be able to trigger the building of extension modules based on user configuration.この仮想的な未来では、任意のビルドバックエンドがユーザーの設定に基づいて拡張モジュールのビルドをトリガーできるようになります。
Support¶サポート¶
If you or your organization finds value in what Hatch provides, consider a sponsorship to assist with maintenance and more rapid development!もしあなたやあなたの組織がHatchの提供する価値を見出した場合、メンテナンスやより迅速な開発を支援するためにスポンサーシップを検討してください!

