auto-reference-generator 1.3.7__tar.gz → 1.3.9__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.
Files changed (48) hide show
  1. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/.github/workflows/build-portable.yml +97 -13
  2. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/.github/workflows/codeql.yml +5 -4
  3. auto_reference_generator-1.3.9/.github/workflows/pypi-publish.yml +154 -0
  4. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/.github/workflows/python-tests.yml +7 -3
  5. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/.gitignore +2 -0
  6. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/PKG-INFO +18 -8
  7. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/README.md +17 -7
  8. auto_reference_generator-1.3.9/auto_reference_generator/__init__.py +30 -0
  9. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator/cli.py +17 -32
  10. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator/hash.py +26 -4
  11. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator/options/options.properties +5 -0
  12. auto_reference_generator-1.3.7/auto_reference_generator/reference_generator.py → auto_reference_generator-1.3.9/auto_reference_generator/referenceGen.py +58 -36
  13. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator.egg-info/PKG-INFO +18 -8
  14. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator.egg-info/SOURCES.txt +2 -1
  15. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/installer/install.cmd +2 -25
  16. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/installer/uninstall.cmd +2 -25
  17. auto_reference_generator-1.3.9/optional-requirements.txt +2 -0
  18. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/pyproject.toml +1 -1
  19. auto_reference_generator-1.3.9/requirements.txt +0 -0
  20. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/tests/test_hash.py +19 -0
  21. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/tests/test_reference_generator.py +4 -5
  22. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/tests/test_reference_generator_integration.py +1 -1
  23. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/tests/test_reference_loop_and_keywords.py +1 -1
  24. auto_reference_generator-1.3.7/.github/workflows/pypi-publish.yml +0 -67
  25. auto_reference_generator-1.3.7/auto_reference_generator/__init__.py +0 -15
  26. auto_reference_generator-1.3.7/requirements.txt +0 -27
  27. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/.pre-commit-config.yaml +0 -0
  28. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/LICENSE.md +0 -0
  29. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/assets/AccessionPreview.png +0 -0
  30. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/assets/HashPreview.png +0 -0
  31. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/assets/ReferencesPreview.png +0 -0
  32. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/assets/SpreadGen.png +0 -0
  33. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/assets/SpreadPreview.png +0 -0
  34. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/assets/metaFolder.png +0 -0
  35. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/assets/sample_from_dict.json +0 -0
  36. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator/common.py +0 -0
  37. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator.egg-info/dependency_links.txt +0 -0
  38. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator.egg-info/entry_points.txt +0 -0
  39. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator.egg-info/requires.txt +0 -0
  40. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/auto_reference_generator.egg-info/top_level.txt +0 -0
  41. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/installer/README.txt +0 -0
  42. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/installer/auto_ref.cmd +0 -0
  43. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/pytest.ini +0 -0
  44. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/samples/auto_reference_generator_AutoRef.xlsx +0 -0
  45. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/samples/auto_reference_generator_AutoRef_from_json.xlsx +0 -0
  46. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/samples/sample_json_dict.json +0 -0
  47. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/setup.cfg +0 -0
  48. {auto_reference_generator-1.3.7 → auto_reference_generator-1.3.9}/tests/test_common.py +0 -0
@@ -3,21 +3,93 @@ name: Build Portable Executables with Nuitka
3
3
  on:
4
4
  push:
5
5
  tags:
6
- - 'v*'
7
- - 'test-*'
6
+ - '*'
7
+ paths-ignore:
8
+ - 'README.md'
9
+ - 'docs/**'
10
+ - 'assets/**'
11
+ - '.github/**'
12
+ pull_request:
13
+ branches:
14
+ - dev
15
+ - master
16
+ paths-ignore:
17
+ - 'README.md'
18
+ - 'docs/**'
19
+ - 'assets/**'
20
+ - '.github/**'
8
21
 
9
22
  permissions:
10
23
  contents: write
11
24
 
12
25
  jobs:
