dtool-http 0.5.1__tar.gz → 0.5.3__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.
- dtool_http-0.5.3/.github/dependabot.yml +17 -0
- dtool_http-0.5.3/.github/workflows/publish.yml +62 -0
- dtool_http-0.5.3/.github/workflows/test.yml +44 -0
- dtool_http-0.5.3/.gitignore +17 -0
- dtool_http-0.5.3/CHANGELOG.rst +154 -0
- dtool_http-0.5.3/PKG-INFO +129 -0
- {dtool-http-0.5.1 → dtool_http-0.5.3}/README.rst +15 -13
- dtool_http-0.5.3/dtool_http/__init__.py +14 -0
- {dtool-http-0.5.1 → dtool_http-0.5.3}/dtool_http/server.py +1 -1
- {dtool-http-0.5.1 → dtool_http-0.5.3}/dtool_http/storagebroker.py +18 -12
- dtool_http-0.5.3/icons/22x22/dtool_logo.png +0 -0
- dtool_http-0.5.3/pyproject.toml +48 -0
- dtool_http-0.5.3/requirements.txt +1 -0
- dtool_http-0.5.3/scripts/share_data.py +139 -0
- {dtool-http-0.5.1 → dtool_http-0.5.3}/setup.cfg +10 -14
- dtool_http-0.5.3/tests/__init__.py +107 -0
- dtool_http-0.5.3/tests/test_dtool_http_server.py +43 -0
- dtool_http-0.5.3/tests/test_entry_points.py +28 -0
- dtool_http-0.5.3/tests/test_publish.py +18 -0
- dtool_http-0.5.3/tox.ini +15 -0
- dtool-http-0.5.1/MANIFEST.in +0 -1
- dtool-http-0.5.1/PKG-INFO +0 -119
- dtool-http-0.5.1/dtool_http/__init__.py +0 -7
- dtool-http-0.5.1/dtool_http.egg-info/PKG-INFO +0 -119
- dtool-http-0.5.1/dtool_http.egg-info/SOURCES.txt +0 -15
- dtool-http-0.5.1/dtool_http.egg-info/dependency_links.txt +0 -1
- dtool-http-0.5.1/dtool_http.egg-info/entry_points.txt +0 -8
- dtool-http-0.5.1/dtool_http.egg-info/requires.txt +0 -2
- dtool-http-0.5.1/dtool_http.egg-info/top_level.txt +0 -1
- dtool-http-0.5.1/setup.py +0 -36
- {dtool-http-0.5.1 → dtool_http-0.5.3}/LICENSE.rst +0 -0
- {dtool-http-0.5.1 → dtool_http-0.5.3}/dtool_http/publish.py +0 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# To get started with Dependabot version updates, you'll need to specify which
|
|
2
|
+
# package ecosystems to update and where the package manifests are located.
|
|
3
|
+
# Please see the documentation for all configuration options:
|
|
4
|
+
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
|
5
|
+
|
|
6
|
+
version: 2
|
|
7
|
+
updates:
|
|
8
|
+
# Maintain dependencies for GitHub Actions
|
|
9
|
+
- package-ecosystem: "github-actions"
|
|
10
|
+
directory: "/"
|
|
11
|
+
schedule:
|
|
12
|
+
interval: "daily"
|
|
13
|
+
|
|
14
|
+
- package-ecosystem: "pip"
|
|
15
|
+
directory: "/"
|
|
16
|
+
schedule:
|
|
17
|
+
interval: "daily"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
name: publish
|
|
2
|
+
|
|
3
|
+
# Pushing a version tag (e.g. 0.5.2) runs the test suite, then builds the
|
|
4
|
+
# package and publishes it to PyPI. The upload uses PyPI trusted publishing
|
|
5
|
+
# (OIDC), so no API tokens are stored in the repository.
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
tags:
|
|
10
|
+
- '[0-9]+.[0-9]+.[0-9]+*'
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
uses: ./.github/workflows/test.yml
|
|
15
|
+
|
|
16
|
+
build:
|
|
17
|
+
needs: test
|
|
18
|
+
runs-on: ubuntu-24.04
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@v7
|
|
22
|
+
with:
|
|
23
|
+
# hatch-vcs derives the version from the git tags
|
|
24
|
+
fetch-depth: 0
|
|
25
|
+
|
|
26
|
+
- name: Set up Python 3.12
|
|
27
|
+
uses: actions/setup-python@v7
|
|
28
|
+
with:
|
|
29
|
+
python-version: 3.12
|
|
30
|
+
|
|
31
|
+
- name: Package distribution
|
|
32
|
+
run: |
|
|
33
|
+
pip install --upgrade build
|
|
34
|
+
python -m build
|
|
35
|
+
|
|
36
|
+
- name: Check version matches tag
|
|
37
|
+
run: |
|
|
38
|
+
ls "dist/dtool_http-${GITHUB_REF_NAME}.tar.gz" \
|
|
39
|
+
"dist/dtool_http-${GITHUB_REF_NAME}-py3-none-any.whl"
|
|
40
|
+
|
|
41
|
+
- uses: actions/upload-artifact@v7
|
|
42
|
+
with:
|
|
43
|
+
name: dist
|
|
44
|
+
path: dist/
|
|
45
|
+
|
|
46
|
+
publish-pypi:
|
|
47
|
+
needs: build
|
|
48
|
+
runs-on: ubuntu-24.04
|
|
49
|
+
environment:
|
|
50
|
+
name: pypi
|
|
51
|
+
url: https://pypi.org/p/dtool-http
|
|
52
|
+
permissions:
|
|
53
|
+
id-token: write
|
|
54
|
+
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/download-artifact@v8
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
- name: Publish distribution to PyPI
|
|
62
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: test
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- main
|
|
7
|
+
tags:
|
|
8
|
+
- '*'
|
|
9
|
+
pull_request:
|
|
10
|
+
workflow_call:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
runs-on: ubuntu-latest
|
|
15
|
+
|
|
16
|
+
strategy:
|
|
17
|
+
matrix:
|
|
18
|
+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
|
|
19
|
+
|
|
20
|
+
steps:
|
|
21
|
+
- name: Git checkout
|
|
22
|
+
uses: actions/checkout@v7
|
|
23
|
+
|
|
24
|
+
- name: Set up python3 ${{ matrix.python-version }}
|
|
25
|
+
uses: actions/setup-python@v7
|
|
26
|
+
with:
|
|
27
|
+
python-version: ${{ matrix.python-version }}
|
|
28
|
+
|
|
29
|
+
- name: Install requirements
|
|
30
|
+
run: |
|
|
31
|
+
python -m pip install --upgrade pip
|
|
32
|
+
pip install flake8 pytest pytest-cov pytz
|
|
33
|
+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
34
|
+
pip install .
|
|
35
|
+
pip list
|
|
36
|
+
|
|
37
|
+
- name: Test with pytest
|
|
38
|
+
run: |
|
|
39
|
+
pytest -sv
|
|
40
|
+
|
|
41
|
+
- name: Lint with flake8
|
|
42
|
+
run: |
|
|
43
|
+
# Configuration (including excludes) lives in setup.cfg
|
|
44
|
+
flake8 --count --show-source --statistics
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
CHANGELOG
|
|
2
|
+
=========
|
|
3
|
+
|
|
4
|
+
This project uses `semantic versioning <http://semver.org/>`_.
|
|
5
|
+
This change log uses principles from `keep a changelog <http://keepachangelog.com/>`_.
|
|
6
|
+
|
|
7
|
+
[Unreleased]
|
|
8
|
+
------------
|
|
9
|
+
|
|
10
|
+
Added
|
|
11
|
+
^^^^^
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
Changed
|
|
15
|
+
^^^^^^^
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
Deprecated
|
|
19
|
+
^^^^^^^^^^
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Removed
|
|
23
|
+
^^^^^^^
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
Fixed
|
|
27
|
+
^^^^^
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
Security
|
|
31
|
+
^^^^^^^^
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
[0.5.3] - 2026-11-24
|
|
35
|
+
--------------------
|
|
36
|
+
|
|
37
|
+
Changed
|
|
38
|
+
^^^^^^^
|
|
39
|
+
|
|
40
|
+
- Build system switched to hatchling with hatch-vcs; the version is now
|
|
41
|
+
derived from git tags
|
|
42
|
+
- The publish workflow now runs only for version tags: it runs the test
|
|
43
|
+
suite, checks that the built version matches the tag and publishes to
|
|
44
|
+
PyPI. Development builds are no longer uploaded to TestPyPI
|
|
45
|
+
|
|
46
|
+
Removed
|
|
47
|
+
^^^^^^^
|
|
48
|
+
|
|
49
|
+
- Support for Python < 3.10
|
|
50
|
+
|
|
51
|
+
Fixed
|
|
52
|
+
^^^^^
|
|
53
|
+
|
|
54
|
+
- ``dtool_serve_directory`` and ``dtool_publish_dataset`` are installed as
|
|
55
|
+
console scripts again; 0.5.2 wrongly registered these argparse functions as
|
|
56
|
+
``dtool.cli`` plugins, which broke ``dtool --help`` listings and removed the
|
|
57
|
+
standalone commands
|
|
58
|
+
- License metadata now points to ``LICENSE.rst`` (SPDX ``MIT``)
|
|
59
|
+
- ``dtool_http.__version__`` is always defined, even when not installed
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
[0.5.2] - 2025-03-31
|
|
63
|
+
--------------------
|
|
64
|
+
|
|
65
|
+
Added
|
|
66
|
+
^^^^^
|
|
67
|
+
|
|
68
|
+
- GitHub CI test and publication workflows
|
|
69
|
+
- Dynamic versioning
|
|
70
|
+
|
|
71
|
+
Changed
|
|
72
|
+
^^^^^^^
|
|
73
|
+
|
|
74
|
+
- Transitioned from ``setup.py`` to ``pyproject.toml``
|
|
75
|
+
|
|
76
|
+
Fixed
|
|
77
|
+
^^^^^
|
|
78
|
+
|
|
79
|
+
- Generation of HTTP manifest URLs for base uris with signatures
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
[0.5.1] - 2021-06-23
|
|
83
|
+
--------------------
|
|
84
|
+
|
|
85
|
+
Fixed
|
|
86
|
+
^^^^^
|
|
87
|
+
|
|
88
|
+
- Licence file now included in release thanks to Jan Janssen (https://github.com/jan-janssen)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
[0.5.0] - 2020-03-19
|
|
92
|
+
--------------------
|
|
93
|
+
|
|
94
|
+
This code was lost in a local branch, but was reimplemented and added to GitHub on 2021-06-21.
|
|
95
|
+
|
|
96
|
+
Added
|
|
97
|
+
^^^^^
|
|
98
|
+
|
|
99
|
+
- Added support for dataset tags
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
[0.4.0] - 2019-10-31
|
|
103
|
+
--------------------
|
|
104
|
+
|
|
105
|
+
Added
|
|
106
|
+
^^^^^
|
|
107
|
+
|
|
108
|
+
- Added support for dataset annotations
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
[0.3.0] - 2019-04-25
|
|
112
|
+
--------------------
|
|
113
|
+
|
|
114
|
+
Changed
|
|
115
|
+
^^^^^^^
|
|
116
|
+
|
|
117
|
+
- Cache environment variable changed from DTOOL_HTTP_CACHE_DIRECTORY to
|
|
118
|
+
DTOOL_CACHE_DIRECTORY
|
|
119
|
+
- Default cache directory changed from ``~/.cache/dtool/http`` to
|
|
120
|
+
``~/.cache/dtool``
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
[0.2.1] - 2019-03-29
|
|
124
|
+
--------------------
|
|
125
|
+
|
|
126
|
+
Added
|
|
127
|
+
^^^^^
|
|
128
|
+
|
|
129
|
+
- Added MIT licence file
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
[0.2.0] - 2018-07-09
|
|
133
|
+
--------------------
|
|
134
|
+
|
|
135
|
+
Added
|
|
136
|
+
^^^^^
|
|
137
|
+
|
|
138
|
+
- Added ability to deal with redirects to enable working with shortened URLs
|
|
139
|
+
|
|
140
|
+
Fixed
|
|
141
|
+
^^^^^
|
|
142
|
+
|
|
143
|
+
- Made download to DTOOL_HTTP_CACHE_DIRECTORY more robust
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
[0.1.0] - 2018-07-05
|
|
147
|
+
--------------------
|
|
148
|
+
|
|
149
|
+
Initial release:
|
|
150
|
+
|
|
151
|
+
- HTTPStorageBackend
|
|
152
|
+
- HTTPSStorageBackend
|
|
153
|
+
- dtool_publish_dataset command line utility
|
|
154
|
+
- dtool_serve_dataset command line utility
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: dtool-http
|
|
3
|
+
Version: 0.5.3
|
|
4
|
+
Summary: Add HTTP read only dataset support to dtool
|
|
5
|
+
Project-URL: Documentation, https://github.com/jic-dtool/dtool-http/blob/main/README.rst
|
|
6
|
+
Project-URL: Repository, https://github.com/jic-dtool/dtool-http
|
|
7
|
+
Project-URL: Changelog, https://github.com/jic-dtool/dtool-http/blob/main/CHANGELOG.rst
|
|
8
|
+
Author-email: Tjelvar Olsson <tjelvar.olsson@gmail.com>
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE.rst
|
|
11
|
+
Requires-Python: >=3.10
|
|
12
|
+
Requires-Dist: dtoolcore>=3.13
|
|
13
|
+
Requires-Dist: requests
|
|
14
|
+
Provides-Extra: test
|
|
15
|
+
Requires-Dist: pytest; extra == 'test'
|
|
16
|
+
Requires-Dist: pytest-cov; extra == 'test'
|
|
17
|
+
Requires-Dist: pytz; extra == 'test'
|
|
18
|
+
Description-Content-Type: text/x-rst
|
|
19
|
+
|
|
20
|
+
Add HTTP support to dtool for read only access to datasets
|
|
21
|
+
==========================================================
|
|
22
|
+
|
|
23
|
+
.. |dtool| image:: https://github.com/jic-dtool/dtool-http/blob/main/icons/22x22/dtool_logo.png?raw=True
|
|
24
|
+
:height: 20px
|
|
25
|
+
:target: https://github.com/jic-dtool/dtool-http
|
|
26
|
+
.. |pypi| image:: https://img.shields.io/pypi/v/dtool-http
|
|
27
|
+
:target: https://pypi.org/project/dtool-http/
|
|
28
|
+
.. |tag| image:: https://img.shields.io/github/v/tag/jic-dtool/dtool-http
|
|
29
|
+
:target: https://github.com/jic-dtool/dtool-http/tags
|
|
30
|
+
.. |test| image:: https://img.shields.io/github/actions/workflow/status/jic-dtool/dtool-http/test.yml?branch=main&label=tests
|
|
31
|
+
:target: https://github.com/jic-dtool/dtool-http/actions/workflows/test.yml
|
|
32
|
+
.. |coverage| image:: https://codecov.io/github/jic-dtool/dtool-http/coverage.svg?branch=main
|
|
33
|
+
:target: https://codecov.io/github/jic-dtool/dtool-http?branch=main
|
|
34
|
+
|
|
35
|
+
|dtool| |pypi| |tag| |test| |coverage|
|
|
36
|
+
|
|
37
|
+
- GitHub: https://github.com/jic-dtool/dtool-http
|
|
38
|
+
- Free software: MIT License
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
Features
|
|
42
|
+
--------
|
|
43
|
+
|
|
44
|
+
- Publish dtool datasets by making them accessible via HTTP(S)
|
|
45
|
+
- Interact with dtool datasets over HTTP(S)
|
|
46
|
+
- Copy a dataset over HTTP(S)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Installation
|
|
50
|
+
------------
|
|
51
|
+
|
|
52
|
+
To install the dtool-http package.
|
|
53
|
+
|
|
54
|
+
.. code-block:: bash
|
|
55
|
+
|
|
56
|
+
cd dtool-http
|
|
57
|
+
pip install .
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
Usage
|
|
61
|
+
-----
|
|
62
|
+
|
|
63
|
+
To publish a dataset hosted in Amazon S3 or Microsoft Azure Storage use the
|
|
64
|
+
``dtool_publish_dataset`` command line utility::
|
|
65
|
+
|
|
66
|
+
$ dtool_publish_dataset azure://jicinformatics/c58038a4-3a54-425e-9087-144d0733387f
|
|
67
|
+
Dataset accessible at: https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
To show the descriptive metadata of the published dataset::
|
|
71
|
+
|
|
72
|
+
$ dtool readme show https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f
|
|
73
|
+
---
|
|
74
|
+
description: Enterobacteria phage lambda, complete genome
|
|
75
|
+
creation_date: 2018-02-06
|
|
76
|
+
accession: NC_001416.1
|
|
77
|
+
link: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
78
|
+
reference: |
|
|
79
|
+
Nucleotide [Internet]. Bethesda (MD):
|
|
80
|
+
National Library of Medicine (US),
|
|
81
|
+
National Center for Biotechnology Information; [1988] - .
|
|
82
|
+
Accession No. NC_001416.1, Enterobacteria phage lambda, complete genome
|
|
83
|
+
[cited 2018 Feb 06]
|
|
84
|
+
Available from: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
To copy the dataset to local disk::
|
|
88
|
+
|
|
89
|
+
$ dtool copy https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f ~/my_datasets
|
|
90
|
+
Dataset copied to:
|
|
91
|
+
file:///Users/olssont/my_datasets/lamda-phage-genome
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
Serving a directory of datasets over HTTP
|
|
95
|
+
-----------------------------------------
|
|
96
|
+
|
|
97
|
+
There is a simple utility for serving datasets in a directory over HTTP called
|
|
98
|
+
``dtool_serve_directory``. This is mainly useful for testing purposes.
|
|
99
|
+
|
|
100
|
+
Usage::
|
|
101
|
+
|
|
102
|
+
$ dtool_serve_directory ~/my_datasets
|
|
103
|
+
|
|
104
|
+
The default port used is 8081. To show the descriptive metadata in the README
|
|
105
|
+
one can use dtool::
|
|
106
|
+
|
|
107
|
+
$ dtool readme show http://localhost:8081/lamda-phage-genome
|
|
108
|
+
---
|
|
109
|
+
description: Enterobacteria phage lambda, complete genome
|
|
110
|
+
creation_date: 2018-02-06
|
|
111
|
+
accession: NC_001416.1
|
|
112
|
+
link: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
113
|
+
reference: |
|
|
114
|
+
Nucleotide [Internet]. Bethesda (MD):
|
|
115
|
+
National Library of Medicine (US),
|
|
116
|
+
National Center for Biotechnology Information; [1988] - .
|
|
117
|
+
Accession No. NC_001416.1, Enterobacteria phage lambda, complete genome
|
|
118
|
+
[cited 2018 Feb 06]
|
|
119
|
+
Available from: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Related packages
|
|
123
|
+
----------------
|
|
124
|
+
|
|
125
|
+
- `dtoolcore <https://github.com/jic-dtool/dtoolcore>`_
|
|
126
|
+
- `dtool-cli <https://github.com/jic-dtool/dtool-cli>`_
|
|
127
|
+
- `dtool-info <https://github.com/jic-dtool/dtool-info>`_
|
|
128
|
+
- `dtool-s3 <https://github.com/jic-dtool/dtool-s3>`_
|
|
129
|
+
- `dtool-azure <https://github.com/jic-dtool/dtool-azure>`_
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
Add HTTP support to dtool for read only access to datasets
|
|
2
2
|
==========================================================
|
|
3
3
|
|
|
4
|
-
.. image:: https://
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
.. |dtool| image:: https://github.com/jic-dtool/dtool-http/blob/main/icons/22x22/dtool_logo.png?raw=True
|
|
5
|
+
:height: 20px
|
|
6
|
+
:target: https://github.com/jic-dtool/dtool-http
|
|
7
|
+
.. |pypi| image:: https://img.shields.io/pypi/v/dtool-http
|
|
8
|
+
:target: https://pypi.org/project/dtool-http/
|
|
9
|
+
.. |tag| image:: https://img.shields.io/github/v/tag/jic-dtool/dtool-http
|
|
10
|
+
:target: https://github.com/jic-dtool/dtool-http/tags
|
|
11
|
+
.. |test| image:: https://img.shields.io/github/actions/workflow/status/jic-dtool/dtool-http/test.yml?branch=main&label=tests
|
|
12
|
+
:target: https://github.com/jic-dtool/dtool-http/actions/workflows/test.yml
|
|
13
|
+
.. |coverage| image:: https://codecov.io/github/jic-dtool/dtool-http/coverage.svg?branch=main
|
|
14
|
+
:target: https://codecov.io/github/jic-dtool/dtool-http?branch=main
|
|
15
|
+
|
|
16
|
+
|dtool| |pypi| |tag| |test| |coverage|
|
|
15
17
|
|
|
16
18
|
- GitHub: https://github.com/jic-dtool/dtool-http
|
|
17
19
|
- Free software: MIT License
|
|
@@ -33,7 +35,7 @@ To install the dtool-http package.
|
|
|
33
35
|
.. code-block:: bash
|
|
34
36
|
|
|
35
37
|
cd dtool-http
|
|
36
|
-
|
|
38
|
+
pip install .
|
|
37
39
|
|
|
38
40
|
|
|
39
41
|
Usage
|
|
@@ -74,7 +76,7 @@ Serving a directory of datasets over HTTP
|
|
|
74
76
|
-----------------------------------------
|
|
75
77
|
|
|
76
78
|
There is a simple utility for serving datasets in a directory over HTTP called
|
|
77
|
-
``
|
|
79
|
+
``dtool_serve_directory``. This is mainly useful for testing purposes.
|
|
78
80
|
|
|
79
81
|
Usage::
|
|
80
82
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""dtool_http package."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
__version__ = version(__name__)
|
|
9
|
+
except PackageNotFoundError:
|
|
10
|
+
# Package is not installed; dtool-cli's ``dtool --version`` still
|
|
11
|
+
# expects the attribute to exist.
|
|
12
|
+
__version__ = "unknown"
|
|
13
|
+
|
|
14
|
+
logger = logging.getLogger(__name__)
|
|
@@ -22,7 +22,7 @@ class HTTPError(RuntimeError):
|
|
|
22
22
|
pass
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
class HTTPStorageBroker
|
|
25
|
+
class HTTPStorageBroker:
|
|
26
26
|
"""
|
|
27
27
|
Storage broker to interact with datasets over HTTP in a read only fashion.
|
|
28
28
|
"""
|
|
@@ -31,15 +31,22 @@ class HTTPStorageBroker(object):
|
|
|
31
31
|
|
|
32
32
|
def __init__(self, uri, admin_metadata, config_path=None):
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
parse_result = generous_parse_uri(uri)
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
# Get potential query signature for Azure/S3
|
|
37
|
+
self._signature = parse_result.query
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
self.
|
|
40
|
-
|
|
39
|
+
# Base URI may be redirected to a different location
|
|
40
|
+
self._uri = self._get_base_uri(parse_result)
|
|
41
|
+
parse_result = generous_parse_uri(self._uri)
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
self.scheme = parse_result.scheme
|
|
44
|
+
self.netloc = parse_result.netloc
|
|
45
|
+
self.uuid = parse_result.path[1:]
|
|
46
|
+
|
|
47
|
+
http_manifest_url = parse_result._replace(
|
|
48
|
+
path=parse_result.path + '/' + HTTP_MANIFEST_KEY,
|
|
49
|
+
query=self._signature).geturl()
|
|
43
50
|
|
|
44
51
|
self.http_manifest = self._get_json_from_url(
|
|
45
52
|
http_manifest_url
|
|
@@ -53,11 +60,10 @@ class HTTPStorageBroker(object):
|
|
|
53
60
|
|
|
54
61
|
# Helper functions
|
|
55
62
|
|
|
56
|
-
def _get_base_uri(self,
|
|
57
|
-
r = requests.get(
|
|
63
|
+
def _get_base_uri(self, parse_result):
|
|
64
|
+
r = requests.get(parse_result._replace(query="").geturl())
|
|
58
65
|
if r.status_code != 301:
|
|
59
|
-
logger.info("Dataset moved, redirecting to: {}".format(
|
|
60
|
-
r.url))
|
|
66
|
+
logger.info("Dataset moved, redirecting to: {}".format(r.url))
|
|
61
67
|
return r.url
|
|
62
68
|
|
|
63
69
|
def _get_request(self, url, stream=False):
|
|
@@ -65,7 +71,7 @@ class HTTPStorageBroker(object):
|
|
|
65
71
|
logger.info("Response status code: {}".format(r.status_code))
|
|
66
72
|
|
|
67
73
|
if r.status_code != 200:
|
|
68
|
-
raise
|
|
74
|
+
raise HTTPError(r.status_code)
|
|
69
75
|
|
|
70
76
|
return r
|
|
71
77
|
|
|
Binary file
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27", "hatch-vcs"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "dtool-http"
|
|
7
|
+
description = "Add HTTP read only dataset support to dtool"
|
|
8
|
+
readme = "README.rst"
|
|
9
|
+
license = "MIT"
|
|
10
|
+
license-files = ["LICENSE.rst"]
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "Tjelvar Olsson", email = "tjelvar.olsson@gmail.com"}
|
|
14
|
+
]
|
|
15
|
+
dynamic = ["version"]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"dtoolcore>=3.13",
|
|
18
|
+
"requests",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.optional-dependencies]
|
|
22
|
+
test = [
|
|
23
|
+
"pytest",
|
|
24
|
+
"pytest-cov",
|
|
25
|
+
"pytz"
|
|
26
|
+
]
|
|
27
|
+
|
|
28
|
+
[project.urls]
|
|
29
|
+
Documentation = "https://github.com/jic-dtool/dtool-http/blob/main/README.rst"
|
|
30
|
+
Repository = "https://github.com/jic-dtool/dtool-http"
|
|
31
|
+
Changelog = "https://github.com/jic-dtool/dtool-http/blob/main/CHANGELOG.rst"
|
|
32
|
+
|
|
33
|
+
[project.entry-points."dtool.storage_brokers"]
|
|
34
|
+
"HTTPStorageBroker" = "dtool_http.storagebroker:HTTPStorageBroker"
|
|
35
|
+
"HTTPSStorageBroker" = "dtool_http.storagebroker:HTTPSStorageBroker"
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
"dtool_serve_directory" = "dtool_http.server:cli"
|
|
39
|
+
"dtool_publish_dataset" = "dtool_http.publish:cli"
|
|
40
|
+
|
|
41
|
+
[tool.hatch.version]
|
|
42
|
+
source = "vcs"
|
|
43
|
+
|
|
44
|
+
[tool.hatch.version.raw-options]
|
|
45
|
+
local_scheme = "no-local-version"
|
|
46
|
+
|
|
47
|
+
[tool.hatch.build.targets.wheel]
|
|
48
|
+
packages = ["dtool_http"]
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
-e .
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import getpass
|
|
3
|
+
import datetime
|
|
4
|
+
|
|
5
|
+
import pkg_resources
|
|
6
|
+
|
|
7
|
+
import click
|
|
8
|
+
|
|
9
|
+
from io import StringIO
|
|
10
|
+
|
|
11
|
+
from ruamel.yaml import YAML
|
|
12
|
+
from ruamel.yaml.comments import CommentedMap
|
|
13
|
+
|
|
14
|
+
import dtoolcore
|
|
15
|
+
|
|
16
|
+
from dtool_cli.cli import (
|
|
17
|
+
CONFIG_PATH,
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
README_TEMPLATE_FPATH = pkg_resources.resource_filename(
|
|
22
|
+
"dtool_create",
|
|
23
|
+
os.path.join("templates", "README.yml")
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _get_readme_template(fpath=None):
|
|
28
|
+
|
|
29
|
+
if fpath is None:
|
|
30
|
+
fpath = dtoolcore.utils.get_config_value(
|
|
31
|
+
"DTOOL_README_TEMPLATE_FPATH",
|
|
32
|
+
CONFIG_PATH
|
|
33
|
+
)
|
|
34
|
+
if fpath is None:
|
|
35
|
+
fpath = README_TEMPLATE_FPATH
|
|
36
|
+
|
|
37
|
+
with open(fpath) as fh:
|
|
38
|
+
readme_template = fh.read()
|
|
39
|
+
|
|
40
|
+
user_email = dtoolcore.utils.get_config_value(
|
|
41
|
+
"DTOOL_USER_EMAIL",
|
|
42
|
+
CONFIG_PATH,
|
|
43
|
+
"you@example.com"
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
user_full_name = dtoolcore.utils.get_config_value(
|
|
47
|
+
"DTOOL_USER_FULL_NAME",
|
|
48
|
+
CONFIG_PATH,
|
|
49
|
+
"Your Name"
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
readme_template = readme_template.format(
|
|
53
|
+
username=getpass.getuser(),
|
|
54
|
+
DTOOL_USER_FULL_NAME=user_full_name,
|
|
55
|
+
DTOOL_USER_EMAIL=user_email,
|
|
56
|
+
date=datetime.date.today(),
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
return readme_template
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@click.command()
|
|
63
|
+
@click.argument('uri')
|
|
64
|
+
def share_dataset(uri):
|
|
65
|
+
azure_base_uri = "azure://jicinformatics"
|
|
66
|
+
azure_uri = dtoolcore.copy(uri, azure_base_uri)
|
|
67
|
+
dataset = dtoolcore.DataSet.from_uri(azure_uri)
|
|
68
|
+
http_access_uri = dataset._storage_broker.http_enable()
|
|
69
|
+
|
|
70
|
+
print("Dataset now accessible at: {}".format(http_access_uri))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@click.command()
|
|
74
|
+
@click.argument('path')
|
|
75
|
+
def create_and_share(path):
|
|
76
|
+
|
|
77
|
+
name = path
|
|
78
|
+
|
|
79
|
+
base_uri = "azure://jicinformatics"
|
|
80
|
+
|
|
81
|
+
admin_metadata = dtoolcore.generate_admin_metadata(name)
|
|
82
|
+
|
|
83
|
+
# Create the dataset.
|
|
84
|
+
proto_dataset = dtoolcore.generate_proto_dataset(
|
|
85
|
+
admin_metadata=admin_metadata,
|
|
86
|
+
base_uri=base_uri,
|
|
87
|
+
config_path=CONFIG_PATH)
|
|
88
|
+
try:
|
|
89
|
+
proto_dataset.create()
|
|
90
|
+
except dtoolcore.storagebroker.StorageBrokerOSError as err:
|
|
91
|
+
raise click.UsageError(str(err))
|
|
92
|
+
|
|
93
|
+
readme_template = _get_readme_template()
|
|
94
|
+
|
|
95
|
+
# Create an CommentedMap representation of the yaml readme template.
|
|
96
|
+
yaml = YAML()
|
|
97
|
+
yaml.explicit_start = True
|
|
98
|
+
yaml.indent(mapping=2, sequence=4, offset=2)
|
|
99
|
+
descriptive_metadata = yaml.load(readme_template)
|
|
100
|
+
|
|
101
|
+
def prompt_for_values(d):
|
|
102
|
+
"""Update the descriptive metadata interactively.
|
|
103
|
+
|
|
104
|
+
Uses values entered by the user. Note that the function keeps recursing
|
|
105
|
+
whenever a value is another ``CommentedMap`` or a ``list``. The
|
|
106
|
+
function works as passing dictionaries and lists into a function edits
|
|
107
|
+
the values in place.
|
|
108
|
+
"""
|
|
109
|
+
for key, value in d.items():
|
|
110
|
+
if isinstance(value, CommentedMap):
|
|
111
|
+
prompt_for_values(value)
|
|
112
|
+
elif isinstance(value, list):
|
|
113
|
+
for item in value:
|
|
114
|
+
prompt_for_values(item)
|
|
115
|
+
else:
|
|
116
|
+
new_value = click.prompt(key, type=type(value), default=value)
|
|
117
|
+
d[key] = new_value
|
|
118
|
+
|
|
119
|
+
prompt_for_values(descriptive_metadata)
|
|
120
|
+
|
|
121
|
+
stream = StringIO()
|
|
122
|
+
yaml.dump(descriptive_metadata, stream)
|
|
123
|
+
proto_dataset.put_readme(stream.getvalue())
|
|
124
|
+
|
|
125
|
+
for filename in os.listdir(path):
|
|
126
|
+
src_fpath = os.path.join(path, filename)
|
|
127
|
+
relpath = filename
|
|
128
|
+
proto_dataset.put_item(src_fpath, relpath)
|
|
129
|
+
|
|
130
|
+
proto_dataset.freeze()
|
|
131
|
+
|
|
132
|
+
http_access_uri = proto_dataset._storage_broker.http_enable()
|
|
133
|
+
|
|
134
|
+
click.secho("\nDataset now accessible at: ", nl=False)
|
|
135
|
+
click.secho("{}".format(http_access_uri), fg="green")
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
if __name__ == '__main__':
|
|
139
|
+
create_and_share()
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
[flake8]
|
|
2
|
-
exclude
|
|
3
|
-
|
|
4
|
-
[tool:pytest]
|
|
5
|
-
testpaths = tests
|
|
6
|
-
addopts = --cov=dtool_http
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
[egg_info]
|
|
12
|
-
tag_build =
|
|
13
|
-
tag_date = 0
|
|
14
|
-
|
|
1
|
+
[flake8]
|
|
2
|
+
exclude=env*,.tox,.git,*.egg,build,docs
|
|
3
|
+
|
|
4
|
+
[tool:pytest]
|
|
5
|
+
testpaths = tests
|
|
6
|
+
addopts = --cov=dtool_http
|
|
7
|
+
#addopts = -x --pdb
|
|
8
|
+
|
|
9
|
+
[cov:run]
|
|
10
|
+
source = dtool_http
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"""Test fixtures."""
|
|
2
|
+
|
|
3
|
+
import os
|
|
4
|
+
import random
|
|
5
|
+
import shutil
|
|
6
|
+
import tempfile
|
|
7
|
+
import threading
|
|
8
|
+
from contextlib import contextmanager
|
|
9
|
+
|
|
10
|
+
import dtoolcore
|
|
11
|
+
from dtoolcore.utils import urlunparse
|
|
12
|
+
|
|
13
|
+
import pytest
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
_HERE = os.path.dirname(__file__)
|
|
17
|
+
_DATA = os.path.join(_HERE, "data")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@contextmanager
|
|
21
|
+
def tmp_env_var(key, value):
|
|
22
|
+
os.environ[key] = value
|
|
23
|
+
yield
|
|
24
|
+
del os.environ[key]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@contextmanager
|
|
28
|
+
def tmp_directory():
|
|
29
|
+
d = tempfile.mkdtemp()
|
|
30
|
+
yield d
|
|
31
|
+
shutil.rmtree(d)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def create_tmp_dataset(directory):
|
|
35
|
+
admin_metadata = dtoolcore.generate_admin_metadata("tmp_dataset")
|
|
36
|
+
|
|
37
|
+
proto_dataset = dtoolcore.generate_proto_dataset(
|
|
38
|
+
admin_metadata=admin_metadata,
|
|
39
|
+
base_uri=directory,
|
|
40
|
+
config_path=None)
|
|
41
|
+
|
|
42
|
+
proto_dataset.create()
|
|
43
|
+
|
|
44
|
+
proto_dataset.put_readme("---\nproject: testing dtool\n")
|
|
45
|
+
|
|
46
|
+
for fn in os.listdir(_DATA):
|
|
47
|
+
fpath = os.path.join(_DATA, fn)
|
|
48
|
+
proto_dataset.put_item(fpath, fn)
|
|
49
|
+
|
|
50
|
+
_, ext = os.path.splitext(fn)
|
|
51
|
+
proto_dataset.add_item_metadata(fn, "mimetype", ext)
|
|
52
|
+
|
|
53
|
+
proto_dataset.put_annotation("project", "dtool-testing")
|
|
54
|
+
proto_dataset.put_tag("amazing")
|
|
55
|
+
proto_dataset.freeze()
|
|
56
|
+
|
|
57
|
+
return proto_dataset.uri
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@pytest.fixture
|
|
61
|
+
def tmp_disk_dataset_uri(request):
|
|
62
|
+
d = tempfile.mkdtemp()
|
|
63
|
+
|
|
64
|
+
@request.addfinalizer
|
|
65
|
+
def teardown():
|
|
66
|
+
shutil.rmtree(d)
|
|
67
|
+
|
|
68
|
+
return create_tmp_dataset(d)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@pytest.fixture(scope="session")
|
|
72
|
+
def tmp_dtool_server(request):
|
|
73
|
+
|
|
74
|
+
d = tempfile.mkdtemp()
|
|
75
|
+
curdir = os.getcwd()
|
|
76
|
+
os.chdir(d)
|
|
77
|
+
|
|
78
|
+
uri = create_tmp_dataset(d)
|
|
79
|
+
dataset = dtoolcore.DataSet.from_uri(uri)
|
|
80
|
+
|
|
81
|
+
port = random.randint(6000, 9000)
|
|
82
|
+
server_address = ("localhost", port)
|
|
83
|
+
|
|
84
|
+
from dtool_http.server import DtoolHTTPServer, DtoolHTTPRequestHandler
|
|
85
|
+
httpd = DtoolHTTPServer(server_address, DtoolHTTPRequestHandler)
|
|
86
|
+
|
|
87
|
+
def start_server():
|
|
88
|
+
print("start dtool http server")
|
|
89
|
+
httpd.serve_forever()
|
|
90
|
+
|
|
91
|
+
t = threading.Thread(target=start_server)
|
|
92
|
+
t.start()
|
|
93
|
+
|
|
94
|
+
@request.addfinalizer
|
|
95
|
+
def teardown():
|
|
96
|
+
httpd.shutdown()
|
|
97
|
+
print("stopping dtool http server")
|
|
98
|
+
os.chdir(curdir)
|
|
99
|
+
shutil.rmtree(d)
|
|
100
|
+
|
|
101
|
+
netloc = "{}:{}".format(*server_address)
|
|
102
|
+
path = dataset.name
|
|
103
|
+
return urlunparse((
|
|
104
|
+
"http",
|
|
105
|
+
netloc,
|
|
106
|
+
path,
|
|
107
|
+
"", "", ""))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import os
|
|
2
|
+
|
|
3
|
+
import pytest
|
|
4
|
+
|
|
5
|
+
from dtoolcore import DataSet
|
|
6
|
+
|
|
7
|
+
from . import tmp_dtool_server # NOQA
|
|
8
|
+
from . import (
|
|
9
|
+
tmp_env_var,
|
|
10
|
+
tmp_directory,
|
|
11
|
+
)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_http_manifest_access(tmp_dtool_server): # NOQA
|
|
15
|
+
DataSet.from_uri(tmp_dtool_server)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_http_non_dataset_uri(tmp_dtool_server): # NOQA
|
|
19
|
+
import dtool_http
|
|
20
|
+
with pytest.raises(dtool_http.storagebroker.HTTPError):
|
|
21
|
+
DataSet.from_uri(tmp_dtool_server + "not-here")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_workflow(tmp_dtool_server): # NOQA
|
|
25
|
+
example_identifier = "1c10766c4a29536bc648260f456202091e2f57b4"
|
|
26
|
+
|
|
27
|
+
with tmp_directory() as cache_dir:
|
|
28
|
+
with tmp_env_var("DTOOL_CACHE_DIRECTORY", cache_dir):
|
|
29
|
+
dataset = DataSet.from_uri(tmp_dtool_server)
|
|
30
|
+
|
|
31
|
+
assert len(dataset.identifiers) != 0
|
|
32
|
+
assert dataset.get_readme_content().startswith('---')
|
|
33
|
+
|
|
34
|
+
expected_overlay_names = set(["mimetype"])
|
|
35
|
+
assert set(dataset.list_overlay_names()) == expected_overlay_names
|
|
36
|
+
assert example_identifier in dataset.get_overlay("mimetype")
|
|
37
|
+
|
|
38
|
+
assert dataset.list_annotation_names() == ["project"]
|
|
39
|
+
assert dataset.get_annotation("project") == "dtool-testing"
|
|
40
|
+
assert dataset.list_tags() == ["amazing"]
|
|
41
|
+
|
|
42
|
+
fpath = dataset.item_content_abspath(example_identifier)
|
|
43
|
+
assert os.path.isfile(fpath)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Test that the package registers the expected entry points."""
|
|
2
|
+
|
|
3
|
+
from importlib.metadata import distribution
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
def _entry_points(group):
|
|
7
|
+
eps = distribution("dtool-http").entry_points
|
|
8
|
+
return {ep.name: ep.value for ep in eps if ep.group == group}
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def test_console_scripts_registered():
|
|
12
|
+
assert _entry_points("console_scripts") == {
|
|
13
|
+
"dtool_serve_directory": "dtool_http.server:cli",
|
|
14
|
+
"dtool_publish_dataset": "dtool_http.publish:cli",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def test_no_dtool_cli_plugins_registered():
|
|
19
|
+
# The utilities are argparse based, not click commands, so they must not
|
|
20
|
+
# be registered as dtool-cli plugins.
|
|
21
|
+
assert _entry_points("dtool.cli") == {}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def test_storage_brokers_registered():
|
|
25
|
+
assert _entry_points("dtool.storage_brokers") == {
|
|
26
|
+
"HTTPStorageBroker": "dtool_http.storagebroker:HTTPStorageBroker",
|
|
27
|
+
"HTTPSStorageBroker": "dtool_http.storagebroker:HTTPSStorageBroker",
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"""Test publish function."""
|
|
2
|
+
|
|
3
|
+
import dtoolcore
|
|
4
|
+
|
|
5
|
+
from . import tmp_disk_dataset_uri # NOQA
|
|
6
|
+
from . import tmp_dtool_server # NOQA
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def test_disk_dataset_uri_fixture(tmp_disk_dataset_uri): # NOQA
|
|
10
|
+
|
|
11
|
+
dtoolcore.DataSet.from_uri(tmp_disk_dataset_uri)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def test_publish_command_functional(tmp_dtool_server): # NOQA
|
|
15
|
+
|
|
16
|
+
from dtool_http.publish import publish
|
|
17
|
+
|
|
18
|
+
assert tmp_dtool_server + "/" == publish(tmp_dtool_server)
|
dtool_http-0.5.3/tox.ini
ADDED
dtool-http-0.5.1/MANIFEST.in
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
include LICENSE.rst
|
dtool-http-0.5.1/PKG-INFO
DELETED
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: dtool-http
|
|
3
|
-
Version: 0.5.1
|
|
4
|
-
Summary: Add HTTP read only dataset support to dtool
|
|
5
|
-
Home-page: https://github.com/jic-dtool/dtool-http
|
|
6
|
-
Author: Tjelvar Olsson
|
|
7
|
-
Author-email: tjelvar.olsson@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Download-URL: https://github.com/jic-dtool/dtool-http/tarball/0.5.1
|
|
10
|
-
Description: Add HTTP support to dtool for read only access to datasets
|
|
11
|
-
==========================================================
|
|
12
|
-
|
|
13
|
-
.. image:: https://badge.fury.io/py/dtool-http.svg
|
|
14
|
-
:target: http://badge.fury.io/py/dtool-http
|
|
15
|
-
:alt: PyPi package
|
|
16
|
-
|
|
17
|
-
.. image:: https://travis-ci.org/jic-dtool/dtool-http.svg?branch=master
|
|
18
|
-
:target: https://travis-ci.org/jic-dtool/dtool-http
|
|
19
|
-
:alt: Travis CI build status (Linux)
|
|
20
|
-
|
|
21
|
-
.. image:: https://codecov.io/github/jic-dtool/dtool-http/coverage.svg?branch=master
|
|
22
|
-
:target: https://codecov.io/github/jic-dtool/dtool-http?branch=master
|
|
23
|
-
:alt: Code Coverage
|
|
24
|
-
|
|
25
|
-
- GitHub: https://github.com/jic-dtool/dtool-http
|
|
26
|
-
- Free software: MIT License
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Features
|
|
30
|
-
--------
|
|
31
|
-
|
|
32
|
-
- Publish dtool datasets by making them accessible via HTTP(S)
|
|
33
|
-
- Interact with dtool datasets over HTTP(S)
|
|
34
|
-
- Copy a dataset over HTTP(S)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Installation
|
|
38
|
-
------------
|
|
39
|
-
|
|
40
|
-
To install the dtool-http package.
|
|
41
|
-
|
|
42
|
-
.. code-block:: bash
|
|
43
|
-
|
|
44
|
-
cd dtool-http
|
|
45
|
-
python setup.py install
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Usage
|
|
49
|
-
-----
|
|
50
|
-
|
|
51
|
-
To publish a dataset hosted in Amazon S3 or Microsoft Azure Storage use the
|
|
52
|
-
``dtool_publish_dataset`` command line utility::
|
|
53
|
-
|
|
54
|
-
$ dtool_publish_dataset azure://jicinformatics/c58038a4-3a54-425e-9087-144d0733387f
|
|
55
|
-
Dataset accessible at: https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
To show the descriptive metadata of the published dataset::
|
|
59
|
-
|
|
60
|
-
$ dtool readme show https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f
|
|
61
|
-
---
|
|
62
|
-
description: Enterobacteria phage lambda, complete genome
|
|
63
|
-
creation_date: 2018-02-06
|
|
64
|
-
accession: NC_001416.1
|
|
65
|
-
link: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
66
|
-
reference: |
|
|
67
|
-
Nucleotide [Internet]. Bethesda (MD):
|
|
68
|
-
National Library of Medicine (US),
|
|
69
|
-
National Center for Biotechnology Information; [1988] - .
|
|
70
|
-
Accession No. NC_001416.1, Enterobacteria phage lambda, complete genome
|
|
71
|
-
[cited 2018 Feb 06]
|
|
72
|
-
Available from: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
To copy the dataset to local disk::
|
|
76
|
-
|
|
77
|
-
$ dtool copy https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f ~/my_datasets
|
|
78
|
-
Dataset copied to:
|
|
79
|
-
file:///Users/olssont/my_datasets/lamda-phage-genome
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Serving a directory of datasets over HTTP
|
|
83
|
-
-----------------------------------------
|
|
84
|
-
|
|
85
|
-
There is a simple utility for serving datasets in a directory over HTTP called
|
|
86
|
-
``dtool_serve_direcotry``. This is mainly useful for testing purposes.
|
|
87
|
-
|
|
88
|
-
Usage::
|
|
89
|
-
|
|
90
|
-
$ dtool_serve_directory ~/my_datasets
|
|
91
|
-
|
|
92
|
-
The default port used is 8081. To show the descriptive metadata in the README
|
|
93
|
-
one can use dtool::
|
|
94
|
-
|
|
95
|
-
$ dtool readme show http://localhost:8081/lamda-phage-genome
|
|
96
|
-
---
|
|
97
|
-
description: Enterobacteria phage lambda, complete genome
|
|
98
|
-
creation_date: 2018-02-06
|
|
99
|
-
accession: NC_001416.1
|
|
100
|
-
link: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
101
|
-
reference: |
|
|
102
|
-
Nucleotide [Internet]. Bethesda (MD):
|
|
103
|
-
National Library of Medicine (US),
|
|
104
|
-
National Center for Biotechnology Information; [1988] - .
|
|
105
|
-
Accession No. NC_001416.1, Enterobacteria phage lambda, complete genome
|
|
106
|
-
[cited 2018 Feb 06]
|
|
107
|
-
Available from: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Related packages
|
|
111
|
-
----------------
|
|
112
|
-
|
|
113
|
-
- `dtoolcore <https://github.com/jic-dtool/dtoolcore>`_
|
|
114
|
-
- `dtool-cli <https://github.com/jic-dtool/dtool-cli>`_
|
|
115
|
-
- `dtool-info <https://github.com/jic-dtool/dtool-info>`_
|
|
116
|
-
- `dtool-s3 <https://github.com/jic-dtool/dtool-s3>`_
|
|
117
|
-
- `dtool-azure <https://github.com/jic-dtool/dtool-azure>`_
|
|
118
|
-
|
|
119
|
-
Platform: UNKNOWN
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 1.1
|
|
2
|
-
Name: dtool-http
|
|
3
|
-
Version: 0.5.1
|
|
4
|
-
Summary: Add HTTP read only dataset support to dtool
|
|
5
|
-
Home-page: https://github.com/jic-dtool/dtool-http
|
|
6
|
-
Author: Tjelvar Olsson
|
|
7
|
-
Author-email: tjelvar.olsson@gmail.com
|
|
8
|
-
License: MIT
|
|
9
|
-
Download-URL: https://github.com/jic-dtool/dtool-http/tarball/0.5.1
|
|
10
|
-
Description: Add HTTP support to dtool for read only access to datasets
|
|
11
|
-
==========================================================
|
|
12
|
-
|
|
13
|
-
.. image:: https://badge.fury.io/py/dtool-http.svg
|
|
14
|
-
:target: http://badge.fury.io/py/dtool-http
|
|
15
|
-
:alt: PyPi package
|
|
16
|
-
|
|
17
|
-
.. image:: https://travis-ci.org/jic-dtool/dtool-http.svg?branch=master
|
|
18
|
-
:target: https://travis-ci.org/jic-dtool/dtool-http
|
|
19
|
-
:alt: Travis CI build status (Linux)
|
|
20
|
-
|
|
21
|
-
.. image:: https://codecov.io/github/jic-dtool/dtool-http/coverage.svg?branch=master
|
|
22
|
-
:target: https://codecov.io/github/jic-dtool/dtool-http?branch=master
|
|
23
|
-
:alt: Code Coverage
|
|
24
|
-
|
|
25
|
-
- GitHub: https://github.com/jic-dtool/dtool-http
|
|
26
|
-
- Free software: MIT License
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
Features
|
|
30
|
-
--------
|
|
31
|
-
|
|
32
|
-
- Publish dtool datasets by making them accessible via HTTP(S)
|
|
33
|
-
- Interact with dtool datasets over HTTP(S)
|
|
34
|
-
- Copy a dataset over HTTP(S)
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
Installation
|
|
38
|
-
------------
|
|
39
|
-
|
|
40
|
-
To install the dtool-http package.
|
|
41
|
-
|
|
42
|
-
.. code-block:: bash
|
|
43
|
-
|
|
44
|
-
cd dtool-http
|
|
45
|
-
python setup.py install
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
Usage
|
|
49
|
-
-----
|
|
50
|
-
|
|
51
|
-
To publish a dataset hosted in Amazon S3 or Microsoft Azure Storage use the
|
|
52
|
-
``dtool_publish_dataset`` command line utility::
|
|
53
|
-
|
|
54
|
-
$ dtool_publish_dataset azure://jicinformatics/c58038a4-3a54-425e-9087-144d0733387f
|
|
55
|
-
Dataset accessible at: https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
To show the descriptive metadata of the published dataset::
|
|
59
|
-
|
|
60
|
-
$ dtool readme show https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f
|
|
61
|
-
---
|
|
62
|
-
description: Enterobacteria phage lambda, complete genome
|
|
63
|
-
creation_date: 2018-02-06
|
|
64
|
-
accession: NC_001416.1
|
|
65
|
-
link: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
66
|
-
reference: |
|
|
67
|
-
Nucleotide [Internet]. Bethesda (MD):
|
|
68
|
-
National Library of Medicine (US),
|
|
69
|
-
National Center for Biotechnology Information; [1988] - .
|
|
70
|
-
Accession No. NC_001416.1, Enterobacteria phage lambda, complete genome
|
|
71
|
-
[cited 2018 Feb 06]
|
|
72
|
-
Available from: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
To copy the dataset to local disk::
|
|
76
|
-
|
|
77
|
-
$ dtool copy https://jicinformatics.blob.core.windows.net/c58038a4-3a54-425e-9087-144d0733387f ~/my_datasets
|
|
78
|
-
Dataset copied to:
|
|
79
|
-
file:///Users/olssont/my_datasets/lamda-phage-genome
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
Serving a directory of datasets over HTTP
|
|
83
|
-
-----------------------------------------
|
|
84
|
-
|
|
85
|
-
There is a simple utility for serving datasets in a directory over HTTP called
|
|
86
|
-
``dtool_serve_direcotry``. This is mainly useful for testing purposes.
|
|
87
|
-
|
|
88
|
-
Usage::
|
|
89
|
-
|
|
90
|
-
$ dtool_serve_directory ~/my_datasets
|
|
91
|
-
|
|
92
|
-
The default port used is 8081. To show the descriptive metadata in the README
|
|
93
|
-
one can use dtool::
|
|
94
|
-
|
|
95
|
-
$ dtool readme show http://localhost:8081/lamda-phage-genome
|
|
96
|
-
---
|
|
97
|
-
description: Enterobacteria phage lambda, complete genome
|
|
98
|
-
creation_date: 2018-02-06
|
|
99
|
-
accession: NC_001416.1
|
|
100
|
-
link: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
101
|
-
reference: |
|
|
102
|
-
Nucleotide [Internet]. Bethesda (MD):
|
|
103
|
-
National Library of Medicine (US),
|
|
104
|
-
National Center for Biotechnology Information; [1988] - .
|
|
105
|
-
Accession No. NC_001416.1, Enterobacteria phage lambda, complete genome
|
|
106
|
-
[cited 2018 Feb 06]
|
|
107
|
-
Available from: https://www.ncbi.nlm.nih.gov/nuccore/NC_001416.1
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
Related packages
|
|
111
|
-
----------------
|
|
112
|
-
|
|
113
|
-
- `dtoolcore <https://github.com/jic-dtool/dtoolcore>`_
|
|
114
|
-
- `dtool-cli <https://github.com/jic-dtool/dtool-cli>`_
|
|
115
|
-
- `dtool-info <https://github.com/jic-dtool/dtool-info>`_
|
|
116
|
-
- `dtool-s3 <https://github.com/jic-dtool/dtool-s3>`_
|
|
117
|
-
- `dtool-azure <https://github.com/jic-dtool/dtool-azure>`_
|
|
118
|
-
|
|
119
|
-
Platform: UNKNOWN
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
LICENSE.rst
|
|
2
|
-
MANIFEST.in
|
|
3
|
-
README.rst
|
|
4
|
-
setup.cfg
|
|
5
|
-
setup.py
|
|
6
|
-
dtool_http/__init__.py
|
|
7
|
-
dtool_http/publish.py
|
|
8
|
-
dtool_http/server.py
|
|
9
|
-
dtool_http/storagebroker.py
|
|
10
|
-
dtool_http.egg-info/PKG-INFO
|
|
11
|
-
dtool_http.egg-info/SOURCES.txt
|
|
12
|
-
dtool_http.egg-info/dependency_links.txt
|
|
13
|
-
dtool_http.egg-info/entry_points.txt
|
|
14
|
-
dtool_http.egg-info/requires.txt
|
|
15
|
-
dtool_http.egg-info/top_level.txt
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
[console_scripts]
|
|
2
|
-
dtool_publish_dataset = dtool_http.publish:cli
|
|
3
|
-
dtool_serve_directory = dtool_http.server:cli
|
|
4
|
-
|
|
5
|
-
[dtool.storage_brokers]
|
|
6
|
-
HTTPSStorageBroker = dtool_http.storagebroker:HTTPSStorageBroker
|
|
7
|
-
HTTPStorageBroker = dtool_http.storagebroker:HTTPStorageBroker
|
|
8
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
dtool_http
|
dtool-http-0.5.1/setup.py
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
from setuptools import setup
|
|
2
|
-
|
|
3
|
-
url = "https://github.com/jic-dtool/dtool-http"
|
|
4
|
-
version = "0.5.1"
|
|
5
|
-
readme = open('README.rst').read()
|
|
6
|
-
|
|
7
|
-
setup(
|
|
8
|
-
name="dtool-http",
|
|
9
|
-
packages=["dtool_http"],
|
|
10
|
-
version=version,
|
|
11
|
-
description="Add HTTP read only dataset support to dtool",
|
|
12
|
-
long_description=readme,
|
|
13
|
-
include_package_data=True,
|
|
14
|
-
# Package will be released using Tjelvar's PyPi credentials.
|
|
15
|
-
author="Tjelvar Olsson",
|
|
16
|
-
author_email="tjelvar.olsson@gmail.com",
|
|
17
|
-
# author="Matthew Hartley", # NOQA
|
|
18
|
-
# author_email="Matthew.Hartley@jic.ac.uk", # NOQA
|
|
19
|
-
url=url,
|
|
20
|
-
install_requires=[
|
|
21
|
-
"dtoolcore>=3.13",
|
|
22
|
-
"requests",
|
|
23
|
-
],
|
|
24
|
-
entry_points={
|
|
25
|
-
"dtool.storage_brokers": [
|
|
26
|
-
"HTTPStorageBroker=dtool_http.storagebroker:HTTPStorageBroker",
|
|
27
|
-
"HTTPSStorageBroker=dtool_http.storagebroker:HTTPSStorageBroker",
|
|
28
|
-
],
|
|
29
|
-
"console_scripts": [
|
|
30
|
-
"dtool_serve_directory=dtool_http.server:cli",
|
|
31
|
-
"dtool_publish_dataset=dtool_http.publish:cli"
|
|
32
|
-
]
|
|
33
|
-
},
|
|
34
|
-
download_url="{}/tarball/{}".format(url, version),
|
|
35
|
-
license="MIT"
|
|
36
|
-
)
|
|
File without changes
|
|
File without changes
|