auto-reference-generator 1.3.6__tar.gz → 1.3.7__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 (50) hide show
  1. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/.github/workflows/build-portable.yml +56 -29
  2. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/.github/workflows/pypi-publish.yml +11 -1
  3. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/.github/workflows/python-tests.yml +2 -2
  4. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/.gitignore +2 -1
  5. auto_reference_generator-1.3.7/.pre-commit-config.yaml +12 -0
  6. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/LICENSE.md +1 -1
  7. auto_reference_generator-1.3.7/PKG-INFO +445 -0
  8. auto_reference_generator-1.3.7/README.md +421 -0
  9. auto_reference_generator-1.3.7/assets/sample_from_dict.json +1 -0
  10. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator/__init__.py +3 -3
  11. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator/cli.py +134 -65
  12. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator/common.py +21 -18
  13. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator/options/options.properties +2 -2
  14. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator/reference_generator.py +42 -41
  15. auto_reference_generator-1.3.7/auto_reference_generator.egg-info/PKG-INFO +445 -0
  16. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator.egg-info/SOURCES.txt +6 -0
  17. auto_reference_generator-1.3.7/auto_reference_generator.egg-info/entry_points.txt +2 -0
  18. auto_reference_generator-1.3.7/installer/README.txt +52 -0
  19. auto_reference_generator-1.3.7/installer/auto_ref.cmd +14 -0
  20. auto_reference_generator-1.3.7/installer/install.cmd +102 -0
  21. auto_reference_generator-1.3.7/installer/uninstall.cmd +66 -0
  22. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/pyproject.toml +3 -3
  23. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/pytest.ini +2 -2
  24. auto_reference_generator-1.3.7/requirements.txt +27 -0
  25. auto_reference_generator-1.3.7/samples/sample_json_dict.json +1 -0
  26. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/tests/test_common.py +1 -1
  27. auto_reference_generator-1.3.6/PKG-INFO +0 -350
  28. auto_reference_generator-1.3.6/README.md +0 -326
  29. auto_reference_generator-1.3.6/assets/sample_from_dict.json +0 -1
  30. auto_reference_generator-1.3.6/auto_reference_generator.egg-info/PKG-INFO +0 -350
  31. auto_reference_generator-1.3.6/auto_reference_generator.egg-info/entry_points.txt +0 -2
  32. auto_reference_generator-1.3.6/samples/sample_json_dict.json +0 -1
  33. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/.github/workflows/codeql.yml +0 -0
  34. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/assets/AccessionPreview.png +0 -0
  35. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/assets/HashPreview.png +0 -0
  36. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/assets/ReferencesPreview.png +0 -0
  37. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/assets/SpreadGen.png +0 -0
  38. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/assets/SpreadPreview.png +0 -0
  39. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/assets/metaFolder.png +0 -0
  40. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator/hash.py +0 -0
  41. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator.egg-info/dependency_links.txt +0 -0
  42. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator.egg-info/requires.txt +0 -0
  43. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/auto_reference_generator.egg-info/top_level.txt +0 -0
  44. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/samples/auto_reference_generator_AutoRef.xlsx +0 -0
  45. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/samples/auto_reference_generator_AutoRef_from_json.xlsx +0 -0
  46. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/setup.cfg +0 -0
  47. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/tests/test_hash.py +0 -0
  48. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/tests/test_reference_generator.py +0 -0
  49. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/tests/test_reference_generator_integration.py +0 -0
  50. {auto_reference_generator-1.3.6 → auto_reference_generator-1.3.7}/tests/test_reference_loop_and_keywords.py +0 -0
@@ -25,41 +25,60 @@ jobs:
25
25
  run: |
26
26
  choco install llvm -y
27
27
  python -m pip install --upgrade pip
28
- pip install nuitka ordered-set zstandard odf lxml
28
+ pip install nuitka ordered-set zstandard odfpy lxml
29
29
  pip install -e .
30
30
 
31
31
  - name: Build Windows executable with Nuitka
32
32
  env:
33
33
  NUITKA_CACHE_DIR: ${{ runner.temp }}/nuitka_cache
34
34
  run: |
