pyselfupdate 0.3.0__tar.gz → 0.3.2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyselfupdate
3
- Version: 0.3.0
3
+ Version: 0.3.2
4
4
  Summary: Self-update and update notification for Python CLIs installed with uv tool
5
5
  Keywords: uv,cli,self-update,update-notifier,release
6
6
  Author: Chris Birch
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyselfupdate"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "Self-update and update notification for Python CLIs installed with uv tool"
5
5
  readme = "README.md"
6
6
  keywords = [
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "pyselfupdate"
3
- version = "0.3.0"
3
+ version = "0.3.2"
4
4
  description = "Self-update and update notification for Python CLIs installed with uv tool"
5
5
  authors = [{ name = "Chris Birch", email = "datapointchris@gmail.com" }]
6
6
  license = { text = "MIT" }
@@ -29,9 +29,11 @@ API = 'https://api.github.com'
29
29
  DEFAULT_TIMEOUT = 10.0
30
30
 
31
31
 
32
- TOKEN_COMMAND_ENV = 'GITHUB_TOKEN_COMMAND'
32
+ # B105 reads any name carrying "token" as a credential. Both hold the name of a
33
+ # variable and the text of a command; neither ever holds a secret.
34
+ TOKEN_COMMAND_ENV = 'GITHUB_TOKEN_COMMAND' # nosec B105
33
35
 
34
- DEFAULT_TOKEN_COMMAND = 'gh auth token'
36
+ DEFAULT_TOKEN_COMMAND = 'gh auth token' # nosec B105
35
37
  """What runs when nothing overrides it.
36
38
 
37
39
  Authenticating is the default because the alternative is not "no credential" but
@@ -45,6 +45,7 @@ class Skip(Enum):
45
45
  NOT_A_TTY = 'not-a-tty'
46
46
  CI = 'ci'
47
47
  INTERVAL = 'interval'
48
+ HELP = 'help'
48
49
  FAILED = 'failed'
49
50
 
50
51
 
@@ -102,6 +103,8 @@ def enabled(config: Config, *, interactive: bool | None = None) -> tuple[bool, S
102
103
  """
103
104
  if _disabled_by_env(config.tool):
104
105
  return False, Skip.DISABLED
106
+ if _asking_for_help():
107
+ return False, Skip.HELP
105
108
  if not (_is_interactive() if interactive is None else interactive):
106
109
  return False, Skip.NOT_A_TTY
107
110
  if _in_ci():
@@ -111,6 +114,30 @@ def enabled(config: Config, *, interactive: bool | None = None) -> tuple[bool, S
111
114
  return True, None
112
115
 
113
116
 
117
+ def _asking_for_help() -> bool:
118
+ """Whether the command line asks for help rather than for work.
119
+
120
+ Click and Typer run a group's callback before answering a subcommand's
121
+ `--help`, so a notice called from that callback fires while printing a help
122
+ screen. Nothing a notice is for happens on a help screen, and the check
123
+ costs a releases-API call and a state write every time.
124
+
125
+ It lands hardest on a reader that walks a tool's help. Measured 2026-08-22:
126
+ reading doit's twenty commands meant twenty-one invocations, each one
127
+ reaching this.
128
+
129
+ A `--` ends the scan, because everything after it is the command's own
130
+ argument. Skipping when it should not have costs a missed notice, which is
131
+ the cheap direction to be wrong in.
132
+ """
133
+ for arg in sys.argv[1:]:
134
+ if arg == '--':
135
+ return False
136
+ if arg in {'--help', '-h'}:
137
+ return True
138
+ return False
139
+
140
+
114
141
  def _notify(
115
142
  config: Config,
116
143
  *,
File without changes