jupyter-analysis-tools 1.7.1__tar.gz → 1.7.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.
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/.copier-answers.yml +1 -1
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/CHANGELOG.md +16 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/PKG-INFO +19 -3
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/README.md +2 -2
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/conf.py +1 -1
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/__init__.py +1 -1
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/datastore.py +201 -174
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools.egg-info/PKG-INFO +19 -3
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/.editorconfig +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/.pre-commit-config.yaml +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/AUTHORS.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/CONTRIBUTING.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/LICENSE +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/MANIFEST.in +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/ci/requirements.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/_templates/class.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/_templates/module.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/authors.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/changelog.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/contributing.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/index.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/installation.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/readme.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/reference/index.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/requirements.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/spelling_wordlist.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/docs/usage.rst +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/pyproject.toml +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/setup.cfg +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/analysis.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/binning.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/datalocations.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/distrib.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/git.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/plotting.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/readdata.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/ssfz2json.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/ssfz_compare.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/utils.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/widgets.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools.egg-info/SOURCES.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools.egg-info/dependency_links.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools.egg-info/entry_points.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools.egg-info/requires.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools.egg-info/top_level.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/templates/CHANGELOG.md.j2 +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/testdata/2015-03-20-Silica.ssf.json +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/testdata/2015-03-20-Silica.ssfz +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/testdata/S2842 water.json +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/testdata/S2842 water.pdh +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/testdata/S2843[9].pdh +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/tests/readdata.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/tests/requirements.txt +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/tests/utils.py +0 -0
- {jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/tox.ini +0 -0
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## v1.7.3 (2026-02-04)
|
|
4
|
+
|
|
5
|
+
### Bug fixes
|
|
6
|
+
|
|
7
|
+
* **DataStore**: do not attempt to create a token when logged in via token, not allowed ([`6beeddd`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/6beeddd2d778ed44080401700b223d3dc3eeebfc))
|
|
8
|
+
|
|
9
|
+
## v1.7.2 (2026-01-30)
|
|
10
|
+
|
|
11
|
+
### Bug fixes
|
|
12
|
+
|
|
13
|
+
* **DataStore.__init__**: allow token-based auth, docs added ([`d64f92f`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/d64f92fdcba4851497ff6782e4beee1109eb86bd))
|
|
14
|
+
|
|
15
|
+
### Code style
|
|
16
|
+
|
|
17
|
+
* **DataStore**: whitespace errors ([`f599040`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/f5990401c80ec30a2748a5e2952ab806def207ac))
|
|
18
|
+
|
|
3
19
|
## v1.7.1 (2025-12-11)
|
|
4
20
|
|
|
5
21
|
### Bug fixes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jupyter-analysis-tools
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.3
|
|
4
4
|
Summary: Yet another Python library with helpers and utilities for data analysis and processing.
|
|
5
5
|
Author-email: Ingo Breßler <ingo.bressler@bam.de>, "Brian R. Pauw" <brian.pauw@bam.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -36,10 +36,10 @@ Requires-Dist: ipywidgets
|
|
|
36
36
|
Requires-Dist: pybis
|
|
37
37
|
Dynamic: license-file
|
|
38
38
|
|
|
39
|
-
# Jupyter Analysis Tools (v1.7.
|
|
39
|
+
# Jupyter Analysis Tools (v1.7.3)
|
|
40
40
|
|
|
41
41
|
[](https://pypi.org/project/jupyter-analysis-tools)
|
|
42
|
-
[](https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.7.3...main)
|
|
43
43
|
[](https://en.wikipedia.org/wiki/MIT_license)
|
|
44
44
|
[](https://pypi.org/project/jupyter-analysis-tools)
|
|
45
45
|
[](https://pypi.org/project/jupyter-analysis-tools#files)
|
|
@@ -98,6 +98,22 @@ are installed:
|
|
|
98
98
|
|
|
99
99
|
# CHANGELOG
|
|
100
100
|
|
|
101
|
+
## v1.7.3 (2026-02-04)
|
|
102
|
+
|
|
103
|
+
### Bug fixes
|
|
104
|
+
|
|
105
|
+
* **DataStore**: do not attempt to create a token when logged in via token, not allowed ([`6beeddd`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/6beeddd2d778ed44080401700b223d3dc3eeebfc))
|
|
106
|
+
|
|
107
|
+
## v1.7.2 (2026-01-30)
|
|
108
|
+
|
|
109
|
+
### Bug fixes
|
|
110
|
+
|
|
111
|
+
* **DataStore.__init__**: allow token-based auth, docs added ([`d64f92f`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/d64f92fdcba4851497ff6782e4beee1109eb86bd))
|
|
112
|
+
|
|
113
|
+
### Code style
|
|
114
|
+
|
|
115
|
+
* **DataStore**: whitespace errors ([`f599040`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/f5990401c80ec30a2748a5e2952ab806def207ac))
|
|
116
|
+
|
|
101
117
|
## v1.7.1 (2025-12-11)
|
|
102
118
|
|
|
103
119
|
### Bug fixes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# Jupyter Analysis Tools (v1.7.
|
|
1
|
+
# Jupyter Analysis Tools (v1.7.3)
|
|
2
2
|
|
|
3
3
|
[](https://pypi.org/project/jupyter-analysis-tools)
|
|
4
|
-
[](https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.7.3...main)
|
|
5
5
|
[](https://en.wikipedia.org/wiki/MIT_license)
|
|
6
6
|
[](https://pypi.org/project/jupyter-analysis-tools)
|
|
7
7
|
[](https://pypi.org/project/jupyter-analysis-tools#files)
|
|
@@ -1,174 +1,201 @@
|
|
|
1
|
-
# -*- coding: utf-8 -*-
|
|
2
|
-
# datastore.py
|
|
3
|
-
|
|
4
|
-
import filecmp
|
|
5
|
-
import getpass
|
|
6
|
-
import tempfile
|
|
7
|
-
import warnings
|
|
8
|
-
from pathlib import Path
|
|
9
|
-
|
|
10
|
-
from pybis import Openbis
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class DataStore:
|
|
14
|
-
url = None
|
|
15
|
-
token = None
|
|
16
|
-
_availObj = None
|
|
17
|
-
_userspace = None
|
|
18
|
-
|
|
19
|
-
def __init__(self, url, username=None, tokenValidTo=None):
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
self.
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
if
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
props
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
if
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# datastore.py
|
|
3
|
+
|
|
4
|
+
import filecmp
|
|
5
|
+
import getpass
|
|
6
|
+
import tempfile
|
|
7
|
+
import warnings
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from pybis import Openbis
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class DataStore:
|
|
14
|
+
url = None
|
|
15
|
+
token = None
|
|
16
|
+
_availObj = None
|
|
17
|
+
_userspace = None
|
|
18
|
+
|
|
19
|
+
def __init__(self, url, username=None, token=None, tokenValidTo=None):
|
|
20
|
+
"""
|
|
21
|
+
Initialize the datastore connection and authenticate with openBIS.
|
|
22
|
+
|
|
23
|
+
Args:
|
|
24
|
+
url (str): The URL of the openBIS server.
|
|
25
|
+
username (str, optional): The username for authentication.
|
|
26
|
+
Defaults to the current system user if not provided.
|
|
27
|
+
It will as for the password interactively.
|
|
28
|
+
token (str, optional): A personal access token as retrieved by DataStore.token earlier
|
|
29
|
+
as alternative to username/password authentication.
|
|
30
|
+
tokenValidTo (str, optional): The expiration datetime for the new personal access token
|
|
31
|
+
when it is created using username/password authentication.
|
|
32
|
+
|
|
33
|
+
Raises:
|
|
34
|
+
Exception: If authentication fails or connection to the server cannot be established.
|
|
35
|
+
|
|
36
|
+
Note:
|
|
37
|
+
- If username is not provided, it defaults to the current system user.
|
|
38
|
+
- Password is prompted interactively via getpass.
|
|
39
|
+
- A personal access token named "test-session" is automatically created/retrieved.
|
|
40
|
+
- Token is not persisted to disk.
|
|
41
|
+
"""
|
|
42
|
+
self.url = url
|
|
43
|
+
self.username = username
|
|
44
|
+
if self.username is None:
|
|
45
|
+
self.username = getpass.getuser()
|
|
46
|
+
print(f"Working as user '{self.username}'.")
|
|
47
|
+
# to generate PAT you need to login normally
|
|
48
|
+
self.ds = Openbis(url=self.url, verify_certificates=True)
|
|
49
|
+
# arg. *save_token* saves the openBIS token to ~/.pybis permanently
|
|
50
|
+
if token is not None:
|
|
51
|
+
if hasattr(token, "permId"):
|
|
52
|
+
token = token.permId
|
|
53
|
+
self.ds.set_token(token)
|
|
54
|
+
else: # username/password login
|
|
55
|
+
self.ds.login(
|
|
56
|
+
self.username,
|
|
57
|
+
getpass.getpass(prompt=f"Password for {self.username}: "),
|
|
58
|
+
save_token=False,
|
|
59
|
+
)
|
|
60
|
+
# create the PAT with the given name, don't store it
|
|
61
|
+
self.token = self.ds.get_or_create_personal_access_token(
|
|
62
|
+
"test-session", validTo=tokenValidTo
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
@property
|
|
66
|
+
def userspace(self):
|
|
67
|
+
uspace = self._userspace
|
|
68
|
+
if uspace is None:
|
|
69
|
+
allspaces = self.ds.get_spaces()
|
|
70
|
+
uspace = allspaces.df[
|
|
71
|
+
allspaces.df.code.str.endswith(self.username.upper())
|
|
72
|
+
].code.values[0]
|
|
73
|
+
self._userspace = uspace
|
|
74
|
+
return uspace
|
|
75
|
+
|
|
76
|
+
@userspace.setter
|
|
77
|
+
def userspace(self, name):
|
|
78
|
+
name = name.upper()
|
|
79
|
+
if name in self.ds.get_spaces().df.code.values:
|
|
80
|
+
self._userspace = name
|
|
81
|
+
|
|
82
|
+
@staticmethod
|
|
83
|
+
def identifier(objects, code):
|
|
84
|
+
return objects[objects.code == code].identifier.tolist()[0]
|
|
85
|
+
|
|
86
|
+
def createProject(self, projectName, space, spacePrefix=None):
|
|
87
|
+
"""Finds the requested project in the DataStore.
|
|
88
|
+
Matching project names can be limited to a given *spacePrefix*.
|
|
89
|
+
If the project is not found, a new project with the given code in the given space
|
|
90
|
+
is created."""
|
|
91
|
+
# get available projects, accessible by the current user
|
|
92
|
+
projectsAvail = self.ds.get_projects()
|
|
93
|
+
if spacePrefix:
|
|
94
|
+
projectsAvail = [prj for prj in projectsAvail if f"/{spacePrefix}_" in prj.identifier]
|
|
95
|
+
projects = [prj for prj in projectsAvail if prj.code == projectName]
|
|
96
|
+
assert len(projects) <= 1, f"Multiple projects found for '{projectName}'"
|
|
97
|
+
dsProject = None
|
|
98
|
+
if len(projects): # get the existing object
|
|
99
|
+
dsProject = projects[0]
|
|
100
|
+
else: # create it, if not found
|
|
101
|
+
print(f"Creating project '{projectName}'")
|
|
102
|
+
dsProject = self.ds.new_project(code=projectName, space=space)
|
|
103
|
+
dsProject.save()
|
|
104
|
+
assert dsProject
|
|
105
|
+
return dsProject
|
|
106
|
+
|
|
107
|
+
def createCollection(self, collName, projectObj, defaultObjType=None):
|
|
108
|
+
collections = self.ds.get_collections(project=projectObj)
|
|
109
|
+
dsColl = [coll for coll in collections if coll.code == collName.upper()]
|
|
110
|
+
if len(dsColl):
|
|
111
|
+
dsColl = dsColl[0]
|
|
112
|
+
else: # create it, if not found
|
|
113
|
+
print(f"Creating collection '{collName}'")
|
|
114
|
+
dsColl = self.ds.new_collection(
|
|
115
|
+
code=collName, type="COLLECTION", project=projectObj, props={"$name": collName}
|
|
116
|
+
)
|
|
117
|
+
dsColl.save()
|
|
118
|
+
assert dsColl
|
|
119
|
+
# update properties (name, default view and object type) if not set)
|
|
120
|
+
props = dsColl.props.all() # props as dict
|
|
121
|
+
propKey = "$name"
|
|
122
|
+
if propKey in props and props[propKey] is None:
|
|
123
|
+
props[propKey] = collName
|
|
124
|
+
propKey = "$default_collection_view"
|
|
125
|
+
if propKey in props.keys() and props[propKey] is None:
|
|
126
|
+
propVal = [
|
|
127
|
+
item
|
|
128
|
+
for item in self.ds.get_vocabulary(propKey + "s").get_terms().df.code
|
|
129
|
+
if "list" in item.lower()
|
|
130
|
+
]
|
|
131
|
+
assert len(propVal)
|
|
132
|
+
props[propKey] = propVal[0]
|
|
133
|
+
if defaultObjType:
|
|
134
|
+
propKey = "$default_object_type"
|
|
135
|
+
if propKey in props.keys() and props[propKey] is None:
|
|
136
|
+
props[propKey] = defaultObjType
|
|
137
|
+
# print(f"Setting '{collName}' properties:\n {props}")
|
|
138
|
+
dsColl.set_props(props)
|
|
139
|
+
dsColl.save()
|
|
140
|
+
return dsColl
|
|
141
|
+
|
|
142
|
+
def createObject(
|
|
143
|
+
self,
|
|
144
|
+
projectName: str,
|
|
145
|
+
collectionName: str = None,
|
|
146
|
+
space: str = None,
|
|
147
|
+
spacePrefix: str = None,
|
|
148
|
+
objType: str = None,
|
|
149
|
+
props: dict = None,
|
|
150
|
+
):
|
|
151
|
+
assert space and len(space), "space is required!"
|
|
152
|
+
assert projectName and len(projectName), "projectName is required!"
|
|
153
|
+
assert collectionName and len(collectionName), "collectionName is required!"
|
|
154
|
+
obj = self.ds.get_objects(type=objType, where={"$name": props["$name"]}).objects
|
|
155
|
+
if len(obj):
|
|
156
|
+
obj = obj[0]
|
|
157
|
+
prefix = objType
|
|
158
|
+
msg = "'{}' exists already in {}! Updating ...".format(
|
|
159
|
+
obj.props["$name"], obj.project.identifier
|
|
160
|
+
)
|
|
161
|
+
warnings.warn_explicit(msg, UserWarning, prefix, 0)
|
|
162
|
+
else: # does not exist yet
|
|
163
|
+
dsProject = self.createProject(projectName, space, spacePrefix=spacePrefix)
|
|
164
|
+
dsColl = self.createCollection(collectionName, dsProject, defaultObjType=objType)
|
|
165
|
+
objName = f" '{props['$name']}'" if len(props.get("$name", "")) else ""
|
|
166
|
+
print(f"Creating new {objType}{objName} in {dsColl.identifier}")
|
|
167
|
+
obj = self.ds.new_object(type=objType, props=props, collection=dsColl)
|
|
168
|
+
obj.set_props(props)
|
|
169
|
+
obj.save()
|
|
170
|
+
return obj
|
|
171
|
+
|
|
172
|
+
def findObjects(self, *args, **kwargs):
|
|
173
|
+
return self.ds.get_objects(**kwargs)
|
|
174
|
+
|
|
175
|
+
def uploadDataset(self, obj, datasetType, fpaths=[]):
|
|
176
|
+
def _checkFile(localPath, remoteFiles):
|
|
177
|
+
remoteFile = [f for f in remoteFiles if f.name == localPath.name]
|
|
178
|
+
if not len(remoteFile): # file exists in the dataset as well
|
|
179
|
+
return False
|
|
180
|
+
return filecmp.cmp(localPath, remoteFile[0], shallow=False)
|
|
181
|
+
|
|
182
|
+
if not len(fpaths):
|
|
183
|
+
return # nothing to do
|
|
184
|
+
for dataset in obj.get_datasets(type=datasetType):
|
|
185
|
+
with tempfile.TemporaryDirectory() as tempdir:
|
|
186
|
+
dataset.download(destination=tempdir)
|
|
187
|
+
dsFiles = [f for f in Path(tempdir).rglob("*") if f.is_file()]
|
|
188
|
+
if len(fpaths) == len(dsFiles):
|
|
189
|
+
if all([_checkFile(fpath, dsFiles) for fpath in fpaths]):
|
|
190
|
+
print(
|
|
191
|
+
f"All local files of {datasetType} match files in dataset, "
|
|
192
|
+
"not updating."
|
|
193
|
+
)
|
|
194
|
+
continue # skip deletion below
|
|
195
|
+
print(f"Dataset {datasetType} needs update, deleting existing dataset:")
|
|
196
|
+
dataset.delete("Needs update")
|
|
197
|
+
if not len(obj.get_datasets(type=datasetType)): # didn't exist yet or all deleted
|
|
198
|
+
dataset = self.ds.new_dataset(
|
|
199
|
+
type=datasetType, collection=obj.collection, object=obj, files=fpaths
|
|
200
|
+
)
|
|
201
|
+
dataset.save()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jupyter-analysis-tools
|
|
3
|
-
Version: 1.7.
|
|
3
|
+
Version: 1.7.3
|
|
4
4
|
Summary: Yet another Python library with helpers and utilities for data analysis and processing.
|
|
5
5
|
Author-email: Ingo Breßler <ingo.bressler@bam.de>, "Brian R. Pauw" <brian.pauw@bam.de>
|
|
6
6
|
License-Expression: MIT
|
|
@@ -36,10 +36,10 @@ Requires-Dist: ipywidgets
|
|
|
36
36
|
Requires-Dist: pybis
|
|
37
37
|
Dynamic: license-file
|
|
38
38
|
|
|
39
|
-
# Jupyter Analysis Tools (v1.7.
|
|
39
|
+
# Jupyter Analysis Tools (v1.7.3)
|
|
40
40
|
|
|
41
41
|
[](https://pypi.org/project/jupyter-analysis-tools)
|
|
42
|
-
[](https://github.com/BAMresearch/jupyter-analysis-tools/compare/v1.7.3...main)
|
|
43
43
|
[](https://en.wikipedia.org/wiki/MIT_license)
|
|
44
44
|
[](https://pypi.org/project/jupyter-analysis-tools)
|
|
45
45
|
[](https://pypi.org/project/jupyter-analysis-tools#files)
|
|
@@ -98,6 +98,22 @@ are installed:
|
|
|
98
98
|
|
|
99
99
|
# CHANGELOG
|
|
100
100
|
|
|
101
|
+
## v1.7.3 (2026-02-04)
|
|
102
|
+
|
|
103
|
+
### Bug fixes
|
|
104
|
+
|
|
105
|
+
* **DataStore**: do not attempt to create a token when logged in via token, not allowed ([`6beeddd`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/6beeddd2d778ed44080401700b223d3dc3eeebfc))
|
|
106
|
+
|
|
107
|
+
## v1.7.2 (2026-01-30)
|
|
108
|
+
|
|
109
|
+
### Bug fixes
|
|
110
|
+
|
|
111
|
+
* **DataStore.__init__**: allow token-based auth, docs added ([`d64f92f`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/d64f92fdcba4851497ff6782e4beee1109eb86bd))
|
|
112
|
+
|
|
113
|
+
### Code style
|
|
114
|
+
|
|
115
|
+
* **DataStore**: whitespace errors ([`f599040`](https://github.com/BAMresearch/jupyter-analysis-tools/commit/f5990401c80ec30a2748a5e2952ab806def207ac))
|
|
116
|
+
|
|
101
117
|
## v1.7.1 (2025-12-11)
|
|
102
118
|
|
|
103
119
|
### Bug fixes
|
|
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
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/analysis.py
RENAMED
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/binning.py
RENAMED
|
File without changes
|
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/distrib.py
RENAMED
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/git.py
RENAMED
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/plotting.py
RENAMED
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/readdata.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/utils.py
RENAMED
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/src/jupyter_analysis_tools/widgets.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/testdata/2015-03-20-Silica.ssf.json
RENAMED
|
File without changes
|
{jupyter_analysis_tools-1.7.1 → jupyter_analysis_tools-1.7.3}/testdata/2015-03-20-Silica.ssfz
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|