Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
131 lines (114 loc) · 4.7 KB
/
Copy pathpyproject.toml
File metadata and controls
131 lines (114 loc) · 4.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
[project]
name = "usage-cli"
version = "0.34.9"
description = "usage — 在 macOS menu bar 與 Windows 系統匣顯示 Claude Code、Codex、Antigravity 用量的小工具(也提供終端機 TUI)"
readme = "README.md"
requires-python = ">=3.13"
license = "AGPL-3.0-only"
license-files = ["LICENSE", "THIRD_PARTY_NOTICES.md"]
dependencies = [
"zstandard>=0.25.0,<1.0.0",
"pyobjc-framework-Cocoa>=11.0; sys_platform == 'darwin'",
"pyobjc-framework-Quartz>=11.0; sys_platform == 'darwin'",
"pyobjc-framework-UserNotifications>=11.0; sys_platform == 'darwin'",
"pyobjc-framework-WebKit>=11.0; sys_platform == 'darwin'",
"rich>=15.0.0,<16.0.0",
]
[project.optional-dependencies]
windows = [
"pystray>=0.19.5; sys_platform == 'win32'",
"pillow>=13.0.0; sys_platform == 'win32'",
"pywebview>=5.4; sys_platform == 'win32'",
"windows-toasts>=1.3.1; sys_platform == 'win32'",
]
[project.scripts]
usage = "usage_app.cli:main"
usage-cli = "usage_app.cli:main"
[tool.uv]
# Lock for every platform we ship on, not just whichever one runs `uv lock`.
# Without this, uv resolves against the running interpreter's environment and
# rewrites the platform markers it can prove false there — a re-lock on Windows
# turns every `sys_platform == 'darwin'` dependency into `python_version < '0'`,
# silently dropping PyObjC from the lock and breaking the macOS build.
environments = [
"sys_platform == 'darwin'",
"sys_platform == 'win32'",
"sys_platform == 'linux'",
]
[build-system]
requires = ["setuptools>=84.0.0"]
build-backend = "setuptools.build_meta"
[tool.setuptools]
py-modules = [
"main",
"setup_app",
]
[tool.setuptools.packages.find]
include = ["usage_hooks*", "adapters*", "analyzer*", "installer*", "loaders*", "menubar*", "panels*", "quota*", "tui*", "ui*", "updates*", "usage_app*", "usage_common*", "wintray*"]
# Top-level modules cannot collect adjacent data files via package-data.
[tool.setuptools.data-files]
"share/usage" = ["i18n.json"]
[dependency-groups]
dev = [
"ruff>=0.16.2",
"mypy>=2.3.1",
"pytest>=9.1.1",
]
build = [
"py2app>=0.28; sys_platform == 'darwin'",
"pyinstaller>=6.22.3; sys_platform == 'win32'",
# The [build-system] backend, locked here so release.yml can build the
# PyPI wheel with --no-build-isolation instead of fetching an unpinned one.
"setuptools>=84.0.0",
]
[tool.ruff]
target-version = "py313"
line-length = 100
extend-exclude = ["release-win"]
[tool.ruff.lint]
select = ["E", "F", "I", "UP", "B", "SIM"]
[tool.ruff.lint.per-file-ignores]
# usage_hooks/usage_statusline.py 設計成可以用系統 python3 跑(macOS 內建是 3.9),
# 必須避開 3.11+ 才有的 datetime.UTC,用 timezone.utc 取代。
"usage_hooks/usage_statusline.py" = ["UP017"]
# usage_hooks/usage_session_resume.py 同樣裝進 ~/.claude/ 給系統 python3 (3.9) 跑,同一條限制。
"usage_hooks/usage_session_resume.py" = ["UP017"]
"usage_hooks/usage_quota_aware.py" = ["UP017", "UP045"]
"usage_hooks/usage_statusline_agy.py" = ["UP017"]
# Imported analytics source is kept with minimal path fixes; keep formatting
# stable for this integration commit.
"adapters/**/*.py" = ["E501", "I001", "SIM108", "UP015", "UP017"]
"analyzer/**/*.py" = ["E501", "I001", "UP015", "UP017"]
"ui/**/*.py" = ["E501", "I001", "UP017", "UP035"]
"usage_app/cli.py" = ["E501", "I001", "UP017"]
[tool.mypy]
python_version = "3.13"
strict = true
warn_unused_configs = true
pretty = true
exclude = "^(build|dist|release-win)/"
[[tool.mypy.overrides]]
module = ["rich.*", "PIL.*", "pystray.*", "webview.*", "windows_toasts.*"]
ignore_missing_imports = true
# PyObjC C-extension frameworks ship without type stubs / py.typed marker.
# `ignore_missing_imports` is the standard idiom for stubless modules — this
# is NOT suppressing a real bug, just declaring the frameworks are untyped.
[[tool.mypy.overrides]]
module = ["AppKit", "Foundation", "objc", "PyObjCTools.*", "Quartz", "UserNotifications", "WebKit"]
ignore_missing_imports = true
# usage_app.cli's key readers pair a POSIX branch (termios/tty) with a Windows
# branch (msvcrt); each side's `type: ignore` comments are only "used" when
# mypy runs on the other platform, so unused-ignore warnings must stay off
# for this module to keep `mypy .` green on both macOS and Windows CI.
[[tool.mypy.overrides]]
module = "usage_app.cli"
warn_unused_ignores = false
# tests/test_usage_statusline.py forks a child to contend the POSIX file lock;
# os.fork does not exist on Windows, so its `type: ignore` is only "used" when
# mypy runs there. Same reasoning as usage_app.cli above.
[[tool.mypy.overrides]]
module = "tests.test_usage_statusline"
warn_unused_ignores = false
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-ra --strict-markers"