35
- $tag = "${{ github.ref_name }}"
36
- $version = [regex]::Match($tag, '\d+\.\d+\.\d+').Value
37
- if ($version -eq "") { $version = "1.0.0" }
38
- python -m nuitka `
39
- --onefile `
40
- -o auto_ref `
41
- --output-dir=build `
42
- --include-package=odf `
43
- --include-package=lxml `
44
- --include-package=pandas `
45
- --include-package=auto_reference_generator `
46
- --include-data-dir=auto_reference_generator/options=options `
47
- --windows-console-mode=attach `
48
- --company-name="Auto Reference Generator" `
49
- --product-name="Auto Reference Generator" `
50
- --file-version="$version" `
51
- --product-version="$version" `
52
- --copyright="Copyright $(Get-Date -Format yyyy)" `
53
- --assume-yes-for-downloads `
54
- --quiet `
55
- --clang `
56
- --mingw64 `
57
- auto_reference_generator/cli.py
58
-
59
- - name: Create Windows artifact archive
35
+ $tag = "${{ github.ref_name }}"
36
+ $version = [regex]::Match($tag, '\d+\.\d+\.\d+').Value
37
+ if ($version -eq "") { $version = "1.0.0" }
38
+ python -m nuitka `
39
+ --onefile `
40
+ --follow-imports `
41
+ --windows-console-mode=force `
42
+ -o auto_ref `
43
+ --output-dir=build `
44
+ --nofollow-import-to=pandas.tests `
45
+ --nofollow-import-to=pandas.conftest `
46
+ --include-package=odf `
47
+ --include-package=lxml `
48
+ --include-package=pandas `
49
+ --include-package=auto_reference_generator `
50
+ --include-data-dir=auto_reference_generator/options=options `
51
+ --company-name="Auto Reference Generator" `
52
+ --product-name="Auto Reference Generator" `
53
+ --file-version="$version" `
54
+ --product-version="$version" `
55
+ --copyright="Copyright $(Get-Date -Format yyyy)" `
56
+ --assume-yes-for-downloads `
57
+ --quiet `
58
+ --clang `
59
+ auto_reference_generator/cli.py
60
+
61
+
62
+ - name: Create Windows package
60
63
  run: |
61
64
  $version = "${{ github.ref_name }}" -replace "^v", ""
62
- Compress-Archive -Path build/auto_ref.exe -DestinationPath "auto_ref_windows_$version.zip"
65
+ if ($version -eq "") { $version = "1.0.0" }
66
+
67
+ # Create folder structure
68
+ New-Item -ItemType Directory -Force -Path "auto_ref/bin" | Out-Null
69
+
70
+ # Copy executable and wrapper
71
+ Copy-Item -Path "build/auto_ref.exe" -Destination "auto_ref/bin/"
72
+ Copy-Item -Path "installer/auto_ref.cmd" -Destination "auto_ref/bin/"
73
+
74
+ # Copy documentation and scripts
75
+ Copy-Item -Path "installer/README.txt" -Destination "auto_ref/"
76
+ Copy-Item -Path "installer/install.cmd" -Destination "auto_ref/"
77
+ Copy-Item -Path "installer/uninstall.cmd" -Destination "auto_ref/"
78
+ Copy-Item -Path "LICENSE.md" -Destination "auto_ref/" -ErrorAction SilentlyContinue
79
+
80
+ # Create portable ZIP
81
+ Compress-Archive -Path "auto_ref" -DestinationPath "auto_ref_windows_$version.zip"
63
82
 
64
83
  - name: Upload Windows artifact
65
84
  uses: actions/upload-artifact@v4
@@ -94,15 +113,18 @@ jobs:
94
113
  - name: Install Python dependencies
95
114
  run: |
96
115
  python -m pip install --upgrade pip
97
- pip install nuitka ordered-set zstandard odf lxml
116
+ pip install nuitka ordered-set zstandard odfpy lxml
98
117
  pip install -e .
99
118
 
100
119
  - name: Build Linux executable with Nuitka
101
120
  run: |
102
121
  python -m nuitka \
103
122
  --onefile \
123
+ --follow-imports \
104
124
  -o auto_ref \
