|
1 | | -<p align="center"> |
2 | | - <h1 align="center">Python DVUploader</h1> |
3 | | -</p> |
| 1 | +<h1 align="center"> |
| 2 | + Dataverse Uploader</br> |
| 3 | + <a href="https://badge.fury.io/py/dvuploader"><img src="https://badge.fury.io/py/dvuploader.svg" alt="PyPI version" height="18"></a> |
| 4 | + <img src="https://img.shields.io/badge/python-3.8|3.9|3.10|3.11-blue.svg" alt="Build Badge"> |
| 5 | + <img src="https://github.com/gdcc/python-dvuploader/actions/workflows/test.yaml/badge.svg" alt="Build Badge"> |
| 6 | +</h1> |
4 | 7 |
|
5 | 8 | Python equivalent to the [DVUploader](https://github.com/GlobalDataverseCommunityConsortium/dataverse-uploader) written in Java. Complements other libraries written in Python and facilitates the upload of files to a Dataverse instance via [Direct Upload](https://guides.dataverse.org/en/latest/developers/s3-direct-upload-api.html). |
6 | 9 |
|
@@ -41,23 +44,27 @@ python3 -m pip install . |
41 | 44 | In order to perform a direct upload, you need to have a Dataverse instance running and a cloud storage provider. The following example shows how to upload files to a Dataverse instance. Simply provide the files of interest and utilize the `upload` method of a `DVUploader` instance. |
42 | 45 |
|
43 | 46 | ```python |
44 | | -from dvuploader import DVUploader, File |
| 47 | +import dvuploader as dv |
| 48 | + |
45 | 49 |
|
| 50 | +# Add file individually |
46 | 51 | files = [ |
47 | | - File(filepath="./small.txt"), |
48 | | - File(directoryLabel="some/dir", filepath="./medium.txt"), |
49 | | - File(directoryLabel="some/dir", filepath="./big.txt"), |
| 52 | + dv.File(filepath="./small.txt"), |
| 53 | + dv.File(directoryLabel="some/dir", filepath="./medium.txt"), |
| 54 | + dv.File(directoryLabel="some/dir", filepath="./big.txt"), |
| 55 | + *dv.add_directory("./data"), # Add an entire directory |
50 | 56 | ] |
51 | 57 |
|
52 | 58 | DV_URL = "https://demo.dataverse.org/" |
53 | 59 | API_TOKEN = "XXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX" |
54 | 60 | PID = "doi:10.70122/XXX/XXXXX" |
55 | 61 |
|
56 | | -dvuploader = DVUploader(files=files) |
| 62 | +dvuploader = dv.DVUploader(files=files) |
57 | 63 | dvuploader.upload( |
58 | 64 | api_token=API_TOKEN, |
59 | 65 | dataverse_url=DV_URL, |
60 | 66 | persistent_id=PID, |
| 67 | + n_parallel_uploads=2, # Whatever your instance can handle |
61 | 68 | ) |
62 | 69 | ``` |
63 | 70 |
|
@@ -109,7 +116,3 @@ The `config` file can then be used as follows: |
109 | 116 | ```bash |
110 | 117 | dvuploader --config-path config.yml |
111 | 118 | ``` |
112 | | - |
113 | | -#### CLI Binaries |
114 | | - |
115 | | -DVUploader ships with binaries for Linux, MacOS and Windows. You can download the binaries from the `bin` [directory](./bin) and use them in a similar fashion as described above. |
|
0 commit comments