26
+ verify-tag-branch-rule:
27
+ name: Verify Tag Branch Rule
28
+ runs-on: ubuntu-latest
29
+ outputs:
30
+ should_build: ${{ steps.check-rule.outputs.should_build }}
31
+ publish_release: ${{ steps.check-rule.outputs.publish_release }}
32
+ steps:
33
+ - uses: actions/checkout@v6
34
+ with:
35
+ fetch-depth: 0
36
+ - name: Validate tag against branch rule
37
+ id: check-rule
38
+ run: |
39
+ event_name="${{ github.event_name }}"
40
+ tag_name="${{ github.ref_name }}"
41
+
42
+ if [ "$event_name" = "pull_request" ]; then
43
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
44
+ echo "publish_release=false" >> "$GITHUB_OUTPUT"
45
+ echo "Allowed: pull request build only (no release)."
46
+ exit 0
47
+ fi
48
+
49
+ git fetch origin master --depth=1
50
+ git fetch origin dev --depth=1
51
+
52
+ on_master=false
53
+ on_dev=false
54
+
55
+ if git merge-base --is-ancestor "$GITHUB_SHA" "origin/master"; then
56
+ on_master=true
57
+ fi
58
+
59
+ if git merge-base --is-ancestor "$GITHUB_SHA" "origin/dev"; then
60
+ on_dev=true
61
+ fi
62
+
63
+ if [[ "$tag_name" == v* ]] && [[ "$on_master" == true ]]; then
64
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
65
+ echo "publish_release=true" >> "$GITHUB_OUTPUT"
66
+ echo "Allowed: v* tag on master (release build)."
67
+ exit 0
68
+ fi
69
+
70
+ if [[ "$on_dev" == true ]]; then
71
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
72
+ echo "publish_release=false" >> "$GITHUB_OUTPUT"
73
+ echo "Allowed: any tag on dev (artifact only)."
74
+ exit 0
75
+ fi
76
+
77
+ echo "should_build=false" >> "$GITHUB_OUTPUT"
78
+ echo "publish_release=false" >> "$GITHUB_OUTPUT"
79
+ echo "Blocked: event does not meet PR or tag branch rules."
80
+
13
81
  build-windows:
14
82
  name: Build Windows Portable
15
83
  runs-on: windows-latest
84
+ needs: verify-tag-branch-rule
85
+ if: needs.verify-tag-branch-rule.outputs.should_build == 'true'
16
86
  steps:
17
- - uses: actions/checkout@v4
87
+ - uses: actions/checkout@v6
88
+ with:
89
+ persist-credentials: false
18
90
 
19
91
  - name: Set up Python
20
- uses: actions/setup-python@v4
92
+ uses: actions/setup-python@v6
21
93
  with:
22
94
  python-version: '3.11'
23
95
 