105
125
  --output-dir=build \
126
+ --nofollow-import-to=pandas.tests \
127
+ --nofollow-import-to=pandas.conftest \
106
128
  --include-package=odf \
107
129
  --include-package=lxml \
108
130
  --include-package=pandas \
@@ -110,6 +132,7 @@ jobs:
110
132
  --include-data-dir=auto_reference_generator/options=options \
111
133
  --assume-yes-for-downloads \
112
134
  --quiet \
135
+ --clang \
113
136
  auto_reference_generator/cli.py
114
137
 
115
138
  - name: Create Linux artifact archive
@@ -150,14 +173,17 @@ jobs:
150
173
  - name: Install Python dependencies
151
174
  run: |
152
175
  python -m pip install --upgrade pip
153
- pip install nuitka ordered-set zstandard odf lxml
176
+ pip install nuitka ordered-set zstandard odfpy lxml
154
177
  pip install -e .
155
178
 
156
179
  - name: Build macOS executable with Nuitka
157
180
  run: |
158
181
  python -m nuitka \
159
182
  --onefile \
183
+ --follow-imports \
160
184
  -o auto_ref \
185
+ --nofollow-import-to=pandas.tests \
186
+ --nofollow-import-to=pandas.conftest \
161
187
  --output-dir=build \
162
188
  --include-package=odf \
163
189
  --include-package=lxml \
@@ -167,6 +193,7 @@ jobs:
167
193
  --macos-create-app-bundle \
168
194
  --assume-yes-for-downloads \
169
195
  --quiet \
196
+ --clang \
170
197
  auto_reference_generator/cli.py
171
198
 
172
199
  - name: Create macOS artifact archive
@@ -1,12 +1,22 @@
1
1
  name: Publish Python distribution to PyPI
2
2
 
3
- on:
3
+ on:
4
4
  push:
5
5
  tags:
6
6
  - 'v*'
7
+ paths-ignore:
8
+ - 'README.md'
9
+ - 'docs/**'
10
+ - 'assets/**'
11
+ - '.github/**'
7
12
  pull_request:
8
13
  # The branches below must be a subset of the branches above
9
14
  branches: [ master ]
15
+ paths-ignore:
16
+ - 'README.md'
17
+ - 'docs/**'
18
+ - 'assets/**'
19
+ - '.github/**'
10
20
 
11
21
  jobs:
12
22
  build:
@@ -31,7 +31,7 @@ jobs:
31
31
  uses: actions/setup-python@v4
32
32
  with:
33
33
  python-version: ${{ matrix.python-version }}
34
-
34
+
35
35
  - name: Install dependencies
36
36
  run: |
37
37
  python -m pip install --upgrade pip
@@ -39,4 +39,4 @@ jobs:
39
39
 
40
40
  - name: Run tests
41
41
  run: |
42
- python -m pytest -v
42
+ python -m pytest -v
@@ -4,4 +4,5 @@ dist/
4
4
  .linuxvenv
5
5
  .vscode
6
6
  auto_reference_generator.egg-info/
7
- build/
7
+ build/
8
+ auto_reference_generator.code-workspace
@@ -0,0 +1,12 @@
1
+ repos:
2
+ - repo: https://github.com/igrr/argparse_to_md.git
3
+ rev: v0.4.0
4
+ hooks:
5
+ - id: argparse_to_md
6
+ - repo: https://github.com/pre-commit/pre-commit-hooks
7
+ rev: v4.5.0
8
+ hooks:
9
+ - id: check-yaml
10
+ - id: end-of-file-fixer
11
+ - id: trailing-whitespace
12
+ exclude: ^README\.md$
@@ -199,4 +199,4 @@
199
199
  distributed under the License is distributed on an "AS IS" BASIS,
200
200
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
201
  See the License for the specific language governing permissions and
