Running dmypy as a systemd user service
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- python
- 領域
- cli, devops, operating-systems
調査の方向性
dmypy start と dmypy daemon のエントリーポイントから始め、--status-file とデフォルトの .dmypy.json の場所がどのように解決されるかを追跡します。その動作を、提案されている XDG_RUNTIME_DIR または /run/user/$UID/mypy の場所と比較します。systemd のユーザーサービスがラッパーなしで dmypy を実行でき、既存の status-file の動作も引き続き利用できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Feature
Make dmypy look for either its status file or maybe even the socket in a well-known place.
As this well-known place I propose for Linux systems a directory /run/user/$UID/mypy (or the value of the environment variable XDG_RUNTIME_DIR). The name of status file would encode the path for which dmypy is running.
Pitch
mypy can be run as a daemon, which is currently manually started via dmypy start. It can already run in the foreground via dmypy daemon and I have started to use this to start the mypy daemon on login on my Linux system as a systemd user service as this moves the management of the lifecycle of the daemon to the service manager, that I already have running (as does the vast majority of Linux systems), so that I don't have to think about it anymore.
I do this via this service file in ~/.config/systemd/user/
# mypy@.service
[Unit]
Description=mypy daemon
[Service]
Type=simple
WorkingDirectory=%I
ExecStart=dmypy --status-file %t/mypy/%I.json daemon
RuntimeDirectory=mypy
which is instantiated via systemctl enable mypy@$(systemd-escape /path/to/my/project).service. The specifiers %I and %t expand to /path/to/my/project and the value of XDG_RUNTIME_DIR (by default /run/user/$UID). respectively. I then have a wrapper function for dmypy that sets --status-file to the appropriate value for my project directory (/run/user/$UID/mypy/$(systemd-escape $(git rev-parse --show-toplevel)).json to be specific).
I would like to streamline this setup, so that the wrapper is no longer necessary by having mypy look not only for .dmypy.json by default, but also check for the existence of the status file in the above described well-known location. This would allow e.g. for distributions packaging mypy to ship this or a similar service file to users and automatically restart the daemon on upgrades.
The feature itself is extensible. This directory could be used for the dmypy socket directly instead of giving it a random name in /tmp, but I have not yet looked into why this was designed as it is.
I guess a similar feature could be implemented for launchd on MacOS and on Windows, but I have no knowledge of these systems.
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- 平均マージ
- 1日 18時間
- マージ済み PR(30日)
- 54
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/mypy のほかの issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
bug topic-configuration topic-error-reporting
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
bancolombia/sentinel#23 ·
-
test md オープンCI
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
-
bug client
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100