pyselfupdate 0.8.0__tar.gz → 0.8.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/PKG-INFO +7 -1
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/README.md +6 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/notifier.py +21 -2
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/.gitignore +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/LICENSE +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/pyproject.toml +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/__init__.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/config.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/errors.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/github.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/install.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/py.typed +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/source.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/state.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/typercmd.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/updater.py +0 -0
- {pyselfupdate-0.8.0 → pyselfupdate-0.8.1}/src/pyselfupdate/version.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: pyselfupdate
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.1
|
|
4
4
|
Summary: Self-update and update notification for Python CLIs installed with uv tool
|
|
5
5
|
Project-URL: Repository, https://github.com/datapointchris/pyselfupdate
|
|
6
6
|
Project-URL: Issues, https://github.com/datapointchris/pyselfupdate/issues
|
|
@@ -138,6 +138,12 @@ each variable is its name uppercased, with `-` written as `_`.
|
|
|
138
138
|
A command writing into a pager, a log or a structured-output mode calls
|
|
139
139
|
`notify(config, interactive=False)`. Nothing about the streams reveals that.
|
|
140
140
|
|
|
141
|
+
The line names `mytool update` by default. A tool that registers the command
|
|
142
|
+
under another name passes the same name, as in
|
|
143
|
+
`add_update_command(app, CONFIG, name='self-update')` beside
|
|
144
|
+
`notify(CONFIG, update_command='self-update')`. A tool with no update command
|
|
145
|
+
passes `update_command=None`, and the line ends after the versions.
|
|
146
|
+
|
|
141
147
|
## `update` — rebuilds the environment it runs in, so it runs last
|
|
142
148
|
|
|
143
149
|
`update` runs `uv tool install --force`, which rebuilds the virtual environment
|
|
@@ -115,6 +115,12 @@ each variable is its name uppercased, with `-` written as `_`.
|
|
|
115
115
|
A command writing into a pager, a log or a structured-output mode calls
|
|
116
116
|
`notify(config, interactive=False)`. Nothing about the streams reveals that.
|
|
117
117
|
|
|
118
|
+
The line names `mytool update` by default. A tool that registers the command
|
|
119
|
+
under another name passes the same name, as in
|
|
120
|
+
`add_update_command(app, CONFIG, name='self-update')` beside
|
|
121
|
+
`notify(CONFIG, update_command='self-update')`. A tool with no update command
|
|
122
|
+
passes `update_command=None`, and the line ends after the versions.
|
|
123
|
+
|
|
118
124
|
## `update` — rebuilds the environment it runs in, so it runs last
|
|
119
125
|
|
|
120
126
|
`update` runs `uv tool install --force`, which rebuilds the virtual environment
|
|
@@ -71,6 +71,7 @@ def notify(
|
|
|
71
71
|
out: TextIO | None = None,
|
|
72
72
|
defer: bool = True,
|
|
73
73
|
interactive: bool | None = None,
|
|
74
|
+
update_command: str | None = 'update',
|
|
74
75
|
) -> Outcome:
|
|
75
76
|
"""Check at most once per interval and print one line when behind.
|
|
76
77
|
|
|
@@ -86,9 +87,24 @@ def notify(
|
|
|
86
87
|
already knows it is writing somewhere a human will not read -- into a pager,
|
|
87
88
|
a log, a structured-output mode -- since nothing about the streams
|
|
88
89
|
themselves reveals that.
|
|
90
|
+
|
|
91
|
+
`update_command` is the subcommand the notice tells the reader to run, as
|
|
92
|
+
in `<tool> <update_command>`. Pass the name given to `add_update_command`
|
|
93
|
+
when it is not `update`, or None for a tool with no update command, which
|
|
94
|
+
prints the notice without a hint. This layer cannot see the consumer's
|
|
95
|
+
command tree, so the consumer names the verb rather than the library
|
|
96
|
+
guessing one. A hint naming a command the tool lacks costs the reader a
|
|
97
|
+
failed retry at the moment they act on it.
|
|
89
98
|
"""
|
|
90
99
|
try:
|
|
91
|
-
return _notify(
|
|
100
|
+
return _notify(
|
|
101
|
+
config,
|
|
102
|
+
interval=interval,
|
|
103
|
+
out=out,
|
|
104
|
+
defer=defer,
|
|
105
|
+
interactive=interactive,
|
|
106
|
+
update_command=update_command,
|
|
107
|
+
)
|
|
92
108
|
except SelfUpdateError:
|
|
93
109
|
return Outcome(skip=Skip.FAILED)
|
|
94
110
|
except Exception: # noqa: BLE001 - a notice may never break the caller
|
|
@@ -143,6 +159,7 @@ def _notify(
|
|
|
143
159
|
out: TextIO | None,
|
|
144
160
|
defer: bool,
|
|
145
161
|
interactive: bool | None,
|
|
162
|
+
update_command: str | None,
|
|
146
163
|
) -> Outcome:
|
|
147
164
|
resolved = config.resolved()
|
|
148
165
|
tool = resolved.tool
|
|
@@ -177,7 +194,9 @@ def _notify(
|
|
|
177
194
|
if not result.update_available:
|
|
178
195
|
return Outcome(checked=True, current=result.current, latest=result.latest)
|
|
179
196
|
|
|
180
|
-
message = f'{tool} {result.latest} available (running {result.current})
|
|
197
|
+
message = f'{tool} {result.latest} available (running {result.current})'
|
|
198
|
+
if update_command:
|
|
199
|
+
message += f' — run `{tool} {update_command}`'
|
|
181
200
|
_emit(message, out=out, defer=defer)
|
|
182
201
|
return Outcome(checked=True, current=result.current, latest=result.latest)
|
|
183
202
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|