202
- limitations under the License.
202
+ limitations under the License.
@@ -0,0 +1,445 @@
1
+ Metadata-Version: 2.4
2
+ Name: auto_reference_generator
3
+ Version: 1.3.7
4
+ Summary: A tool for archivist's to automate the generation of references for digital files
5
+ Author-email: Christopher Prince <c.pj.prince@gmail.com>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Homepage, https://github.com/CPJPRINCE/auto_reference_generator
8
+ Project-URL: Issues, https://github.com/CPJPRINCE/auto_reference_generator/issues
9
+ Keywords: archiving,archives,digital archiving,references,automatic archival reference generator
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Operating System :: OS Independent
12
+ Classifier: Topic :: System :: Archiving
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE.md
15
+ Requires-Dist: pandas
16
+ Requires-Dist: openpyxl
17
+ Requires-Dist: tqdm
18
+ Provides-Extra: addex
19
+ Requires-Dist: lxml; extra == "addex"
20
+ Requires-Dist: odfpy; extra == "addex"
21
+ Provides-Extra: dev
22
+ Requires-Dist: pytest>=7.0; extra == "dev"
23
+ Dynamic: license-file
24
+
25
+ # Auto Reference Generator
26
+
27
+ A small python programme to generate hierarchical archival reference for files and directories and export the results to a spreadsheet.
28
+
29
+ [![Supported Versions](https://img.shields.io/pypi/pyversions/auto_reference_generator.svg)](https://pypi.org/project/auto_reference_generator)
30
+ [![CodeQL](https://github.com/CPJPRINCE/auto_reference_generator/actions/workflows/codeql.yml/badge.svg)](https://github.com/CPJPRINCE/auto_reference_generator/actions/workflows/codeql.yml)
31
+
32
+ ## Table of Contents
33
+ - [Quick Start](#quick-start)
34
+ - [Option 1: Using pip (Recommended for Python users / long-term usage)](#option-1-using-pip-recommended-for-python-users--long-term-usage)
35
+ - [Option 2: Using Portable Executable (No Python Required)](#option-2-using-portable-executable-no-python-required)
36
+ - [Output](#output)
37
+ - [Version & Package info](#version--package-info)
38
+ - [Why use this tool?](#why-use-this-tool)
39
+ - [Additional Features:](#additional-features)
40
+ - [Basic Usage / Examples](#basic-usage--examples)
41
+ - [Expected Spreadsheet](#expected-spreadsheet)
42
+ - [Structure of References](#structure-of-references)
43
+ - [Advanced Options](#advanced-options)
44
+ - [Clear Empty Directories](#clear-empty-directories)
45
+ - [Hash/Fixity Generation](#hashfixity-generation)
46
+ - [Level Limit](#level-limit)
47
+ - [Skip](#skip)
48
+ - [Keywords](#keywords)
49
+ - [Options File](#options-file)
50
+ - [Accession mode](#accession-mode)
51
+ - [Full Options:](#full-options)
52
+ - [Troubleshooting](#troubleshooting)
53
+ - [Future Developments](#future-developments)
54
+ - [Contributing](#contributing)
55
+ - [Developers](#developers)
56
+
57
+
58
+ ## Quick Start
59
+
60
+ ### Option 1: Using pip (Recommended for Python users / long-term usage)
61
+ ```bash
62
+ pip install -U auto_reference_generator
63
+ auto_ref /path/to/root -p PREFIX -o /path/to/output
64
+ ```
65
+
66
+ ### Option 2: Using Portable Executable (No Python Required)
67
+ Download the latest portable executable for your platform from [Releases](https://github.com/CPJPRINCE/auto_reference_generator/releases)
68
+
69
+ Extract and run:
70
+ ```bash
71
+ # Windows
72
+ cd auto_ref\bin
73
+ .\auto_ref.cmd .\path\to\root -p PREFIX -o .\path\to\output
74
+
75
+ # Linux/macOS
76
+ ./auto_ref /path/to/root -p PREFIX -o /path/to/output
77
+ ```
78
+ On Windows you can also use the install.cmd with admin privileges to install and run the command without navigating to the .cmd directory (see Option 1 for use)
79
+
80
+ ### Output
81
+ Generates a `meta` folder with output `root_AutoRef.xlsx` and a list of the generated reference hierarchy, alongside some metadata.
82
+
83
+ ## Version & Package info
84
+
85
+ Python Version:
86
+ Python Version 3.10+ is recommended. Earlier versions may work but are not tested.
87
+
88
+ Additional Packages:
89
+ - pandas (required)
90
+ - openpyxl (required)
91
+ - pyodf (optional - ods export)
92
+ - lxml (optional - xml export)
93
+ - tqdm (required)
94
+
95
+ To install using Python:
96
+
97
+ ```bash
98
+ pip install pandas openpyxl pyodf lxml tqdm
99
+ ```
100
+
101
+ If using Python ensure it is added to Environment.
102
+
103
+ ## Why use this tool?
104
+
105
+ This tool is designed for archivists cataloguing large amounts of Digital Records at a time.
106
+
107
+ Automated Generation of References saves time and effort compared to manually filling in vs.
108
+
109
+ Additional options expand upon this and allow insertion into existing hierarchies and reference systems.
110
+
111
+ ## Additional Features:
112
+
113
+ - **Prefixes - allowing merging into existing hierarchies**
114
+ - **Suffixes**
115
+ - **Level identification and limiting**
116
+ - **Keyword assignment - replacing Numericals with specified keywords (initials, first letter, JSON map)**
117
+ - **Logged removal of empty directories**
118
+ - **Accession / Running Number mode**
119
+ - **Fixity Generation**
120
+ - **Export options include: xslx (Default), csv, ods, json or xml.**
121
+ - **Integration with Opex Manifest Generator [*\*Shameless Self promotion\**.](https://github.com/CPJPRINCE/opex_manifest_generator/)**
122
+
123
+ ## Basic Usage / Examples
124
+
125
+ - Basic: `auto_ref /path/to/root`
126
+ - Prefix: `auto_ref /path/to/root -p PREFIX`
127
+ - Suffix: `auto_ref /path/to/root -s SUFFIX`
128
+ - Delimiter: `auto_ref /path/to/root -dlm "-"`
129
+ - Accession: `auto_ref /path/to/root -acc file`
130
+ - Fixity: `auto_ref /path/to/root -fx MD5`
131
+ - Format: `auto_ref /path/to/root -fmt csv`
132
+ - Remove Empty `auto_ref /path/to/root --remove-empty`
133
+ - Output: `auto_ref /path/to/root -o /path/to/output`
134
+ - Include Hidden: `auto_ref /path/to/root --hidden`
135
+
136
+ These options can be combined in a number of combinations.
137
+
138
+ ## Expected Spreadsheet
139
+
140
+ The spreadsheet should output like so:
141
+
142
+ ![SpreadPreview](assets/SpreadPreview.png)
143
+
144
+ This includes a preset of metadata:
145
+ Including: FullName, RelativeName, BaseName, Size, Modified, Ref_Section Level, Parent, Archive_Reference,
146
+
147
+ The reference will by default be generated to the `Archive_Reference` column:
148
+
149
+ ![ReferencePreview](assets/ReferencesPreview.png)
150
+
151
+ ## Structure of References
152
+
153
+ ```
154
+ # Usage with Prefix `ARC`
155
+ auto_ref /path/to/root -p ARC
156
+
157
+ Folder Reference
158
+ >Root ARC
159
+ --->Folder 1 ARC/1
160
+ ------>Sub Folder 1 ARC/1/1
161
+ --------->File 1 ARC/1/1/1
162
+ --------->File 2 ARC/1/1/2
163
+ ------>Sub Folder 2 ARC/1/2
164
+ --------->File 3 ARC/1/2/1
165
+ --------->File 4 ARC/1/2/2
166
+ --->Folder 2 ARC/2
167
+ ------>Sub Folder 3 ARC/2/1
168
+ --------->File 5 ARC/2/2
169
+ --->File 6 ARC/3
170
+ ...
171
+
172
+ # Files and Folders can coexist at the same level. Without a prefix the root reference defaults to 0:
173
+ auto_ref /path/to/root
174
+
175
+ >Root 0
176
+ --->Folder 1
177
+ ------>Sub Folder 1/1
178
+ --------->File 1/1/1
179
+ --------->File2 1/1/2
180
+ ------>File3 1/2
181
+ ...
182
+
183
+ # Prefixes can also be set to integrate the folder into the existing hierarchy at any point.
184
+ auto_ref /path/to/root -p "ARC/1/2/3"
185
+
186
+ >Root ARC/1/2/3
187
+ --->Folder ARC/1/2/3/1
188
+ ------>File ARC/1/2/3/1/1
189
+ ------>File2 ARC/1/2/3/1/2
190
+ ...
191
+
192
+ # Start Ref option will also set the starting number for first subfolder.
193
+ auto_ref /path/to/root -p "ARC/1/2/3" -s 5
194
+
195
+ >Root ARC/1/2/3
196
+ --->Folder ARC/1/2/3/5
197
+ ------>File ARC/1/2/3/5/1
198
+ ...
199
+
200
+ ```
201
+ ## Advanced Options
202
+
203
+ **Important notes**
204
+
205
+ - The term `meta` is hard coded to always be ignored for folders.
206
+ - A meta folder will always be generated unless using `--disable-meta-dir` option.
207
+ - **Both relative and absolute paths will work**
208
+
209
+ ### Clear Empty Directories
210
+
211
+ ```bash
212
+ # Will remove empty directories and generate a plain text log to the 'meta folder'. This is to prevent misleading references to nothing.
213
+ auto_ref /path/to/root --remove-empty
214
+ ```
215
+
216
+ ### Hash/Fixity Generation
217
+
218
+ ```bash
219
+ # Will generate a SHA-1 fixity list alongside reference, in columns Hash and Algorithm
220
+ auto_ref /path/to/root -fx SHA-1
221
+
222
+ # MD5, SHA-1, SHA-256, SHA-512 supported.
223
+ ```
224
+
225
+ ![HashPreview](assets/HashPreview.png)
226
+
227
+ ### Level Limit
228
+
229
+ ```bash
230
+ # Sets a level-depth to stop generating referencing at. Example will stop generating 5 levels down from root.
231
+ auto_ref /path/to/root -l 5
232
+ ```
233
+
234
+ ### Skip
235
+
236
+ ```bash
237
+ # Will skip reference generation if you just want a listing of files
238
+ auto_ref /path/to/root --skip
239
+ ```
240
+
241
+ ### Keywords
242
+
243
+ Keywords replace the numerical reference with a keyword that matches folder name.
244
+ ```bash
245
+ # Replaces keywords "Department of Justice" & "Department of Finance" with intials of words IE DOJ, DOF.
246
+ auto_ref /path/to/root -key "Department of Justice" "Department of Finance"
247
+
248
+ # The keywords will replace the reference number to all matches of the keyword. The way the replacement is made is determined by the `-keym / --keyword-mode`.
249
+ ```
250
+
251
+ Keyword Modes:
252
+
253
+ ```bash
254
+ # intialise
255
+ # Uses the intials of the keywords in this example Department of Justice becomes DOJ. Singular words will use firstletters mode. Is the default mode.
256
+ auto_ref -key "Department of Justice" -keym initialise
257
+
258
+ # firstletters
259
+ # Use the first x letters of word. IE `Department of Justices` becomes `DEP`.
260
+ auto_ref -key "Department of Justice" -keym firstletters
261
+
262
+ # from_json
263
+ # Uses a Python Dictionary stored as a JSON file to set custom abbreviations.
264
+ auto_ref -key /path/to/keyword.json -keym from_json
265
+
266
+ # JSON formatted like:
267
+ {'keyword to replace':'value to replace with', 'keyword2':'value2'}
268
+ ```
269
+
270
+ Additional Keyword Options:
271
+
272
+ ```bash
273
+ --keywords-case-sensitivity # Sets make lookup case sensitive. Default is insensitive.
274
+ --keywords-abbreviation-number # Sets the number of letters to abbreviate firstletters mode to. Default is 3.
275
+ --keywords-retain-order # Sets whether reference generation will count replacements in its ordering.
276
+ # By default it will not count replacements.
277
+ # If a keyword replacement is made after reference number 1, the next reference number after the replacement will be: 2
278
+ # If this option is used the number will instead be 3.
279
+ ```
280
+
281
+ ### Options File
282
+
283
+ ```bash
284
+ # Set a custom options file to customise default headers and some program defaults
285
+ auto_ref /path/to/root --options-file /path/to/options.properties
286
+ ```
287
+
288
+ Default Options are:
289
+ ```
290
+ [options]
291
+
292
+ INDEX_FIELD = FullName # Sets name to run indexing from
293
+
294
+ PATH_FIELD = FullName
295
+ RELATIVE_FIELD = RelativeName
296
+ PARENT_FIELD = Parent
297
+ PARENT_REF = Parent_Ref
298
+ REFERENCE_FIELD = Archive_Reference
299
+ REF_SECTION = Ref_Section
300
+ ACCESSION_FIELD = Accession_Reference
301
+ LEVEL_FIELD = Level
302
+ BASENAME_FIELD = BaseName
303
+ EXTENSION_FIELD = Extension
304
+ ATTRIBUTE_FIELD = Attributes
305
+ SIZE_FIELD = Size
306
+ CREATEDATE_FIELD = Create_Date
307
+ MODDATE_FIELD = Modified_Date
308
+ ACCESSDATE_FIELD = Access_Date
309
+
310
+ ALGORITHM_FIELD = Algorithm
311
+ HASH_FIELD = Hash
312
+
313
+ ACCDELIMTER = -
314
+ ACCFILE_KEYWORD = File
315
+ ACCDIR_KEYWORD = Dir
316
+ METAFOLDER = meta
317
+ OUTPUTSUFFIX = _AutoRef
318
+ EMPTYSUFFIX = _EmptyDirsRemoved
319
+ ```
320
+
321
+ ### Accession mode
322
+
323
+ An alternative method of code generation is based on an accession number / running number pattern. Each file or folder will be given a running number regardless of depth.
324
+
325
+ Example output running Accession in "file" Mode:
326
+ ```
327
+ >Root ACC-Dir
328
+ ---> Folder 1 ACC-Dir
329
+ ------> File 1 ACC-1
330
+ ------> File 2 ACC-2
331
+ ---> File 3 ACC-3
332
+ ---> Folder 2 ACC-Dir
333
+ ------> Sub-Folder ACC-Dir
334
+ ---------> File 4 ACC-4
335
+ ```
336
+
337
+ Examples:
338
+
339
+ ```bash
340
+ # Run acc generation for files with Prefix "ACC" - numbers files
341
+ auto_ref /path/to/root -acc file -accp "ACC"`
342
+
343
+ # Run Accession generation for directories - numbers directories
344
+ auto_ref /path/to/root -acc dir -accp "ACC"`
345
+
346
+ # Run Accession generation for both - numbers both
347
+ auto_ref /path/to/root -acc both -accp "ACC"`
348
+ ```
349
+
350
+ The output will be to an additional `Accession_Reference` column
351
+
352
+ ![AccessionPReview](assets/AccessionPreview.png)
353
+
354
+ ## Full Options:
355
+
356
+ The below covers the full range of options. Use the `-h` option to show this dialog:
357
+
358
+ <!-- argparse_to_md:auto_reference_generator:create_parser -->
359
+ Usage:
360
+ ```
361
+ Auto_Reference_Generator [-h] [-v] [-p [PREFIX]] [-s [SUFFIX]]
362
+ [--suffix-option {file,dir,both}] [-acc {file,dir,both}]
363
+ [-accp [ACC_PREFIX]] [-l [LEVEL_LIMIT]] [-str [START_REF]]
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}]
368
+ [--options-file [OPTIONS_FILE]]
369
+ [--log-level [{DEBUG,INFO,WARNING,ERROR}]]
370
+ [--log-file [LOG_FILE]] [-key [KEYWORDS ...]]
371
+ [--keywords-case-sensitivity]
372
+ [-keym [{initialise,firstletters,from_json}]]
373
+ [--keywords-retain-order]
374
+ [--keywords-abbreviation-number [KEYWORDS_ABBREVIATION_NUMBER]]
375
+ [root]
376
+ ```
377
+ Auto Reference Generator for Digital Cataloguing
378
+
379
+ Positional arguments:
380
+ - `root`: The root directory to create references for
381
+
382
+ Optional arguments:
383
+ - `-v`, `--version`: See version information, then exit
384
+
385
+ Reference Options:
386
+ Options for reference generation
387
+
388
+ - `-p [PREFIX]`, `--prefix [PREFIX]`: Set a prefix to append onto generated references
389
+ - `-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.
392
+ - `-accp [ACC_PREFIX]`, `--acc-prefix [ACC_PREFIX]`: Sets the Prefix for Accession Mode
393
+ - `-l [LEVEL_LIMIT]`, `--level-limit [LEVEL_LIMIT]`: Set a level limit to generate references to
394
+ - `-str [START_REF]`, `--start-ref [START_REF]`: Set the starting reference number. Won't affect sub-folders/files
395
+ - `-dlm [DELIMITER]`, `--delimiter [DELIMITER]`: Set the delimiter to use between levels
396
+ - `--remove-empty`: Sets the Program to remove any Empty Directory and Log removals to a text file
397
+ - `--disable-empty-export`: Sets the program to not export a log of removed empty directories, by default will export, this flag disables that
398
+ - `-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
+ - `--sort-by [{folders_first`, `alphabetical}]`: Set the sorting method, 'folders_first' sorts folders first then files alphabetically; 'alphabetically' sorts alphabetically (ignoring folder distinction)
401
+
402
+ Output Options:
403
+ Options for outputting the generated references
404
+
405
+ - `-o [OUTPUT]`, `--output [OUTPUT]`: Set the output directory for the created spreadsheet
406
+ - `--disable-meta-dir`: Set to disable creating a 'meta' file for spreadsheet; can be used in combination with output
407
+ - `-skp`, `--skip`: Set to skip creating references, will generate a spreadsheet listing
408
+ - `-fmt {xlsx`, `csv`, `json`, `ods`, `xml`, `dict}`, `--output-format {xlsx`, `csv`, `json`, `ods`, `xml`, `dict}`: Set to set output format. ***Note ods requires odfpy; xml requires lxml; dict requires pandas, please install as needed***
409
+ - `--options-file [OPTIONS_FILE]`: Set the options file to use, to override output column headers and other options
410
+ - `--log-level [{DEBUG`, `INFO`, `WARNING`, `ERROR}]`: Set the logging level (default: WARNING)
411
+ - `--log-file [LOG_FILE]`: Optional path to write logs to a file (default: stdout)
412
+
413
+ Keyword Options:
414
+ Options for using keywords in reference generation
415
+
416
+ - `-key [KEYWORDS ...]`, `--keywords [KEYWORDS ...]`: Set to replace reference numbers with given Keywords for folders (only Folders atm). Can be a list of keywords or a JSON file mapping folder names to keywords.
417
+ - `--keywords-case-sensitivity`: Set to change case keyword matching sensitivity. By default keyword matching is insensitive
418
+ - `-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
+ - `--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
+ - `--keywords-abbreviation-number [KEYWORDS_ABBREVIATION_NUMBER]`: Set to set the number of letters to abbreviate for 'firstletters' mode, does not impact 'initialise' mode.
421
+ <!-- argparse_to_md_end -->
422
+
423
+ ## Troubleshooting
424
+
425
+ - On Windows ensure that when you enter the root folder it does not end in a `\`. This is slightly annoying as it adds it by default when tabbing.
426
+ - In the examples above I've used linux paths. If you're on Windows don't forget to change these to backslashes `\`
427
+
428
+ ## Future Developments
429
+
430
+ - ~~Level Limitations to allow for "group references"~~ - Added!
431
+ - ~~Generating references which use alphabetic characters~~ - Added!
432
+ - A mode for Physical Cataloguing...
433
+
434
+ ## Contributing
435
+
436
+ I welcome further contributions and feedback. If there any issues please raise them [here](https://github.com/CPJPRINCE/auto_reference_generator/issues).
437
+
438
+ ## Developers
439
+
440
+ The program can be used as a python module like so.
441
+ ```python
442
+ from auto_reference_generator import ReferenceGenerator
443
+
444
+ rg = ReferenceGenerator ("/path/to/root", prefix = "ARC", output_path = "/path/to/output")
445
+ ```