@@ -58,7 +130,6 @@ jobs:
58
130
  --clang `
59
131
  auto_reference_generator/cli.py
60
132
 
61
-
62
133
  - name: Create Windows package
63
134
  run: |
64
135
  $version = "${{ github.ref_name }}" -replace "^v", ""
@@ -87,6 +158,7 @@ jobs:
87
158
  path: auto_ref_windows_*.zip
88
159
 
89
160
  - name: Upload to release
161
+ if: needs.verify-tag-branch-rule.outputs.publish_release == 'true'
90
162
  uses: softprops/action-gh-release@v1
91
163
  with:
92
164
  draft: true
@@ -97,11 +169,15 @@ jobs:
97
169
  build-linux:
98
170
  name: Build Linux Portable
99
171
  runs-on: ubuntu-latest
172
+ needs: verify-tag-branch-rule
173
+ if: needs.verify-tag-branch-rule.outputs.should_build == 'true'
100
174
  steps:
101
- - uses: actions/checkout@v4
175
+ - uses: actions/checkout@v6
176
+ with:
177
+ persist-credentials: false
102
178
 
103
179
  - name: Set up Python
104
- uses: actions/setup-python@v4
180
+ uses: actions/setup-python@v6
105
181
  with:
106
182
  python-version: '3.11'
107
183
 
@@ -152,6 +228,7 @@ jobs:
152
228
  path: auto_ref_linux_*.tar.gz
153
229
 
154
230
  - name: Upload to release
231
+ if: needs.verify-tag-branch-rule.outputs.publish_release == 'true'
155
232
  uses: softprops/action-gh-release@v1
156
233
  with:
157
234
  draft: true
@@ -162,11 +239,15 @@ jobs:
162
239
  build-macos:
163
240
  name: Build macOS Portable
164
241
  runs-on: macos-latest
242
+ needs: verify-tag-branch-rule
243
+ if: needs.verify-tag-branch-rule.outputs.should_build == 'true'
165
244
  steps:
166
- - uses: actions/checkout@v4
245
+ - uses: actions/checkout@v6
246
+ with:
247
+ persist-credentials: false
167
248
 
168
249
  - name: Set up Python
169
- uses: actions/setup-python@v4
250
+ uses: actions/setup-python@v6
170
251
  with:
171
252
  python-version: '3.11'
172
253
 
@@ -207,12 +288,13 @@ jobs:
207
288
  tar -czf "auto_ref_macos_${version}.tar.gz" -C build auto_ref
208
289
 
209
290
  - name: Upload macOS artifact
210
- uses: actions/upload-artifact@v4
291
+ uses: actions/upload-artifact@v5
211
292
  with:
212
293
  name: auto_ref-macos
213
294
  path: auto_ref_macos_*.tar.gz
214
295
 
215
296
  - name: Upload to release
297
+ if: needs.verify-tag-branch-rule.outputs.publish_release == 'true'
216
298
  uses: softprops/action-gh-release@v1
217
299
  with:
218
300
  draft: true
@@ -223,10 +305,12 @@ jobs:
223
305
  create-release-notes:
224
306
  name: Create Release Notes
225
307
  runs-on: ubuntu-latest
226
- needs: [build-windows, build-linux, build-macos]
227
- if: startsWith(github.ref, 'refs/tags/')
308
+ needs: [verify-tag-branch-rule, build-windows, build-linux, build-macos]
309
+ if: needs.verify-tag-branch-rule.outputs.publish_release == 'true'
228
310
  steps:
229
- - uses: actions/checkout@v4
311
+ - uses: actions/checkout@v6
312
+ with:
313
+ persist-credentials: false
230
314
 
231
315
  - name: Generate Release Notes
232
316
  run: |
@@ -15,16 +15,17 @@ on:
15
15
  push:
16
16
  tags:
17
17
  - 'v*'
18
- # avoid running on doc-only / asset-only changes
18
+ branches:
19
+ - 'dev'
19
20
  paths-ignore:
20
21
  - 'README.md'
21
22
  - 'docs/**'
22
23
  - 'assets/**'
23
24
  - '.github/**'
24
25
  pull_request:
25
- # The branches below must be a subset of the branches above
26
- branches: [ master ]
27
- # avoid running on doc-only / asset-only changes
26
+ branches:
27
+ - master
28
+ - dev
28
29
  paths-ignore:
29
30
  - 'README.md'
30
31
  - 'docs/**'
@@ -0,0 +1,154 @@
1
+ name: Publish Python distribution to PyPI and TestPyPi
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - '*'
7
+ paths-ignore:
8
+ - 'README.md'
9
+ - 'docs/**'
10
+ - 'assets/**'
11
+ - '.github/**'
12
+ pull_request:
13
+ branches:
14
+ - dev
15
+ - master
16
+ paths-ignore:
17
+ - 'README.md'
18
+ - 'docs/**'
19
+ - 'assets/**'
20
+ - '.github/**'
21
+
22
+ jobs:
23
+ verify-tag-branch-rule:
24
+ name: Verify Tag Branch Rule
25
+ runs-on: ubuntu-latest
26
+ outputs:
27
+ should_build: ${{ steps.check-rule.outputs.should_build }}
28
+ publish_testpypi: ${{ steps.check-rule.outputs.publish_testpypi }}
29
+ publish_pypi: ${{ steps.check-rule.outputs.publish_pypi }}
30
+ steps:
31
+ - uses: actions/checkout@v6
32
+ with:
33
+ fetch-depth: 0
34
+ - name: Validate tag against branch rule
35
+ id: check-rule
36
+ run: |
37
+ event_name="${{ github.event_name }}"
38
+ tag_name="${{ github.ref_name }}"
39
+
40
+ if [ "$event_name" = "pull_request" ]; then
41
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
42
+ echo "publish_testpypi=false" >> "$GITHUB_OUTPUT"
43
+ echo "publish_pypi=false" >> "$GITHUB_OUTPUT"
44
+ echo "Allowed: pull request build only (no publish)."
45
+ exit 0
46
+ fi
47
+
48
+ git fetch origin master --depth=1
49
+ git fetch origin dev --depth=1
50
+
51
+ on_master=false
52
+ on_dev=false
53
+
54
+ if git merge-base --is-ancestor "$GITHUB_SHA" "origin/master"; then
55
+ on_master=true
56
+ fi
57
+
58
+ if git merge-base --is-ancestor "$GITHUB_SHA" "origin/dev"; then
59
+ on_dev=true
60
+ fi
61
+
62
+ if [[ "$tag_name" == v* ]] && [[ "$on_master" == true ]]; then
63
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
64
+ echo "publish_testpypi=false" >> "$GITHUB_OUTPUT"
65
+ echo "publish_pypi=true" >> "$GITHUB_OUTPUT"
66
+ echo "Allowed: v* tag on master (PyPI only)."
67
+ exit 0
68
+ fi
69
+
70
+ if [[ "$on_dev" == true ]]; then
71
+ echo "should_build=true" >> "$GITHUB_OUTPUT"
72
+ echo "publish_testpypi=true" >> "$GITHUB_OUTPUT"
73
+ echo "publish_pypi=false" >> "$GITHUB_OUTPUT"
74
+ echo "Allowed: any tag on dev (TestPyPI only)."
75
+ exit 0
76
+ fi
77
+
78
+ echo "should_build=false" >> "$GITHUB_OUTPUT"
79
+ echo "publish_testpypi=false" >> "$GITHUB_OUTPUT"
80
+ echo "publish_pypi=false" >> "$GITHUB_OUTPUT"
81
+ echo "Blocked: event does not meet PR or tag branch rules."
82
+
83
+ build:
84
+ name: Build distribution
85
+ runs-on: ubuntu-latest
86
+ needs: verify-tag-branch-rule
87
+ if: needs.verify-tag-branch-rule.outputs.should_build == 'true'
88
+ steps:
89
+ - uses: actions/checkout@v6
90
+ with:
91
+ persist-credentials: false
92
+ - name: Set up Python
93
+ uses: actions/setup-python@v6
94
+ with:
95
+ python-version: "3.x"
96
+ - name: Install pypa/build
97
+ run: >-
98
+ python3 -m
99
+ pip install
100
+ build
101
+ - name: Build a binary wheel and a source tarball
102
+ run: python3 -m build
103
+ - name: Store the distribution packages
104
+ uses: actions/upload-artifact@v5
105
+ with:
106
+ name: python-package-distributions
107
+ path: dist/
108
+
109
+ publish-to-testpypi:
110
+ name: >-
111
+ Publish Python distribution to TestPyPI
112
+ needs:
113
+ - verify-tag-branch-rule
114
+ - build
115
+ if: needs.verify-tag-branch-rule.outputs.publish_testpypi == 'true'
116
+ runs-on: ubuntu-latest
117
+ environment:
118
+ name: testpypi
119
+ url: https://test.pypi.org/p/auto-reference-generator # Replace <package-name> with your TestPyPI project name
120
+ permissions:
121
+ id-token: write # IMPORTANT: mandatory for trusted publishing
122
+ steps:
123
+ - name: Download all the dists
124
+ uses: actions/download-artifact@v6
125
+ with:
126
+ name: python-package-distributions
127
+ path: dist/
128
+ - name: Publish distribution to TestPyPI
129
+ uses: pypa/gh-action-pypi-publish@release/v1
130
+ with:
131
+ repository-url: https://test.pypi.org/legacy/
132
+
133
+ publish-to-pypi:
134
+ name: >-
135
+ Publish Python distribution to PyPI
136
+ needs:
137
+ - verify-tag-branch-rule
138
+ - build
139
+ if: needs.verify-tag-branch-rule.outputs.publish_pypi == 'true'
140
+ runs-on: ubuntu-latest
141
+ environment:
142
+ name: pypi
143
+ url: https://pypi.org/p/auto-reference-generator # Replace <package-name> with your PyPI project name
144
+ permissions:
145
+ id-token: write # IMPORTANT: mandatory for trusted publishing
146
+
147
+ steps:
148
+ - name: Download all the dists
149
+ uses: actions/download-artifact@v6
150
+ with:
151
+ name: python-package-distributions
152
+ path: dist/
153
+ - name: Publish distribution to PyPI
154
+ uses: pypa/gh-action-pypi-publish@release/v1
@@ -4,20 +4,24 @@ on:
4
4
  push:
5
5
  tags:
6
6
  - 'v*'
7
- - 'test-*'
7
+ branches:
8
+ - 'dev'
8
9
  paths-ignore:
9
10
  - 'README.md'
10
11
  - 'docs/**'
11
12
  - 'assets/**'
12
13
  - '.github/**'
13
14
  pull_request:
14
- branches: [ master ]
15
+ branches:
16
+ - master
17
+ - dev
15
18
  paths-ignore:
16
19
  - 'README.md'
17
20
  - 'docs/**'
18
21
  - 'assets/**'
19
22
  - '.github/**'
20
-
23
+ workflow_dispatch: {}
24
+
21
25
  jobs:
22
26
  build:
23
27
  runs-on: ubuntu-latest
@@ -6,3 +6,5 @@ dist/
6
6
  auto_reference_generator.egg-info/
7
7
  build/
8
8
  auto_reference_generator.code-workspace
9
+ __azurite_db_blob__.json
10
+ __azurite_db_blob_extent__.json
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: auto_reference_generator
3
- Version: 1.3.7
3
+ Version: 1.3.9
4
4
  Summary: A tool for archivist's to automate the generation of references for digital files
5
5
  Author-email: Christopher Prince <c.pj.prince@gmail.com>
6
6
  License-Expression: Apache-2.0
@@ -359,12 +359,13 @@ The below covers the full range of options. Use the `-h` option to show this dia
359
359
  Usage:
360
360
  ```
