credit-check 1.1.0__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jay Dixit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,433 @@
1
+ Metadata-Version: 2.4
2
+ Name: credit-check
3
+ Version: 1.1.0
4
+ Summary: Keep track of which Wikipedia articles use your photos.
5
+ Author-email: Jay Dixit <jay@wikiportraits.org>
6
+ License: MIT
7
+ Keywords: wikimedia,commons,wikipedia,photography,categories,attribution,glam
8
+ Classifier: Environment :: Console
9
+ Classifier: Intended Audience :: End Users/Desktop
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Multimedia :: Graphics
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/plain
15
+ License-File: LICENSE
16
+ Requires-Dist: prompt_toolkit<4,>=3
17
+ Requires-Dist: questionary<3,>=2
18
+ Dynamic: license-file
19
+
20
+ #+TITLE: Credit Check
21
+
22
+ /Find Commons files you photographed that are used on Wikipedia/
23
+
24
+ [[https://img.shields.io/badge/License-MIT-2e7d4f.svg]]
25
+ [[https://img.shields.io/badge/Python-3.8%2B-3776ab.svg]]
26
+ [[https://img.shields.io/badge/from-WikiPortraits-0e6b45.svg]]
27
+
28
+ Credit Check is a free command-line tool from WikiPortraits for Wikimedia
29
+ Commons photographers. It searches Wikipedia to find the articles that feature
30
+ your photos, then adds those photos (or a subset you pick) to a category page on
31
+ Wikimedia Commons — using a category name like =Photographs by Jay Dixit= — so
32
+ you can easily keep track of which Wikipedia articles use your photos.
33
+
34
+ #+ATTR_HTML: :alt Credit Check screenshot showing selected Wikimedia Commons photos, Wikipedia usage, and a photographer category :width 100%
35
+ [[file:assets/credit-check-hero.jpeg]]
36
+
37
+ * Quick start
38
+
39
+ #+begin_src sh
40
+ git clone https://github.com/incandescentman/credit-check.git
41
+ cd credit-check
42
+ pipx install . # adds the `credit-check` command
43
+ credit-check # start the guided app, then follow the prompts
44
+ #+end_src
45
+
46
+ That's it. Credit Check walks you through the rest: set up your Commons account
47
+ once, find your photos, pick the ones to add, and add them to your category.
48
+
49
+ * What it does
50
+
51
+ 1. *Finds likely candidates.* Your uploads, plus any file whose
52
+ author/photographer field credits you. Uploading alone does not make a file
53
+ count as your photo.
54
+ 2. *Checks Wikipedia.* Keeps only files used on live Wikipedia articles, across
55
+ every language edition.
56
+ 3. *Spots the gaps.* Flags the ones missing =Category:Photographs by <you>=.
57
+ 4. *Traces crops.* If a crop dropped your credit but still cites your original
58
+ file as its source, Credit Check follows the trail back and includes it too.
59
+ 5. *You select* which photos to add to your photographer category.
60
+
61
+ * Requirements
62
+
63
+ - Python 3.8 or newer.
64
+ - =questionary= and =prompt_toolkit=, installed automatically from
65
+ =pyproject.toml=, for guided menus and the optional terminal review.
66
+ - A Wikimedia Commons account (to make edits).
67
+
68
+ Check your Python:
69
+
70
+ : python3 --version
71
+
72
+ * Install
73
+
74
+ Clone the repository and install it with pipx:
75
+
76
+ : git clone https://github.com/incandescentman/credit-check.git
77
+ : cd credit-check
78
+ : pipx install .
79
+
80
+ Now =credit-check= runs from anywhere. If you plan to modify the code, use
81
+ =pipx install --editable .= instead, so the command tracks your checkout.
82
+
83
+ Prefer not to install? Just run the script directly, using =python3 credit_check.py=
84
+ in place of =credit-check= throughout this guide. Direct script mode still
85
+ works without those interactive dependencies for direct commands and browser
86
+ review, but guided menus and terminal review need them; the installed
87
+ =credit-check= command has them.
88
+
89
+ * Start
90
+
91
+ Start the guided command-line app:
92
+
93
+ : credit-check
94
+
95
+ If this is your first run, it starts with setup: your Commons username, your
96
+ credited name, and your photographer category. After that, it shows where you're
97
+ up to and offers the obvious next step first: find your photos, choose photos to
98
+ add, or add the photos you picked. A separate optional action is always
99
+ available for photos of you taken by other people; it looks up matching
100
+ Wikidata items by your name when you choose it.
101
+
102
+ In guided mode, Credit Check keeps track of the found photos automatically.
103
+ After a scan, it opens the browser photo picker instead of asking you which file
104
+ to use. The
105
+ Settings action saves your Commons username, credited name, and photographer
106
+ category in [[file:.credit-check.json][.credit-check.json]] for this folder, so you do not have to
107
+ re-enter them.
108
+
109
+ * Making edits: the bot password
110
+
111
+ Editing needs a login. Don't use your main password. Create a bot password, a
112
+ scoped, revocable credential:
113
+
114
+ 1. Go to https://commons.wikimedia.org/wiki/Special:BotPasswords
115
+ 2. Create one (name it something like =categorize=). Grant *Edit existing pages*.
116
+ 3. You'll get a username like =Jaydixit@categorize= and a generated password.
117
+
118
+ Give them to Credit Check by environment variable:
119
+
120
+ : export COMMONS_BOTUSER='Jaydixit@categorize'
121
+ : export COMMONS_BOTPASS='the-generated-password'
122
+
123
+ If you skip this, =commit --go= will prompt you for them.
124
+
125
+ * Finding photos that depict you
126
+
127
+ Credit Check only files photos you took — a portrait someone else shot won't be
128
+ filed under "Photographs by you." For photos of you taken by other people, choose
129
+ =Find photos of you by other people= in the guided app; Credit Check looks up
130
+ matching Wikidata items so you can pick yourself, or skip cleanly if none of them
131
+ are you. If you use direct
132
+ commands and have a Wikidata item, point the tool at it:
133
+
134
+ : credit-check scan --of-category 'Jay Dixit' --qid Q12345
135
+
136
+ Files that Commons structured data says depict you (and that you didn't shoot)
137
+ land in their own section. If you pick them, Credit Check adds them to your
138
+ category for photos of you.
139
+
140
+ * Good Commons manners
141
+
142
+ Credit Check is built to be careful on Commons:
143
+
144
+ - Nothing is edited unless you pick it and confirm. Preview is the default.
145
+ - It appends only. It never rewrites a page, reorders categories, or touches
146
+ license, author, or description fields.
147
+ - It re-checks every file right before editing, so it won't add a duplicate.
148
+ - It pauses between edits and backs off while fetching or logging in if
149
+ Commons asks it to slow down.
150
+ - It doesn't automatically resubmit an edit after a lost network response; it
151
+ reports that file as failed so you can re-run safely after checking the page.
152
+ - Every edit carries a transparent summary naming the category it added.
153
+
154
+ If you're about to categorize hundreds of files, that's a semi-automated batch.
155
+ Skim the Commons norms for that kind of work, and if you're doing it regularly,
156
+ consider whether a bot flag or a quick note to the community is warranted. For a
157
+ one-time cleanup of your own photos, a normal login is generally fine.
158
+
159
+ * When something goes wrong
160
+
161
+ - *"Missing --username (or WIKI_USERNAME)"*: set your identity (see Environment
162
+ variables and config).
163
+ - *"rate-limited, waiting Ns..."*: normal. Commons throttled you; the tool
164
+ waits and retries discovery, fetch, and login requests on its own.
165
+ - *"! failed (network)"*: the edit response was lost or failed. The tool did
166
+ not resubmit the edit automatically, to avoid double-appending a category.
167
+ Check the file page or re-run the plan before trying again.
168
+ - *"Login failed"*: check your bot password, and that you granted it "Edit
169
+ existing pages."
170
+ - *A scan feels slow*: it's fetching usage and wikitext for hundreds of
171
+ files. Let it run; it prints progress as it goes.
172
+
173
+ * What it won't do
174
+
175
+ It won't upload files, edit Wikipedia articles, rewrite your metadata, or add
176
+ event or location categories. Its job is narrow on purpose: get your
177
+ Wikipedia-used photos into your photographer category.
178
+
179
+ * The payoff
180
+
181
+ When you're done, your work is collected at one URL you can point anyone to:
182
+
183
+ : https://commons.wikimedia.org/wiki/Category:Photographs_by_Jay_Dixit
184
+
185
+ If your photo is on Wikipedia and Commons already credits you, Credit Check
186
+ makes sure it shows up in your category.
187
+
188
+ * About WikiPortraits
189
+
190
+ WikiPortraits is a global network of volunteer photographers on a mission to
191
+ deliver high-quality, freely licensed portraits to
192
+ [[https://en.wikipedia.org/wiki/Main_Page][Wikipedia]],
193
+ [[https://commons.wikimedia.org/wiki/Main_Page][Wikimedia Commons]], and the
194
+ world.
195
+
196
+ Wikipedia and its sister Wikimedia projects require freely licensed images, but
197
+ most published photos of notable people are press shots under full copyright, so
198
+ countless biographies are stuck with low-quality photos or none at all.
199
+ WikiPortraits changes that: our volunteer photographers go where notable people
200
+ gather — film festivals, conferences, and award ceremonies — often as
201
+ credentialed press. At many events we also run a photo booth, where anyone with
202
+ a Wikipedia page, speaker or not, can drop by for a portrait. Every shot is
203
+ freely licensed, uploaded to Wikimedia Commons, and free for the world to use.
204
+
205
+ Since our first shoot at Sundance in 2024, our portraits have reached Wikipedia
206
+ articles in over 150 languages, viewed more than 150 million times a month.
207
+ Among the events our photographers have captured: Sundance Film Festival, SXSW,
208
+ Cannes Film Festival, Edinburgh Festival Fringe, Venice Film Festival, Toronto
209
+ International Film Festival, the Nobel Prizes, CES, and the Pulitzer Prizes.
210
+
211
+ * Author
212
+
213
+ Credit Check was built by Jay Dixit ([[mailto:jay@wikiportraits.org][jay@wikiportraits.org]]).
214
+
215
+ * Reference
216
+
217
+ The guided =credit-check= app covers everything above. The sections below are
218
+ for scripting and power users who want to run each step by hand.
219
+
220
+ ** Check the tool
221
+
222
+ Run local parser and review-format checks:
223
+
224
+ : credit-check self-test
225
+
226
+ Run a read-only Commons smoke test:
227
+
228
+ : credit-check smoke
229
+
230
+ Neither command edits Commons.
231
+
232
+ ** Environment variables and config
233
+
234
+ Set your identity once. Put this in your shell profile if you like:
235
+
236
+ : export WIKI_USERNAME='Jaydixit' # your Commons account
237
+ : export WIKI_AUTHOR='Jay Dixit' # your name as it appears in author fields
238
+
239
+ That's enough to start. Optional extras:
240
+
241
+ : export WIKI_BY_CATEGORY='Photographs by Jay Dixit' # defaults to "Photographs by <author>"
242
+ : export WIKI_OF_CATEGORY='Jay Dixit' # category for photos of you
243
+ : export WIKI_QID='Q12345' # your Wikidata id, enables depicts detection
244
+
245
+ You can also pass any of these as flags (=--username=, =--author=, and so on),
246
+ which override the environment.
247
+
248
+ Markdown is the default review format. To use org-mode in this folder, create
249
+ [[file:.credit-check.json][.credit-check.json]]:
250
+
251
+ : {"review_format": "org"}
252
+
253
+ You can also use that file for advanced defaults. Most people should never need
254
+ these:
255
+
256
+ #+begin_src json
257
+ {
258
+ "review_format": "org",
259
+ "review_page_size": 20,
260
+ "min_uses": 1,
261
+ "english_only": false,
262
+ "match_user_page_source": true,
263
+ "trace_derivatives": true,
264
+ "source_depth": 2
265
+ }
266
+ #+end_src
267
+
268
+ What those advanced preferences mean:
269
+
270
+ - =min_uses= is a priority filter. The default =1= means "include any photo
271
+ live on at least one Wikipedia article." Raise it only if you want to review
272
+ the most-used photos first.
273
+ - =match_user_page_source= also searches for file text that names
274
+ =User:<username>=. Credit Check already checks uploads and author/photographer
275
+ fields; this catches edge cases where a file credits your Commons user page
276
+ instead of your real name. It is on by default because the authorship check
277
+ still has to confirm the author/photographer field before anything goes into
278
+ your category.
279
+ - =source_depth= controls crop tracing. A hop is one step from a crop back to
280
+ the file it came from. The default =2= covers an original and a crop-of-a-crop
281
+ without following long source chains.
282
+
283
+ ** Command-line workflow
284
+
285
+ *** 1. Scan
286
+
287
+ : credit-check scan
288
+
289
+ This searches Commons, checks Wikipedia usage, classifies each file, and writes
290
+ =review.md=. It prints a summary when it finishes, for example:
291
+
292
+ : by (photos you took, missing [[Category:Photographs by Jay Dixit]]): 207 photos, used 1480 times
293
+ : ambiguous (authorship or category unclear): 0 photos
294
+
295
+ The scan only puts photos in the review when they are missing the category it
296
+ would add. If one of your photos is already in your photographer category, it is
297
+ left out of =review.md=. Before editing, =commit --go= checks again and skips
298
+ any page where the category is already present.
299
+
300
+ The guided scan does not ask you to filter by popularity. It uses the normal
301
+ default: any photo live on at least one Wikipedia article is eligible. It also
302
+ keeps crop tracing on by default, following up to two source links so a
303
+ crop-of-a-crop can still be connected to your original. In the guided app, scan
304
+ then opens the browser review automatically.
305
+
306
+ *** 2. Review and pick photos
307
+
308
+ Open the local browser picker:
309
+
310
+ : credit-check review review.md
311
+
312
+ It opens a contact sheet at =127.0.0.1= with Commons thumbnails, category
313
+ sections, search, review modes (=All=, =Selected=, and =Not selected yet=),
314
+ select-shown/select-all buttons, and links that open each file on Commons.
315
+ Selected photos get a visible badge and left stripe so you can scan the page
316
+ quickly. The =Commons edits= panel updates automatically with the exact category
317
+ edits for the photos you picked. The page saves your choices automatically. Use
318
+ =Done= when you are finished.
319
+
320
+ Browser shortcuts:
321
+
322
+ - =/= focuses search.
323
+ - =Space= toggles the focused photo.
324
+ - =o= opens the focused photo on Commons.
325
+
326
+ To open the browser directly in selected-only mode:
327
+
328
+ : credit-check review --selected review.md
329
+
330
+ If Credit Check cannot open a browser from the current terminal, it falls back
331
+ to the keyboard-only reviewer. If the review file contains ambiguous photos,
332
+ the browser shows a count for them, but does not let you select them until you
333
+ move them under a real category heading in =review.md=.
334
+
335
+ Prefer the keyboard-only terminal reviewer?
336
+
337
+ : credit-check review --terminal review.md
338
+
339
+ The terminal reviewer shows one page of photos at a time, with hotkeys visible
340
+ at the top of the screen:
341
+
342
+ - =Space= toggles the highlighted photo.
343
+ - Arrow keys move through the list.
344
+ - =n= and =p= move to the next or previous page.
345
+ - =m= selects the current page; =c= clears the current page.
346
+ - =a= selects all photos; =u= clears all photos.
347
+ - =o= opens the highlighted photo on Commons.
348
+ - =g= opens the current page as a read-only browser gallery.
349
+ - =v= opens the full review as a read-only browser gallery.
350
+ - =s= saves your choices; =q= quits without saving.
351
+
352
+ Both review modes edit the same plain Markdown file, so you can still inspect
353
+ or edit it directly.
354
+
355
+ =review.md= is split into sections, one per category, plus an Ambiguous section
356
+ for anything unclear:
357
+
358
+ : # Add to [Category:Photographs by Jay Dixit] - photos you took (207)
359
+ : ## [148] Jessie Buckley ... (Cropped & Centered).jpg
360
+ :
361
+ : - [ ] File:Jessie Buckley ... (Cropped & Centered).jpg
362
+ : [open on Commons](https://commons.wikimedia.org/...) - uploader Indopug - credited
363
+ : cats: Jessie Buckley, WikiPortraits at 2025 TIFF
364
+ : live: en, af, ar, az, bg, bn, ca, da, +29
365
+
366
+ The number in brackets is how many Wikipedia articles use that photo, sorted
367
+ most-used first. The browser and terminal reviewers toggle those =[X]= marks
368
+ for you. If you edit the file by hand, tick =[X]= on the files you want to
369
+ categorize and leave =[ ]= to skip.
370
+
371
+ Two things worth knowing:
372
+
373
+ - Each =# Add to [Category:...]= heading sets the category for the photos under
374
+ it. Move a photo to a different section and it goes to that category instead.
375
+ - Files under =# Ambiguous= are skipped until you move them under a real heading
376
+ and tick them.
377
+
378
+ *** 3. Plan
379
+
380
+ This never logs in — it just prints the edits it would make:
381
+
382
+ : credit-check plan review.md
383
+
384
+ The browser review shows the same edits live as you pick photos.
385
+
386
+ *** 4. Commit
387
+
388
+ When the plan looks right, make the edits:
389
+
390
+ : credit-check commit review.md --go
391
+
392
+ Credit Check logs in, re-checks each file (skipping any already categorized),
393
+ and appends the category with a clear edit summary, pausing a few seconds
394
+ between edits. When it finishes, it shows how many photos were added, already
395
+ present, or failed, links to the category page, and tells you whether any
396
+ photos you did not select remain.
397
+
398
+ ** All options
399
+
400
+ On =scan=:
401
+
402
+ | Option | What it does |
403
+ |---------------------+----------------------------------------------------------|
404
+ | =--english-only= | Only count English Wikipedia usage |
405
+ | =--min-uses N= | Only flag photos on at least N articles |
406
+ | =--of-category '<name>'= | Also collect photos of you in this category |
407
+ | =--qid Q12345= | Use Wikidata "depicts" to find photos of you |
408
+ | =--insource-user= | Also match files whose source names your user page |
409
+ | =--no-insource-user= | Skip that user-page source search |
410
+ | =--no-derivatives= | Skip crop/source-chain tracing |
411
+ | =--depth N= | How many source hops to follow (default 2) |
412
+ | =--review-format FMT= | One-run override for =markdown= or =org= |
413
+ | =--out FILE= | Write the review somewhere other than =review.md= |
414
+
415
+ On =commit=:
416
+
417
+ | Option | What it does |
418
+ |------------------+--------------------------------------------------|
419
+ | =--go= | Actually edit (default is preview only) |
420
+ | =--throttle S= | Seconds to pause between edits (default 5) |
421
+ | =--summary '...'= | Custom edit summary |
422
+
423
+ Other commands:
424
+
425
+ | Command | What it does |
426
+ |--------------------+---------------------------------------------------|
427
+ | =self-test= | Runs local parser and review-format checks |
428
+ | =smoke= | Runs a read-only Commons smoke test |
429
+ | =interactive= | Starts the guided command-line app |
430
+ | =review REVIEW= | Opens the local browser picker for your photos |
431
+ | =review --selected REVIEW= | Opens the browser filtered to photos you selected |
432
+ | =web REVIEW= | Same browser picker, kept as an explicit alias |
433
+ | =plan REVIEW= | Prints planned edits for the photos you checked |