From 7d55794470c3927ff33fa596e51159ac68ff4e2e Mon Sep 17 00:00:00 2001 From: Steven England Date: Sat, 13 Jul 2024 11:27:00 +0200 Subject: [PATCH] feat: add 2.11 support (#178) * add 2.9 support * add v2.10 support * Add doc for maintenance calls * force requests==2.31.0 https://github.com/docker/docker-py/issues/3256 * fix paperless_ngx_conf_trash_dir occurences * fix none type trash dir variable --- .github/workflows/constraints.txt | 3 ++- .pre-commit-config.yaml | 4 ++-- README.md | 5 ++++- defaults/main.yml | 5 ++++- maintenance/CALLS.md | 24 ++++++++++++++++++++++++ tasks/paperless_ngx/configuration.yml | 14 ++++++++++++-- tasks/preparation/vars.yml | 2 +- vars/main.yml | 2 +- 8 files changed, 50 insertions(+), 9 deletions(-) create mode 100644 maintenance/CALLS.md diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index 7176796..4c7cc10 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -3,4 +3,5 @@ ansible==9.4.0 ansible-lint==24.2.2 pip==24.0 # urllib3==1.26.16 # <- periodically needed in some environments but not in github pipeline. Will leave it here for local builds: #https://github.com/docker/docker-py/issues/3113 -yamllint==1.35.1 \ No newline at end of file +yamllint==1.35.1 +requests==2.31.0 \ No newline at end of file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 2565675..45ae35a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,14 +5,14 @@ repos: - id: yamllint name: yamllint entry: | - yamllint -c=.yamllint.yml . + .venv/bin/yamllint -c=.yamllint.yml . language: system types: [yaml] pass_filenames: false - id: ansible-lint name: ansible-lint entry: | - ansible-lint -c .ansible-lint + .venv/bin/ansible-lint -c .ansible-lint language: system types: [yaml] pass_filenames: false diff --git a/README.md b/README.md index 355a07a..0ce217e 100644 --- a/README.md +++ b/README.md @@ -157,6 +157,9 @@ To save reading space a few abbreviations are used in the table down below: | `paperless_ngx_conf_email_task_cron` | "*/10 * * * *" | Y | Y | | 1.12 | | `paperless_ngx_conf_email_use_ssl` | false | Y | Y | | 2.0 | | `paperless_ngx_conf_email_use_tls` | false | Y | Y | | 2.0 | +| `paperless_ngx_conf_empty_trash_delay` | 30 | Y | Y | | 2.10 | +| `paperless_ngx_conf_empty_trash_dir` | "{{ paperless_ngx_dir_runtime_data }}/trash" | Y | Y | | 2.10 | +| `paperless_ngx_conf_empty_trash_task_cron` | "0 1 * * *" | Y | Y | | 2.10 | | `paperless_ngx_conf_enable_compression` | true | Y | Y | | 1.13 | | `paperless_ngx_conf_enable_flower` | false | Y | Y | Whether to start flower or not. See [using flower](docs/USING_FLOWER.md) for more information | 1.10 | | `paperless_ngx_conf_enable_http_remote_user` | false | Y | Y | | | @@ -177,6 +180,7 @@ To save reading space a few abbreviations are used in the table down below: | `paperless_ngx_conf_logrotate_max_size` | 1024 * 1024 | Y | Y | | | | `paperless_ngx_conf_max_image_pixels` | None | Y | Y | | 2.6 | | `paperless_ngx_conf_media_root` | "{{ paperless_ngx_dir_runtime_data }}/media" | Y | Y | | | +| `paperless_ngx_conf_model_file` | "{{ paperless_ngx_conf_data_dir }}/classification_model.pickle" | Y | Y | | 2.9 | | `paperless_ngx_conf_nltk_dir` | /usr/share/nltk_data | Y | Y | | 1.11 | | `paperless_ngx_conf_number_of_suggested_dates` |3| Y | Y | | | | `paperless_ngx_conf_ocr_clean` | clean | Y | Y | | | @@ -215,7 +219,6 @@ To save reading space a few abbreviations are used in the table down below: | `paperless_ngx_conf_tika_gotenberg_endpoint` | http://localhost:3000 | Y | Y | | | | `paperless_ngx_conf_time_zone` | Europe/London | Y | Y | | | | `paperless_ngx_conf_train_task_cron` | "5 */1 * * *" | Y | Y | | 1.12 | -| `paperless_ngx_conf_trash_dir` | "{{ paperless_ngx_dir_runtime_data }}/trash" | Y | Y | | | | `paperless_ngx_conf_trusted_proxies` | "" | Y | Y | | 1.14 | | `paperless_ngx_conf_url` | http://localhost:8000 | Y | Y | | | | `paperless_ngx_conf_use_x_forward_host` | False | Y | Y | | 1.14 | diff --git a/defaults/main.yml b/defaults/main.yml index fc9fe66..3717b3b 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -53,8 +53,12 @@ paperless_ngx_conf_email_host_password: "" paperless_ngx_conf_email_port: 25 paperless_ngx_conf_email_use_tls: false paperless_ngx_conf_email_use_ssl: false +paperless_ngx_conf_empty_trash_delay: 30 +paperless_ngx_conf_empty_trash_dir: "{{ paperless_ngx_dir_runtime_data }}/trash" +paperless_ngx_conf_empty_trash_task_cron: "0 1 * * *" paperless_ngx_conf_enable_http_remote_user_api: false paperless_ngx_conf_max_image_pixels: +paperless_ngx_conf_model_file: "{{ paperless_ngx_conf_data_dir }}/classification_model.pickle" paperless_ngx_conf_ocr_color_conversion_strategy: "RGB" paperless_ngx_conf_ocr_skip_archive_file: "never" paperless_ngx_conf_proxy_ssl_header: @@ -77,7 +81,6 @@ paperless_ngx_conf_dbsslmode: prefer paperless_ngx_conf_db_timeout: paperless_ngx_conf_consumption_dir: "{{ paperless_ngx_dir_runtime_data }}/consumption" paperless_ngx_conf_data_dir: "{{ paperless_ngx_dir_runtime_data }}/data" -paperless_ngx_conf_trash_dir: "{{ paperless_ngx_dir_runtime_data }}/trash" paperless_ngx_conf_media_root: "{{ paperless_ngx_dir_runtime_data }}/media" paperless_ngx_conf_filename_format: paperless_ngx_conf_filename_format_remove_none: false diff --git a/maintenance/CALLS.md b/maintenance/CALLS.md new file mode 100644 index 0000000..187af25 --- /dev/null +++ b/maintenance/CALLS.md @@ -0,0 +1,24 @@ +# Doc generation for vars + +Call + +`python3 maintenance/vars/transform_var.py ` +`python3 maintenance/vars/transform_var.py PAPERLESS_MODEL_FILE PAPERLESS_DATA_DIR/classification_model.pickle 2.9` + +Result + +``` +paperless_ngx_conf_model_file: PAPERLESS_DATA_DIR/classification_model.pickle # <-- vars default +| `paperless_ngx_conf_model_file` | PAPERLESS_DATA_DIR/classification_model.pickle | Y | Y | | 2.9 | <--- readme + - pngx_var: PAPERLESS_MODEL_FILE # <-- conf yml + role_var: "{{ paperless_ngx_conf_model_file }}" + since_version: '2.9.0' +``` + +Call + +`python3 maintenance/vars/check_vars.py --version 2.11.0` + +Result + +Shows differences between local vars in different files and the online documentation. \ No newline at end of file diff --git a/tasks/paperless_ngx/configuration.yml b/tasks/paperless_ngx/configuration.yml index e0ae3b6..0b84557 100644 --- a/tasks/paperless_ngx/configuration.yml +++ b/tasks/paperless_ngx/configuration.yml @@ -91,12 +91,24 @@ - pngx_var: PAPERLESS_EMAIL_USE_TLS role_var: "{{ paperless_ngx_conf_email_use_tls }}" since_version: '2.0.0' + - pngx_var: PAPERLESS_EMPTY_TRASH_DELAY + role_var: "{{ paperless_ngx_conf_empty_trash_delay }}" + since_version: '2.10.0' + - pngx_var: PAPERLESS_EMPTY_TRASH_DIR + role_var: "{{ paperless_ngx_conf_empty_trash_dir }}" + since_version: '2.10.0' + - pngx_var: PAPERLESS_EMPTY_TRASH_TASK_CRON + role_var: "{{ paperless_ngx_conf_empty_trash_task_cron }}" + since_version: '2.10.0' - pngx_var: PAPERLESS_ENABLE_HTTP_REMOTE_USER_API role_var: "{{ paperless_ngx_conf_enable_http_remote_user_api }}" since_version: '2.5.0' - pngx_var: PAPERLESS_MAX_IMAGE_PIXELS role_var: "{{ paperless_ngx_conf_max_image_pixels }}" since_version: '2.6.0' + - pngx_var: PAPERLESS_MODEL_FILE + role_var: "{{ paperless_ngx_conf_model_file }}" + since_version: '2.9.0' - pngx_var: PAPERLESS_OCR_COLOR_CONVERSION_STRATEGY role_var: "{{ paperless_ngx_conf_ocr_color_conversion_strategy }}" since_version: '2.1.0' @@ -191,8 +203,6 @@ role_var: "{{ paperless_ngx_conf_consumption_dir }}" - pngx_var: PAPERLESS_DATA_DIR role_var: "{{ paperless_ngx_conf_data_dir }}" - - pngx_var: PAPERLESS_TRASH_DIR - role_var: "{{ paperless_ngx_conf_trash_dir }}" - pngx_var: PAPERLESS_MEDIA_ROOT role_var: "{{ paperless_ngx_conf_media_root }}" - pngx_var: PAPERLESS_STATICDIR diff --git a/tasks/preparation/vars.yml b/tasks/preparation/vars.yml index f764971..50d5983 100644 --- a/tasks/preparation/vars.yml +++ b/tasks/preparation/vars.yml @@ -5,7 +5,7 @@ - 'not paperless_ngx_dir_installation in paperless_ngx_dir_runtime_data' - 'not paperless_ngx_dir_installation in paperless_ngx_conf_consumption_dir' - 'not paperless_ngx_dir_installation in paperless_ngx_conf_data_dir' - - 'not paperless_ngx_dir_installation in paperless_ngx_conf_trash_dir' + - 'not paperless_ngx_dir_installation in paperless_ngx_conf_empty_trash_dir' - 'not paperless_ngx_dir_installation in paperless_ngx_conf_media_root' - 'not paperless_ngx_dir_installation in paperless_ngx_conf_logging_dir' msg: diff --git a/vars/main.yml b/vars/main.yml index 50e6a2b..e4dea8b 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -16,7 +16,7 @@ paperless_ngx_dir_force_permission_include: - "{{ paperless_ngx_dir_runtime_data }}" - "{{ paperless_ngx_conf_consumption_dir }}" - "{{ paperless_ngx_conf_data_dir }}" - - "{{ paperless_ngx_conf_trash_dir }}" + - "{{ paperless_ngx_conf_empty_trash_dir }}" - "{{ paperless_ngx_conf_media_root }}" - "{{ paperless_ngx_conf_logging_dir }}" paperless_ngx_dir_tmp: /tmp/paperless-ngx