361
361
  Auto_Reference_Generator [-h] [-v] [-p [PREFIX]] [-s [SUFFIX]]
362
- [--suffix-option {file,dir,both}] [-acc {file,dir,both}]
362
+ [--suffix-option [{file,dir,both}]] [-acc [{file,dir,both}]]
363
363
  [-accp [ACC_PREFIX]] [-l [LEVEL_LIMIT]] [-str [START_REF]]
364
364
  [-dlm [DELIMITER]] [--remove-empty] [--disable-empty-export]
365
- [-hid] [-fx [{MD5,SHA-1,SHA1,SHA-256}]]
366
- [--sort-by [{folders_first,alphabetical}]] [-o [OUTPUT]]
367
- [--disable-meta-dir] [-skp] [-fmt {xlsx,csv,json,ods,xml,dict}]
365
+ [-hid] [--sort-by [{folders_first,alphabetical}]]
366
+ [-fx [{MD5,SHA-1,SHA1,SHA-256} ...]]
367
+ [--max-workers [MAX_WORKERS]] [-o [OUTPUT]] [--disable-meta-dir]
368
+ [-skp] [-fmt {xlsx,csv,json,ods,xml,dict}]
368
369
  [--options-file [OPTIONS_FILE]]
369
370
  [--log-level [{DEBUG,INFO,WARNING,ERROR}]]
