Metadata-Version: 2.4
Name: ckanext-files
Version: 1.0.0
Author-email: DataShades <datashades@linkdigital.com.au>, Sergey Motornyuk <sergey.motornyuk@linkdigital.com.au>
Maintainer-email: DataShades <datashades@linkdigital.com.au>
License: AGPL
Project-URL: Homepage, https://github.com/DataShades/ckanext-files
Keywords: CKAN,file-management,cloud,filesystem
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: file-keeper>=0.0.9
Requires-Dist: typing_extensions
Requires-Dist: pyyaml
Provides-Extra: test
Requires-Dist: pytest-ckan; extra == "test"
Requires-Dist: pytest-cov; extra == "test"
Requires-Dist: pytest-faker; extra == "test"
Requires-Dist: freezegun; extra == "test"
Requires-Dist: responses; extra == "test"
Provides-Extra: docs
Requires-Dist: mkdocs; extra == "docs"
Requires-Dist: mkdocs-material; extra == "docs"
Requires-Dist: pymdown-extensions; extra == "docs"
Requires-Dist: mkdocstrings[python]; extra == "docs"
Provides-Extra: dev
Requires-Dist: pytest-ckan; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: pytest-faker; extra == "dev"
Requires-Dist: freezegun; extra == "dev"
Requires-Dist: responses; extra == "dev"
Requires-Dist: mkdocs; extra == "dev"
Requires-Dist: mkdocs-material; extra == "dev"
Requires-Dist: pymdown-extensions; extra == "dev"
Requires-Dist: mkdocstrings[python]; extra == "dev"
Provides-Extra: s3
Requires-Dist: file-keeper[s3]; extra == "s3"
Provides-Extra: gcs
Requires-Dist: file-keeper[gcs]; extra == "gcs"
Provides-Extra: opendal
Requires-Dist: file-keeper[opendal]; extra == "opendal"
Provides-Extra: libcloud
Requires-Dist: file-keeper[libcloud]; extra == "libcloud"
Dynamic: license-file

[![Tests](https://github.com/DataShades/ckanext-files/actions/workflows/test.yml/badge.svg)](https://github.com/DataShades/ckanext-files/actions/workflows/test.yml)

# ckanext-files

Files as first-class citizens of CKAN. Upload, manage, remove files directly
and attach them to datasets, resources, etc.

Read the [documentation](https://datashades.github.io/ckanext-files/) for a full user guide.

Also, check [documentation](https://datashades.github.io/file-keeper/) of the
[file-keeper](https://pypi.org/project/file-keeper/) library. It's used by this
extension and contains logic that does not depend on CKAN and may be useful if
you are going to implement custom storage adapter or just want to use familiar
file abstractions in the arbitrary program.


## Quickstart

1. Install the extension
   ```sh
   pip install ckanext-files
   ```

1. Add `files` to the `ckan.plugins` setting of the CKAN config file.

1. Run DB migrations
   ```sh
   ckan db upgrade -p files
   ```

1. Configure storage

    ```ini
    ckanext.files.storage.default.type = files:fs
    ckanext.files.storage.default.path = /tmp/example
    ckanext.files.storage.default.create_path = true
    ```

1. Upload your first file

    ```sh
    ckanapi action files_file_create upload@~/Downloads/file.txt`
    ```


## Development

Install `dev` extras and nodeJS dependencies:

```sh
pip install -e '.[dev]'
npm ci
```

Run unittests:
```sh
pytest
```

Run frontend tests:
```sh
# start test server in separate terminal
make test-server

# run tests
npx cypress run
```

Run typecheck:
```sh
npx pyright
```


## License

[AGPL](https://www.gnu.org/licenses/agpl-3.0.en.html)
