dcor-shared 1.0.4__tar.gz → 1.1.0__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.
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/.github/workflows/check.yml +1 -1
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/CHANGELOG +9 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/PKG-INFO +1 -1
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/__init__.py +3 -3
- dcor_shared-1.1.0/dcor_shared/_version.py +24 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/ckan.py +13 -2
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/data.py +2 -2
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/mime.py +0 -3
- dcor_shared-1.1.0/dcor_shared/paths.py +2 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/testing.py +0 -30
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared.egg-info/PKG-INFO +1 -1
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared.egg-info/SOURCES.txt +2 -0
- dcor_shared-1.1.0/dcor_shared.egg-info/scm_file_list.json +31 -0
- dcor_shared-1.1.0/dcor_shared.egg-info/scm_version.json +8 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/tests/test_data.py +6 -0
- dcor_shared-1.0.4/dcor_shared/_version.py +0 -21
- dcor_shared-1.0.4/dcor_shared/paths.py +0 -16
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/.github/workflows/deploy_pypi.yml +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/.gitignore +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/LICENSE +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/MANIFEST.in +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/README.rst +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/dcinst.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/parse.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/rqjob.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/s3.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/s3cc.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared/util.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared.egg-info/dependency_links.txt +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared.egg-info/requires.txt +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/dcor_shared.egg-info/top_level.txt +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/pyproject.toml +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/setup.cfg +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/tests/data/calibration_beads_47.rtdc +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/tests/requirements.txt +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/tests/test_ckan.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/tests/test_s3.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/tests/test_s3cc.py +0 -0
- {dcor_shared-1.0.4 → dcor_shared-1.1.0}/tests/test_testing.py +0 -0
|
@@ -46,7 +46,7 @@ jobs:
|
|
|
46
46
|
redis:
|
|
47
47
|
image: redis:3
|
|
48
48
|
minio:
|
|
49
|
-
image:
|
|
49
|
+
image: mpzpm/dcor-dev:minio-latest
|
|
50
50
|
# Note:
|
|
51
51
|
# The official MinIO setup uses standalone mode, which has limitations:
|
|
52
52
|
# - Certain 'mc admin' commands, such as user and policy management, are not supported.
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
1.1.0
|
|
2
|
+
- BREAKING: remove unused `paths.get_nginx_config_path`,
|
|
3
|
+
`paths.get_supervisord_worker_config_path`, `paths.get_uwsgi_config_path`,
|
|
4
|
+
and `VALID_FORMATS`
|
|
5
|
+
- BREAKING: remove the `testing.create_with_upload_no_temp` fixture
|
|
6
|
+
(resources cannot be uploaded via CKAN anymore)
|
|
7
|
+
- fix: use the actual site user instead of the user "default" in
|
|
8
|
+
`get_resource_info` and `wait_for_resource`
|
|
9
|
+
- enh: new `admin_context` returning the context of the site user
|
|
1
10
|
1.0.4
|
|
2
11
|
- enh: implement "artifact" kwarg for `s3cc.compute_checksum`
|
|
3
12
|
- enh: introduce `enable_basins` in `s3cc.get_s3_dc_handle`
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# flake8: noqa: F401
|
|
2
2
|
from .ckan import (
|
|
3
|
-
get_ckan_config_option, get_ckan_storage_path,
|
|
4
|
-
get_resource_info, is_resource_private
|
|
3
|
+
admin_context, get_ckan_config_option, get_ckan_storage_path,
|
|
4
|
+
get_resource_dc_config, get_resource_info, is_resource_private
|
|
5
5
|
)
|
|
6
6
|
from .data import wait_for_resource
|
|
7
7
|
from .dcinst import get_dc_instance
|
|
8
|
-
from .mime import DC_MIME_TYPES
|
|
8
|
+
from .mime import DC_MIME_TYPES
|
|
9
9
|
from . import paths
|
|
10
10
|
from .rqjob import RQJob, rqjob_register
|
|
11
11
|
from .util import sha256sum
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# file generated by vcs-versioning
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
__all__ = [
|
|
6
|
+
"__version__",
|
|
7
|
+
"__version_tuple__",
|
|
8
|
+
"version",
|
|
9
|
+
"version_tuple",
|
|
10
|
+
"__commit_id__",
|
|
11
|
+
"commit_id",
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
version: str
|
|
15
|
+
__version__: str
|
|
16
|
+
__version_tuple__: tuple[int | str, ...]
|
|
17
|
+
version_tuple: tuple[int | str, ...]
|
|
18
|
+
commit_id: str | None
|
|
19
|
+
__commit_id__: str | None
|
|
20
|
+
|
|
21
|
+
__version__ = version = '1.1.0'
|
|
22
|
+
__version_tuple__ = version_tuple = (1, 1, 0)
|
|
23
|
+
|
|
24
|
+
__commit_id__ = commit_id = 'gf8fde438a'
|
|
@@ -4,6 +4,17 @@ import pathlib
|
|
|
4
4
|
from .parse import get_ini_config_option
|
|
5
5
|
|
|
6
6
|
|
|
7
|
+
def admin_context():
|
|
8
|
+
"""Context of the CKAN site user (sysadmin)
|
|
9
|
+
|
|
10
|
+
The site user is named after `ckan.site_id`, which is "default"
|
|
11
|
+
unless specified otherwise.
|
|
12
|
+
"""
|
|
13
|
+
from ckan import logic
|
|
14
|
+
site_user = logic.get_action("get_site_user")({"ignore_auth": True}, {})
|
|
15
|
+
return {'ignore_auth': True, 'user': site_user["name"]}
|
|
16
|
+
|
|
17
|
+
|
|
7
18
|
def get_ckan_config_option(option):
|
|
8
19
|
"""Return the CKAN configuration option
|
|
9
20
|
|
|
@@ -64,10 +75,10 @@ def get_resource_info(resource_id):
|
|
|
64
75
|
"""
|
|
65
76
|
from ckan import logic
|
|
66
77
|
res_dict = logic.get_action("resource_show")(
|
|
67
|
-
context=
|
|
78
|
+
context=admin_context(),
|
|
68
79
|
data_dict={"id": resource_id})
|
|
69
80
|
ds_dict = logic.get_action("package_show")(
|
|
70
|
-
context=
|
|
81
|
+
context=admin_context(),
|
|
71
82
|
data_dict={"id": res_dict["package_id"]})
|
|
72
83
|
return ds_dict, res_dict
|
|
73
84
|
|
|
@@ -2,6 +2,7 @@ import functools
|
|
|
2
2
|
import time
|
|
3
3
|
|
|
4
4
|
from . import s3cc
|
|
5
|
+
from .ckan import admin_context
|
|
5
6
|
from .util import sha256sum # noqa: F401
|
|
6
7
|
|
|
7
8
|
|
|
@@ -30,8 +31,7 @@ def wait_for_resource(resource_id: str,
|
|
|
30
31
|
t0 = time.time()
|
|
31
32
|
while True:
|
|
32
33
|
try:
|
|
33
|
-
res_dict = resource_show(context=
|
|
34
|
-
'user': 'default'},
|
|
34
|
+
res_dict = resource_show(context=admin_context(),
|
|
35
35
|
data_dict={"id": resource_id})
|
|
36
36
|
except logic.NotFound:
|
|
37
37
|
# Other processes are still working on getting the resource
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
from __future__ import annotations
|
|
2
2
|
|
|
3
|
-
from io import BytesIO
|
|
4
3
|
import numbers
|
|
5
4
|
import pathlib
|
|
6
5
|
from typing import Dict, List
|
|
@@ -10,41 +9,12 @@ import ckan.authz
|
|
|
10
9
|
import ckan.model
|
|
11
10
|
import ckan.tests.factories as factories
|
|
12
11
|
import ckan.tests.helpers as helpers
|
|
13
|
-
from ckan.tests.pytest_ckan.fixtures import FakeFileStorage
|
|
14
12
|
import requests
|
|
15
13
|
|
|
16
|
-
import pytest
|
|
17
|
-
|
|
18
14
|
from .ckan import get_ckan_config_option
|
|
19
15
|
from . import s3
|
|
20
16
|
|
|
21
17
|
|
|
22
|
-
@pytest.fixture
|
|
23
|
-
def create_with_upload_no_temp(clean_db, ckan_config, monkeypatch):
|
|
24
|
-
"""
|
|
25
|
-
Create upload without tempdir
|
|
26
|
-
"""
|
|
27
|
-
|
|
28
|
-
def factory(data, filename, context=None, **kwargs):
|
|
29
|
-
if context is None:
|
|
30
|
-
context = {}
|
|
31
|
-
action = kwargs.pop("action", "resource_create")
|
|
32
|
-
field = kwargs.pop("upload_field_name", "upload")
|
|
33
|
-
test_file = BytesIO()
|
|
34
|
-
if type(data) is not bytes:
|
|
35
|
-
data = bytes(data, encoding="utf-8")
|
|
36
|
-
test_file.write(data)
|
|
37
|
-
test_file.seek(0)
|
|
38
|
-
test_resource = FakeFileStorage(test_file, filename)
|
|
39
|
-
|
|
40
|
-
params = {
|
|
41
|
-
field: test_resource,
|
|
42
|
-
}
|
|
43
|
-
params.update(kwargs)
|
|
44
|
-
return helpers.call_action(action, context, **params)
|
|
45
|
-
return factory
|
|
46
|
-
|
|
47
|
-
|
|
48
18
|
def activate_dataset(ds_id, create_context=None):
|
|
49
19
|
"""Activate a dataset by setting its "state" to "active"."""
|
|
50
20
|
|
|
@@ -23,6 +23,8 @@ dcor_shared.egg-info/PKG-INFO
|
|
|
23
23
|
dcor_shared.egg-info/SOURCES.txt
|
|
24
24
|
dcor_shared.egg-info/dependency_links.txt
|
|
25
25
|
dcor_shared.egg-info/requires.txt
|
|
26
|
+
dcor_shared.egg-info/scm_file_list.json
|
|
27
|
+
dcor_shared.egg-info/scm_version.json
|
|
26
28
|
dcor_shared.egg-info/top_level.txt
|
|
27
29
|
tests/requirements.txt
|
|
28
30
|
tests/test_ckan.py
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".github/workflows/check.yml",
|
|
4
|
+
".github/workflows/deploy_pypi.yml",
|
|
5
|
+
".gitignore",
|
|
6
|
+
"CHANGELOG",
|
|
7
|
+
"LICENSE",
|
|
8
|
+
"MANIFEST.in",
|
|
9
|
+
"README.rst",
|
|
10
|
+
"dcor_shared/__init__.py",
|
|
11
|
+
"dcor_shared/ckan.py",
|
|
12
|
+
"dcor_shared/data.py",
|
|
13
|
+
"dcor_shared/dcinst.py",
|
|
14
|
+
"dcor_shared/mime.py",
|
|
15
|
+
"dcor_shared/parse.py",
|
|
16
|
+
"dcor_shared/paths.py",
|
|
17
|
+
"dcor_shared/rqjob.py",
|
|
18
|
+
"dcor_shared/s3.py",
|
|
19
|
+
"dcor_shared/s3cc.py",
|
|
20
|
+
"dcor_shared/testing.py",
|
|
21
|
+
"dcor_shared/util.py",
|
|
22
|
+
"pyproject.toml",
|
|
23
|
+
"tests/data/calibration_beads_47.rtdc",
|
|
24
|
+
"tests/requirements.txt",
|
|
25
|
+
"tests/test_ckan.py",
|
|
26
|
+
"tests/test_data.py",
|
|
27
|
+
"tests/test_s3.py",
|
|
28
|
+
"tests/test_s3cc.py",
|
|
29
|
+
"tests/test_testing.py"
|
|
30
|
+
]
|
|
31
|
+
}
|
|
@@ -6,6 +6,8 @@ import uuid
|
|
|
6
6
|
|
|
7
7
|
from ckan import logic
|
|
8
8
|
|
|
9
|
+
import dcor_shared.data
|
|
10
|
+
|
|
9
11
|
from dcor_shared import (
|
|
10
12
|
get_dc_instance, s3, sha256sum, wait_for_resource
|
|
11
13
|
)
|
|
@@ -98,6 +100,8 @@ def test_sha256sum(tmp_path):
|
|
|
98
100
|
|
|
99
101
|
def test_wait_for_resource_s3(monkeypatch):
|
|
100
102
|
res_id = str(uuid.uuid4())
|
|
103
|
+
monkeypatch.setattr(dcor_shared.data, "admin_context",
|
|
104
|
+
lambda: {"ignore_auth": True})
|
|
101
105
|
monkeypatch.setattr(logic, "get_action",
|
|
102
106
|
lambda x: lambda context, data_dict: {
|
|
103
107
|
"id": res_id,
|
|
@@ -108,6 +112,8 @@ def test_wait_for_resource_s3(monkeypatch):
|
|
|
108
112
|
|
|
109
113
|
def test_wait_resource_not_available(monkeypatch):
|
|
110
114
|
res_id = str(uuid.uuid4())
|
|
115
|
+
monkeypatch.setattr(dcor_shared.data, "admin_context",
|
|
116
|
+
lambda: {"ignore_auth": True})
|
|
111
117
|
monkeypatch.setattr(logic, "get_action",
|
|
112
118
|
lambda x: lambda context, data_dict: {
|
|
113
119
|
"id": res_id})
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# file generated by setuptools-scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
|
|
4
|
-
__all__ = ["__version__", "__version_tuple__", "version", "version_tuple"]
|
|
5
|
-
|
|
6
|
-
TYPE_CHECKING = False
|
|
7
|
-
if TYPE_CHECKING:
|
|
8
|
-
from typing import Tuple
|
|
9
|
-
from typing import Union
|
|
10
|
-
|
|
11
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
12
|
-
else:
|
|
13
|
-
VERSION_TUPLE = object
|
|
14
|
-
|
|
15
|
-
version: str
|
|
16
|
-
__version__: str
|
|
17
|
-
__version_tuple__: VERSION_TUPLE
|
|
18
|
-
version_tuple: VERSION_TUPLE
|
|
19
|
-
|
|
20
|
-
__version__ = version = '1.0.4'
|
|
21
|
-
__version_tuple__ = version_tuple = (1, 0, 4)
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import pathlib
|
|
2
|
-
|
|
3
|
-
from .ckan import get_ckan_storage_path, get_ckan_webassets_path # noqa: F401
|
|
4
|
-
from .ckan import get_ckan_config_path # noqa: F401
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def get_nginx_config_path():
|
|
8
|
-
return pathlib.Path("/etc/nginx/sites-enabled/ckan")
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
def get_supervisord_worker_config_path():
|
|
12
|
-
return pathlib.Path("/etc/supervisor/conf.d/ckan-worker.conf")
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def get_uwsgi_config_path():
|
|
16
|
-
return pathlib.Path("/etc/ckan/default/ckan-uwsgi.ini")
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|