370
371
  [--log-file [LOG_FILE]] [-key [KEYWORDS ...]]
@@ -372,6 +373,8 @@ Auto_Reference_Generator [-h] [-v] [-p [PREFIX]] [-s [SUFFIX]]
372
373
  [-keym [{initialise,firstletters,from_json}]]
373
374
  [--keywords-retain-order]
374
375
  [--keywords-abbreviation-number [KEYWORDS_ABBREVIATION_NUMBER]]
376
+ [--physical-mode-input [PHYSICAL_MODE_INPUT]]
377
+ [--spreadsheet-to-sort [SPREADSHEET_TO_SORT]]
375
378
  [root]
376
379
  ```
377
380
  Auto Reference Generator for Digital Cataloguing
@@ -387,8 +390,8 @@ Reference Options:
387
390
 
388
391
  - `-p [PREFIX]`, `--prefix [PREFIX]`: Set a prefix to append onto generated references
389
392
  - `-s [SUFFIX]`, `--suffix [SUFFIX]`: Set a suffix to append onto generated references
390
- - `--suffix-option {file`, `dir`, `both}`: Set whether to apply the suffix to files, folders or both when generating references
391
- - `-acc {file`, `dir`, `both}`, `--accession {file`, `dir`, `both}`: Sets the program to create an accession listing - IE a running number of the files.
393
+ - `--suffix-option [{file`, `dir`, `both}]`: Set whether to apply the suffix to files, folders or both when generating references
394
+ - `-acc [{file`, `dir`, `both}]`, `--accession [{file`, `dir`, `both}]`: Sets the program to create an accession listing - IE a running number of the files.
392
395
  - `-accp [ACC_PREFIX]`, `--acc-prefix [ACC_PREFIX]`: Sets the Prefix for Accession Mode
393
396
  - `-l [LEVEL_LIMIT]`, `--level-limit [LEVEL_LIMIT]`: Set a level limit to generate references to
394
397
  - `-str [START_REF]`, `--start-ref [START_REF]`: Set the starting reference number. Won't affect sub-folders/files
@@ -396,8 +399,9 @@ Reference Options:
396
399
  - `--remove-empty`: Sets the Program to remove any Empty Directory and Log removals to a text file
397
400
  - `--disable-empty-export`: Sets the program to not export a log of removed empty directories, by default will export, this flag disables that
398
401
  - `-hid`, `--hidden`: Set to include hidden files/folders in the listing
399
- - `-fx [{MD5`, `SHA-1`, `SHA1`, `SHA-256}]`, `--fixity [{MD5`, `SHA-1`, `SHA1`, `SHA-256}]`: Set to generate fixities, specify Algorithm to use (default SHA-1)
400
402
  - `--sort-by [{folders_first`, `alphabetical}]`: Set the sorting method, 'folders_first' sorts folders first then files alphabetically; 'alphabetically' sorts alphabetically (ignoring folder distinction)
403
+ - `-fx [{MD5`, `SHA-1`, `SHA1`, `SHA-256} ...]`, `--fixity [{MD5`, `SHA-1`, `SHA1`, `SHA-256} ...]`: Set to generate fixities, specify Algorithm to use (default SHA-1)
404
+ - `--max-workers [MAX_WORKERS]`: Set the maximum number of worker threads to use for hash generation when using --fixity (default: 1)
401
405
 
402
406
  Output Options:
403
407
  Options for outputting the generated references
@@ -418,6 +422,12 @@ Keyword Options:
418
422
  - `-keym [{initialise`, `firstletters`, `from_json}]`, `--keywords-mode [{initialise`, `firstletters`, `from_json}]`: Set to alternate keyword mode: 'initialise' will use initials of words; 'firstletters' will use the first letters of the string; 'from_json' will use a JSON file mapping names to keywords
419
423
  - `--keywords-retain-order`: Set when using keywords to continue reference numbering. If not used keywords don't 'count' to reference numbering, e.g. if using initials 'Project Alpha' -> 'PA' then the next folder/file will be '1' not '2'
420
424
  - `--keywords-abbreviation-number [KEYWORDS_ABBREVIATION_NUMBER]`: Set to set the number of letters to abbreviate for 'firstletters' mode, does not impact 'initialise' mode.
425
+
426
+ Physical Mode Options:
427
+ Options for using physical mode functionality
428
+
429
+ - `--physical-mode-input [PHYSICAL_MODE_INPUT]`: Set to conduct an Auto Generation of a Specify a path to a Spreadsheet
430
+ - `--spreadsheet-to-sort [SPREADSHEET_TO_SORT]`: Set to a path to a Spreadsheet containing an 'Archive_Reference' Column to sort the spreadsheet according to hierarchy
421
431
  <!-- argparse_to_md_end -->
422
432
 
423
433
  ## Troubleshooting
@@ -335,12 +335,13 @@ The below covers the full range of options. Use the `-h` option to show this dia
335
335
  Usage:
336
336
  ```
