From 2424843e27870e9c11c6100c569d80cca8fbc551 Mon Sep 17 00:00:00 2001 From: Sergey Motornyuk Date: Tue, 12 Mar 2024 21:49:35 +0200 Subject: [PATCH] chore: pin version --- README.md | 92 ++++++++++++++++++++++++----------------- ckanext/files/config.py | 2 +- ckanext/files/plugin.py | 4 +- setup.cfg | 2 +- 4 files changed, 57 insertions(+), 43 deletions(-) diff --git a/README.md b/README.md index bd43c92..ce3e628 100644 --- a/README.md +++ b/README.md @@ -1,77 +1,91 @@ # ckanext-files -Upload and use standalone files. No resources, no datasets, just files. - +Files as first-class citizens of CKAN. Upload, manage, remove files directly +and attach them to datasets, resources, etc. ## Requirements - Compatibility with core CKAN versions: | CKAN version | Compatible? | |--------------|-------------| +| 2.8 | yes | | 2.9 | yes | +| 2.10 | yes | | master | yes | +CKAN v2.8 and v2.9 are supported by ckanext-files v0.2. Starting from v1.0 this +extension switches to CKAN support policy of two latest CKAN releases. I.e, +ckanext-files v1.0 supports only CKAN v2.10 and v2.11. -alembic==1.4 +v0.2 will not receive any new features, only bug-fixes. + +It's recommended to install the extension via pip, so you probably have all the +requirements pinned already. If you are using GitHub version of this extension, +stick to the vX.Y.Z tags to avoid breaking changes. Check the changelog before +upgrading the extension. ## Installation To install ckanext-files: 1. Install the extension + ```sh + # minimal installation + pip install ckanext-files - pip install ckanext-files + # Google Cloud Storage support + pip install 'ckanext-files[gcstorage]' + ``` 1. Add `files` to the `ckan.plugins` setting in your CKAN config file. -1. Updgrade DB - - ckan db upgrade -p files +1. Run DB migrations + ```sh + # CKAN >= v2.9 with alembic + ckan db upgrade -p files -## API + # CKAN == v2.8 + paster --plugin=ckanext-files files -c ckan.ini initdb + ``` -Each API action has corresponding auth-function with the same name. By default -only sysadmin can pass auth check(unless different behavior explicitly -mentioned in action description). Whenever you are using this extension feel -free to redefine these auth-functions using `tk.chained_auth_function`. +## Usage -Some of API actions has `kind` parameter. It defines which folder will store -the file, which config options will be applied, etc. Default value is -`ckanext_files_file` -* `files_file_create` - Create new `file` entity. +## Configuration - Parameters: - * `name` Name for the uploaded file. - * `upload` File itself - * `kind` Type of uploaded file. - * `extras` Dictionary with any details that can be used for your needs. +There are two types of config options for ckanext-files: +* Global configuration affects the common behavior of the extension +* Storage configuration changes behavior of the specific storage and never + affects anything outside of the storage - Returns: - * `id: str` Unique ID of the new `file`. - * `name: str` Name for the `file`. - * `url: str` File itself - * `kind: str` Type of uploaded file. - * `uploaded_at: datetime.datetime` File creation date - * `extras: Optional[dict[str, Any]]` Dictionary with any details that can be used for your needs. +Depending on the type of the storage, available options for storage change. For +example, `files:fs` storage type requires `path` option that controls +filesystem path where uploads are stored. `files:redis` storage type accepts +`prefix` option that defines Redis' key prefix of files stored in Redis. All +storage specific options always have form +`ckanext.files.storage..