337
337
  Auto_Reference_Generator [-h] [-v] [-p [PREFIX]] [-s [SUFFIX]]
338
- [--suffix-option {file,dir,both}] [-acc {file,dir,both}]
338
+ [--suffix-option [{file,dir,both}]] [-acc [{file,dir,both}]]
339
339
  [-accp [ACC_PREFIX]] [-l [LEVEL_LIMIT]] [-str [START_REF]]
340
340
  [-dlm [DELIMITER]] [--remove-empty] [--disable-empty-export]
341
- [-hid] [-fx [{MD5,SHA-1,SHA1,SHA-256}]]
342
- [--sort-by [{folders_first,alphabetical}]] [-o [OUTPUT]]
343
- [--disable-meta-dir] [-skp] [-fmt {xlsx,csv,json,ods,xml,dict}]
341
+ [-hid] [--sort-by [{folders_first,alphabetical}]]
342
+ [-fx [{MD5,SHA-1,SHA1,SHA-256} ...]]
343
+ [--max-workers [MAX_WORKERS]] [-o [OUTPUT]] [--disable-meta-dir]
344
+ [-skp] [-fmt {xlsx,csv,json,ods,xml,dict}]
344
345
  [--options-file [OPTIONS_FILE]]
345
346
  [--log-level [{DEBUG,INFO,WARNING,ERROR}]]
346
347
  [--log-file [LOG_FILE]] [-key [KEYWORDS ...]]
@@ -348,6 +349,8 @@ Auto_Reference_Generator [-h] [-v] [-p [PREFIX]] [-s [SUFFIX]]
348
349
  [-keym [{initialise,firstletters,from_json}]]
349
350
  [--keywords-retain-order]
350
351
  [--keywords-abbreviation-number [KEYWORDS_ABBREVIATION_NUMBER]]
352
+ [--physical-mode-input [PHYSICAL_MODE_INPUT]]
353
+ [--spreadsheet-to-sort [SPREADSHEET_TO_SORT]]
351
354
  [root]
352
355
  ```
353
356
  Auto Reference Generator for Digital Cataloguing
@@ -363,8 +366,8 @@ Reference Options:
363
366
 
364
367
  - `-p [PREFIX]`, `--prefix [PREFIX]`: Set a prefix to append onto generated references
365
368
  - `-s [SUFFIX]`, `--suffix [SUFFIX]`: Set a suffix to append onto generated references
366
- - `--suffix-option {file`, `dir`, `both}`: Set whether to apply the suffix to files, folders or both when generating references
367
- - `-acc {file`, `dir`, `both}`, `--accession {file`, `dir`, `both}`: Sets the program to create an accession listing - IE a running number of the files.
369
+ - `--suffix-option [{file`, `dir`, `both}]`: Set whether to apply the suffix to files, folders or both when generating references
370
+ - `-acc [{file`, `dir`, `both}]`, `--accession [{file`, `dir`, `both}]`: Sets the program to create an accession listing - IE a running number of the files.
368
371
  - `-accp [ACC_PREFIX]`, `--acc-prefix [ACC_PREFIX]`: Sets the Prefix for Accession Mode
369
372
  - `-l [LEVEL_LIMIT]`, `--level-limit [LEVEL_LIMIT]`: Set a level limit to generate references to
370
373
  - `-str [START_REF]`, `--start-ref [START_REF]`: Set the starting reference number. Won't affect sub-folders/files
@@ -372,8 +375,9 @@ Reference Options:
372
375
  - `--remove-empty`: Sets the Program to remove any Empty Directory and Log removals to a text file
373
376
  - `--disable-empty-export`: Sets the program to not export a log of removed empty directories, by default will export, this flag disables that
374
377
  - `-hid`, `--hidden`: Set to include hidden files/folders in the listing
375
- - `-fx [{MD5`, `SHA-1`, `SHA1`, `SHA-256}]`, `--fixity [{MD5`, `SHA-1`, `SHA1`, `SHA-256}]`: Set to generate fixities, specify Algorithm to use (default SHA-1)
376
378
  - `--sort-by [{folders_first`, `alphabetical}]`: Set the sorting method, 'folders_first' sorts folders first then files alphabetically; 'alphabetically' sorts alphabetically (ignoring folder distinction)
379
+ - `-fx [{MD5`, `SHA-1`, `SHA1`, `SHA-256} ...]`, `--fixity [{MD5`, `SHA-1`, `SHA1`, `SHA-256} ...]`: Set to generate fixities, specify Algorithm to use (default SHA-1)
380
+ - `--max-workers [MAX_WORKERS]`: Set the maximum number of worker threads to use for hash generation when using --fixity (default: 1)
377
381
 
378
382
  Output Options:
379
383
  Options for outputting the generated references
@@ -394,6 +398,12 @@ Keyword Options:
394
398
  - `-keym [{initialise`, `firstletters`, `from_json}]`, `--keywords-mode [{initialise`, `firstletters`, `from_json}]`: Set to alternate keyword mode: 'initialise' will use initials of words; 'firstletters' will use the first letters of the string; 'from_json' will use a JSON file mapping names to keywords
395
399
  - `--keywords-retain-order`: Set when using keywords to continue reference numbering. If not used keywords don't 'count' to reference numbering, e.g. if using initials 'Project Alpha' -> 'PA' then the next folder/file will be '1' not '2'
396
400
  - `--keywords-abbreviation-number [KEYWORDS_ABBREVIATION_NUMBER]`: Set to set the number of letters to abbreviate for 'firstletters' mode, does not impact 'initialise' mode.
401
+
402
+ Physical Mode Options:
403
+ Options for using physical mode functionality
404
+
405
+ - `--physical-mode-input [PHYSICAL_MODE_INPUT]`: Set to conduct an Auto Generation of a Specify a path to a Spreadsheet
406
+ - `--spreadsheet-to-sort [SPREADSHEET_TO_SORT]`: Set to a path to a Spreadsheet containing an 'Archive_Reference' Column to sort the spreadsheet according to hierarchy
397
407
  <!-- argparse_to_md_end -->
398
408
 
399
409
  ## Troubleshooting
@@ -0,0 +1,30 @@
1
+ """
2
+ auto_classification_generator package definitions
3
+
4
+ Author: Christopher Prince
5
+ license: Apache License 2.0"
6
+ """
7
+
8
+ from auto_reference_generator.common import define_output_file, \
9
+ keyword_replace, \
10
+ win_file_split, \
11
+ filter_win_hidden, \
12
+ path_check, \
13
+ running_time, \
14
+ win_256_check, \
15
+ export_csv, \
16
+ export_dict, \
17
+ export_json, \
18
+ export_list_txt, \
19
+ export_ods, \
20
+ export_xl, \
21
+ export_xml, \
22
+ suffix_addition, \
23
+ suffix_subtraction
24
+ from auto_reference_generator.referenceGen import ReferenceGenerator
25
+ from auto_reference_generator.cli import run_cli,create_parser
26
+ from importlib import metadata
27
+
28
+ __author__ = "Christopher Prince (c.pj.prince@gmail.com)"
29
+ __license__ = "Apache License Version 2.0"
30
+ __version__ = metadata.version("auto_reference_generator")
@@ -1,4 +1,4 @@
1
- from auto_reference_generator.reference_generator import ReferenceGenerator
1
+ from auto_reference_generator.referenceGen import ReferenceGenerator
2
2
  import argparse, os, logging, inspect
3
3
  from importlib import metadata
4
4
  from auto_reference_generator.common import running_time
@@ -23,9 +23,9 @@ def create_parser() -> argparse.ArgumentParser:
23
23
  help = "Set a prefix to append onto generated references")
24
24
  refgroup.add_argument("-s", "--suffix", required = False, nargs = '?',
25
25
  help = "Set a suffix to append onto generated references")
26
- refgroup.add_argument("--suffix-option", required = False, choices= ['file', 'dir', 'both'], default = 'apply_to_files', type = suffix_helper,
26
+ refgroup.add_argument("--suffix-option", required = False, choices= ['file', 'dir', 'both'], nargs='?', const = 'file', default = None, type = suffix_helper,
27
27
  help = "Set whether to apply the suffix to files, folders or both when generating references")
28
- refgroup.add_argument("-acc", "--accession", required = False, choices = ['file', 'dir', 'both'], default = None, type = suffix_helper,
28
+ refgroup.add_argument("-acc", "--accession", required = False, choices = ['file', 'dir', 'both'], nargs='?', const = 'file', default = None, type = suffix_helper,
29
29
  help="Sets the program to create an accession listing - IE a running number of the files.")
30
30
  refgroup.add_argument("-accp", "--acc-prefix", required = False, nargs = '?',
31
31
  help = "Sets the Prefix for Accession Mode")
@@ -41,11 +41,12 @@ def create_parser() -> argparse.ArgumentParser:
41
41
  help = "Sets the program to not export a log of removed empty directories, by default will export, this flag disables that")
42
42
  refgroup.add_argument("-hid","--hidden", required = False , action = 'store_true', default = False,
43
43
  help = "Set to include hidden files/folders in the listing")
44
- refgroup.add_argument("-fx", "--fixity", required = False, nargs = '?', const = "SHA-1", default = None, choices = ['MD5', 'SHA-1', 'SHA1', 'SHA-256'], type = fixity_helper,
45
- help = "Set to generate fixities, specify Algorithm to use (default SHA-1)")
46
44
  refgroup.add_argument("--sort-by", required=False, nargs = '?', default = 'folders_first', choices = ['folders_first','alphabetical'], type=str.lower,
47
45
  help = "Set the sorting method, 'folders_first' sorts folders first then files alphabetically; 'alphabetically' sorts alphabetically (ignoring folder distinction)")
48
-
46
+ refgroup.add_argument("-fx", "--fixity", required = False, nargs = '*', default = None, choices = ['MD5', 'SHA-1', 'SHA1', 'SHA-256'], type = fixity_helper, action=EmptyIsTrueFixity,
47
+ help = "Set to generate fixities, specify Algorithm to use (default SHA-1)")
48
+ refgroup.add_argument("--max-workers", required=False, nargs='?', default=1, type=int,
49
+ help = "Set the maximum number of worker threads to use for hash generation when using --fixity (default: 1)")
49
50
 
50
51
  outputgroup = parser.add_argument_group('Output Options','Options for outputting the generated references')
51
52
  outputgroup.add_argument("-o", "--output", required = False, nargs = '?',
@@ -74,6 +75,7 @@ def create_parser() -> argparse.ArgumentParser:
74
75
  help = "Set when using keywords to continue reference numbering. If not used keywords don't 'count' to reference numbering, e.g. if using initials 'Project Alpha' -> 'PA' then the next folder/file will be '1' not '2'")
75
76
  keywordsgroup.add_argument("--keywords-abbreviation-number", required = False, nargs='?', default = 3, type = int,
76
77
  help = "Set to set the number of letters to abbreviate for 'firstletters' mode, does not impact 'initialise' mode.")
78
+
77
79
  return parser
78
80
 
79
81
  def run_cli(args: argparse.Namespace) -> None:
@@ -111,6 +113,8 @@ def run_cli(args: argparse.Namespace) -> None:
111
113
  else:
112
114
  logger.info("Confirmation received proceeding to remove empty folders...")
113
115
 
116
+ if args.skip:
117
+ logger.info("Reference creation will be skipped, proceeding to generate spreadsheet listing only, other options will be ignored")
114
118
  if not args.output:
115
119
  args.output = os.path.abspath(args.root)
116
120
  logger.info(f'Output path defaulting to root directory: {args.output}')
@@ -146,6 +150,7 @@ def run_cli(args: argparse.Namespace) -> None:
146
150
  suffix_options = args.suffix_option,
147
151
  level_limit = args.level_limit,
148
152
  fixity = args.fixity,
153
+ max_workers = args.max_workers,
149
154
  empty_flag = args.remove_empty,
150
155
  empty_export_flag = args.disable_empty_export,
151
156
  accession_flag = args.accession,
@@ -176,24 +181,6 @@ def fixity_helper(x: str):
176
181
  x = 'SHA-512'
177
182
  return x.upper()
178
183
 
179
- def autoref_helper(x: str):
180
- x = x.lower()
181
- if x in ('c', 'catalog', 'catalogue', 'cat'):
182
- x = 'catalog'
183
- if x == ('a', 'accession', 'acc'):
184
- x = 'accession'
185
- if x == ('b', 'both', 'all'):
186
- x = 'both'
187
- if x == ('g', 'generic', 'gen'):
188
- x = 'generic'
189
- if x == ('cg', 'catalog-generic', 'catalogue-generic', 'cat-generic', 'catalogue-gen', 'cat-gen', 'catalog-gen'):
190
- x = 'catalog-generic'
191
- if x == ('ag', 'accession-generic', 'acc-generic', 'accession-gen', 'acc-gen'):
192
- x = 'accession-generic'
193
- if x == ('bg', 'both-generic', 'all-generic', 'all-gen'):
194
- x = 'both-generic'
195
- return x.lower()
196
-
197
184
  def suffix_helper(x: str):
198
185
  x = x.lower()
199
186
  if x in ('f', 'file', 'files'):
@@ -204,14 +191,6 @@ def suffix_helper(x: str):
204
191
  x = 'both'
205
192
  return x.lower()
206
193
 
207
- def metadata_helper(x: str):
208
- x = x.lower()
209
- if x in ('e', 'exact'):
210
- x = 'exact'
211
- if x in ('f', 'flat'):
212
- x = 'flat'
213
- return x.lower()
214
-
215
194
  def fmthelper(x: str):
216
195
  x = x.lower()
217
196
  if x in ('xlsx', 'xlsm', 'xltx', 'xltm', 'xlsb', 'xls', 'excel', 'xl'):
@@ -236,5 +215,11 @@ def main():
236
215
  except KeyboardInterrupt:
237
216
  logger.warning("Process interrupted by user, exiting...")
238
217
 
218
+ class EmptyIsTrueFixity(argparse.Action):
219
+ def __call__(self, parser, namespace, values, option_string=None):
220
+ if len(values) == 0:
221
+ values = ["SHA-1"]
222
+ setattr(namespace, self.dest, values)
223
+
239
224
  if __name__ == "__main__":
240
225
  main()