fairdatanow 0.2.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.
- fairdatanow-0.2.0/LICENSE +21 -0
- fairdatanow-0.2.0/MANIFEST.in +5 -0
- fairdatanow-0.2.0/PKG-INFO +66 -0
- fairdatanow-0.2.0/README.md +28 -0
- fairdatanow-0.2.0/fairdatanow/__init__.py +3 -0
- fairdatanow-0.2.0/fairdatanow/_modidx.py +15 -0
- fairdatanow-0.2.0/fairdatanow/webdav.py +139 -0
- fairdatanow-0.2.0/fairdatanow.egg-info/PKG-INFO +66 -0
- fairdatanow-0.2.0/fairdatanow.egg-info/SOURCES.txt +16 -0
- fairdatanow-0.2.0/fairdatanow.egg-info/dependency_links.txt +1 -0
- fairdatanow-0.2.0/fairdatanow.egg-info/entry_points.txt +2 -0
- fairdatanow-0.2.0/fairdatanow.egg-info/not-zip-safe +1 -0
- fairdatanow-0.2.0/fairdatanow.egg-info/requires.txt +6 -0
- fairdatanow-0.2.0/fairdatanow.egg-info/top_level.txt +1 -0
- fairdatanow-0.2.0/pyproject.toml +3 -0
- fairdatanow-0.2.0/settings.ini +46 -0
- fairdatanow-0.2.0/setup.cfg +4 -0
- fairdatanow-0.2.0/setup.py +64 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Frank Ligterink
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: fairdatanow
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Experimental Python package to support working with data from (y)our Nextcloud server
|
|
5
|
+
Home-page: https://github.com/fligt/fairdatanow
|
|
6
|
+
Author: Frank Ligterink
|
|
7
|
+
Author-email: frank.ligterink@gmail.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Keywords: nbdev jupyter notebook python
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: nc-py-api
|
|
22
|
+
Requires-Dist: polars[all]
|
|
23
|
+
Requires-Dist: itables
|
|
24
|
+
Requires-Dist: anywidget
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: keywords
|
|
33
|
+
Dynamic: license
|
|
34
|
+
Dynamic: provides-extra
|
|
35
|
+
Dynamic: requires-dist
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
Dynamic: summary
|
|
38
|
+
|
|
39
|
+
# Welcome to fairdatanow
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
43
|
+
|
|
44
|
+
Effective interdisciplinary cooperation in data science projects
|
|
45
|
+
requires smooth access to both data and code. And with the recent
|
|
46
|
+
development of two amazing open source frameworks (self hosted Nextcloud
|
|
47
|
+
for data storage and Jupyter notebooks for computing), we are now in a
|
|
48
|
+
position to actually make this happen. Recently our lab (the
|
|
49
|
+
Rijkserfgoedlaboratorium in Amsterdam) has installed a Nextcloud server
|
|
50
|
+
that gives our lab the possibility to share data files organized in
|
|
51
|
+
project folders with research partners. These can be accessed manually
|
|
52
|
+
via a web interface, but also programmatically with the webdav protocol!
|
|
53
|
+
With `fairdatanow` we want to learn how to easily find en download data
|
|
54
|
+
files from a Nextcloud storage directly in Jupyter notebooks in order to
|
|
55
|
+
explore them and create visualizations.
|
|
56
|
+
|
|
57
|
+
Under the hood the `fairdatanow` makes use of the Nextcloud Python
|
|
58
|
+
Framework [nc-py-api](https://pypi.org/project/nc-py-api) for
|
|
59
|
+
communication with the cloud server, and the powerful Python packages
|
|
60
|
+
[polars](https://pypi.org/project/polars/),
|
|
61
|
+
[itables](https://pypi.org/project/itables/) and
|
|
62
|
+
[anywidget](https://pypi.org/project/anywidget/) and for creating
|
|
63
|
+
interactive tables.
|
|
64
|
+
|
|
65
|
+
Although the package is still **under construction** it is already
|
|
66
|
+
available for installation from the python package index.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Welcome to fairdatanow
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
5
|
+
|
|
6
|
+
Effective interdisciplinary cooperation in data science projects
|
|
7
|
+
requires smooth access to both data and code. And with the recent
|
|
8
|
+
development of two amazing open source frameworks (self hosted Nextcloud
|
|
9
|
+
for data storage and Jupyter notebooks for computing), we are now in a
|
|
10
|
+
position to actually make this happen. Recently our lab (the
|
|
11
|
+
Rijkserfgoedlaboratorium in Amsterdam) has installed a Nextcloud server
|
|
12
|
+
that gives our lab the possibility to share data files organized in
|
|
13
|
+
project folders with research partners. These can be accessed manually
|
|
14
|
+
via a web interface, but also programmatically with the webdav protocol!
|
|
15
|
+
With `fairdatanow` we want to learn how to easily find en download data
|
|
16
|
+
files from a Nextcloud storage directly in Jupyter notebooks in order to
|
|
17
|
+
explore them and create visualizations.
|
|
18
|
+
|
|
19
|
+
Under the hood the `fairdatanow` makes use of the Nextcloud Python
|
|
20
|
+
Framework [nc-py-api](https://pypi.org/project/nc-py-api) for
|
|
21
|
+
communication with the cloud server, and the powerful Python packages
|
|
22
|
+
[polars](https://pypi.org/project/polars/),
|
|
23
|
+
[itables](https://pypi.org/project/itables/) and
|
|
24
|
+
[anywidget](https://pypi.org/project/anywidget/) and for creating
|
|
25
|
+
interactive tables.
|
|
26
|
+
|
|
27
|
+
Although the package is still **under construction** it is already
|
|
28
|
+
available for installation from the python package index.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Autogenerated by nbdev
|
|
2
|
+
|
|
3
|
+
d = { 'settings': { 'branch': 'master',
|
|
4
|
+
'doc_baseurl': '/fairdatanow',
|
|
5
|
+
'doc_host': 'https://fligt.github.io',
|
|
6
|
+
'git_url': 'https://github.com/fligt/fairdatanow',
|
|
7
|
+
'lib_path': 'fairdatanow'},
|
|
8
|
+
'syms': { 'fairdatanow.webdav': { 'fairdatanow.webdav.RemoteData': ( 'exploring-your-remote-data.html#remotedata',
|
|
9
|
+
'fairdatanow/webdav.py'),
|
|
10
|
+
'fairdatanow.webdav.RemoteData.__init__': ( 'exploring-your-remote-data.html#remotedata.__init__',
|
|
11
|
+
'fairdatanow/webdav.py'),
|
|
12
|
+
'fairdatanow.webdav.RemoteData.download_selected': ( 'exploring-your-remote-data.html#remotedata.download_selected',
|
|
13
|
+
'fairdatanow/webdav.py'),
|
|
14
|
+
'fairdatanow.webdav._node_to_dataframe': ( 'exploring-your-remote-data.html#_node_to_dataframe',
|
|
15
|
+
'fairdatanow/webdav.py')}}}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"""Instantly find and access all your Nextcloud data files"""
|
|
2
|
+
|
|
3
|
+
# AUTOGENERATED! DO NOT EDIT! File to edit: ../notebooks/10_exploring-your-remote-data.ipynb.
|
|
4
|
+
|
|
5
|
+
# %% auto 0
|
|
6
|
+
__all__ = ['RemoteData']
|
|
7
|
+
|
|
8
|
+
# %% ../notebooks/10_exploring-your-remote-data.ipynb 19
|
|
9
|
+
import nc_py_api
|
|
10
|
+
from nc_py_api import Nextcloud
|
|
11
|
+
|
|
12
|
+
import polars as pl
|
|
13
|
+
import itables
|
|
14
|
+
from itables.widget import ITable
|
|
15
|
+
import os
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
import time
|
|
18
|
+
import re
|
|
19
|
+
from IPython.display import HTML, display
|
|
20
|
+
|
|
21
|
+
# %% ../notebooks/10_exploring-your-remote-data.ipynb 20
|
|
22
|
+
def _node_to_dataframe(fsnode):
|
|
23
|
+
'''Convert `fsnode` object to polars a single row polars dataframe.'''
|
|
24
|
+
|
|
25
|
+
df = pl.DataFrame({'path': fsnode.user_path, 'size': fsnode.info.size, 'mimetype': fsnode.info.mimetype, 'modified': fsnode.info.last_modified,
|
|
26
|
+
'isdir': fsnode.is_dir, 'ext': os.path.splitext(fsnode.user_path)[1]})
|
|
27
|
+
|
|
28
|
+
return df
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
class RemoteData(object):
|
|
32
|
+
|
|
33
|
+
# See: https://help.nextcloud.com/t/using-nc-py-api-i-cant-download-any-file-due-to-ssl-certificte-verify-failed/194019
|
|
34
|
+
nc_py_api.options.NPA_NC_CERT = False
|
|
35
|
+
|
|
36
|
+
# keep full dataframe
|
|
37
|
+
itables.options.maxBytes = 0
|
|
38
|
+
itables.init_notebook_mode()
|
|
39
|
+
|
|
40
|
+
def __init__(self, configuration, searchBuilder={}):
|
|
41
|
+
'''Recursively scan the contents of a remote webdav server as specified by `configuration`.
|
|
42
|
+
'''
|
|
43
|
+
|
|
44
|
+
# parse configuration
|
|
45
|
+
m = re.match('(^https://[^/]+/)(.*)', configuration['url'])
|
|
46
|
+
nextcloud_url, self.cache_dir = m.groups()
|
|
47
|
+
nc_auth_user = configuration['user']
|
|
48
|
+
nc_auth_pass = configuration['password']
|
|
49
|
+
|
|
50
|
+
print(f'Please wait while scanning all file paths in remote folder...')
|
|
51
|
+
|
|
52
|
+
# Instantiate Nextcloud client
|
|
53
|
+
self.nc = Nextcloud(nextcloud_url=nextcloud_url, nc_auth_user=nc_auth_user, nc_auth_pass=nc_auth_pass)
|
|
54
|
+
|
|
55
|
+
# query webdav server to obtain file listing
|
|
56
|
+
fs_nodes_list = self.nc.files.listdir(self.cache_dir, depth=-1, exclude_self=False)
|
|
57
|
+
|
|
58
|
+
n_paths = len(fs_nodes_list)
|
|
59
|
+
|
|
60
|
+
# initialize polars dataframe with first row to fix schema
|
|
61
|
+
self.df = _node_to_dataframe(fs_nodes_list[0])
|
|
62
|
+
|
|
63
|
+
for fsnode in fs_nodes_list[1:]:
|
|
64
|
+
self.df.extend(_node_to_dataframe(fsnode))
|
|
65
|
+
|
|
66
|
+
# create interactive table
|
|
67
|
+
self.itable = ITable(
|
|
68
|
+
self.df,
|
|
69
|
+
layout={"top1": "searchBuilder"},
|
|
70
|
+
select=True,
|
|
71
|
+
searchBuilder=searchBuilder,
|
|
72
|
+
scrollY="500px", scrollCollapse=True, paging=False,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
print(f"Ready building file table for '{self.cache_dir}', Total number of files and directories: {n_paths} ")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
def download_selected(self, cache_dir=None):
|
|
79
|
+
'''Download selected files (blue rows) from `table` to default local cache directory.
|
|
80
|
+
|
|
81
|
+
A custom `cache_dir` can be specified. '''
|
|
82
|
+
|
|
83
|
+
# create cache path
|
|
84
|
+
if cache_dir is None:
|
|
85
|
+
cache_path = Path.home().joinpath('.cache', 'fairdatanow')
|
|
86
|
+
else:
|
|
87
|
+
cache_path = Path.home().joinpath('.cache', cache_dir)
|
|
88
|
+
|
|
89
|
+
os.makedirs(cache_path, exist_ok=True)
|
|
90
|
+
|
|
91
|
+
# obtain remote paths and remote timestamps
|
|
92
|
+
remote_path_list = [self.itable.df['path'][n] for n in self.itable.selected_rows]
|
|
93
|
+
remote_modified_list = [self.itable.df['modified'][n] for n in self.itable.selected_rows]
|
|
94
|
+
remote_isdir_list = [self.itable.df['isdir'][n] for n in self.itable.selected_rows]
|
|
95
|
+
|
|
96
|
+
n_files = len(remote_path_list)
|
|
97
|
+
|
|
98
|
+
for i, [remote_path, remote_modified, remote_isdir] in enumerate(zip(remote_path_list, remote_modified_list, remote_isdir_list)):
|
|
99
|
+
|
|
100
|
+
# only download actual files
|
|
101
|
+
if not remote_isdir:
|
|
102
|
+
remote_directory = os.path.dirname(remote_path)
|
|
103
|
+
local_directory = cache_path.joinpath(remote_directory) # I guess this will not yet work for Windows
|
|
104
|
+
|
|
105
|
+
# create directory structure inside cache
|
|
106
|
+
os.makedirs(local_directory, exist_ok=True)
|
|
107
|
+
|
|
108
|
+
# get remote epoch time
|
|
109
|
+
remote_modified_epoch_time = remote_modified.timestamp()
|
|
110
|
+
|
|
111
|
+
# construct corresponding local path
|
|
112
|
+
local_path = cache_path.joinpath(remote_path)
|
|
113
|
+
|
|
114
|
+
# check if local file exists and if modification times are similar
|
|
115
|
+
is_local = local_path.exists()
|
|
116
|
+
|
|
117
|
+
is_similar = False
|
|
118
|
+
local_modified_epoch_time = None
|
|
119
|
+
if is_local:
|
|
120
|
+
local_modified_epoch_time = os.stat(local_path).st_mtime
|
|
121
|
+
if local_modified_epoch_time == remote_modified_epoch_time:
|
|
122
|
+
is_similar = True
|
|
123
|
+
|
|
124
|
+
# download from nextcloud
|
|
125
|
+
if not is_similar:
|
|
126
|
+
print(f'[{i}/{n_files - 1}] Timestamps do no match: {remote_modified_epoch_time} vs {local_modified_epoch_time}', end='\r')
|
|
127
|
+
print(f'[{i}/{n_files - 1}] Downloading to: {local_path} ' , end='\r')
|
|
128
|
+
|
|
129
|
+
# write to cache
|
|
130
|
+
with open(local_path, 'bw') as fh:
|
|
131
|
+
self.nc.files.download2stream(remote_path, fh)
|
|
132
|
+
|
|
133
|
+
# adjust last modified timestamp
|
|
134
|
+
now = int(time.time())
|
|
135
|
+
os.utime(local_path, (now, remote_modified_epoch_time))
|
|
136
|
+
|
|
137
|
+
print(f"Ready with downloading {n_files} selected remote files to local cache: {cache_path} ")
|
|
138
|
+
|
|
139
|
+
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: fairdatanow
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Experimental Python package to support working with data from (y)our Nextcloud server
|
|
5
|
+
Home-page: https://github.com/fligt/fairdatanow
|
|
6
|
+
Author: Frank Ligterink
|
|
7
|
+
Author-email: frank.ligterink@gmail.com
|
|
8
|
+
License: MIT License
|
|
9
|
+
Keywords: nbdev jupyter notebook python
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: Natural Language :: English
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
18
|
+
Requires-Python: >=3.9
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: nc-py-api
|
|
22
|
+
Requires-Dist: polars[all]
|
|
23
|
+
Requires-Dist: itables
|
|
24
|
+
Requires-Dist: anywidget
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Dynamic: author
|
|
27
|
+
Dynamic: author-email
|
|
28
|
+
Dynamic: classifier
|
|
29
|
+
Dynamic: description
|
|
30
|
+
Dynamic: description-content-type
|
|
31
|
+
Dynamic: home-page
|
|
32
|
+
Dynamic: keywords
|
|
33
|
+
Dynamic: license
|
|
34
|
+
Dynamic: provides-extra
|
|
35
|
+
Dynamic: requires-dist
|
|
36
|
+
Dynamic: requires-python
|
|
37
|
+
Dynamic: summary
|
|
38
|
+
|
|
39
|
+
# Welcome to fairdatanow
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
<!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
|
|
43
|
+
|
|
44
|
+
Effective interdisciplinary cooperation in data science projects
|
|
45
|
+
requires smooth access to both data and code. And with the recent
|
|
46
|
+
development of two amazing open source frameworks (self hosted Nextcloud
|
|
47
|
+
for data storage and Jupyter notebooks for computing), we are now in a
|
|
48
|
+
position to actually make this happen. Recently our lab (the
|
|
49
|
+
Rijkserfgoedlaboratorium in Amsterdam) has installed a Nextcloud server
|
|
50
|
+
that gives our lab the possibility to share data files organized in
|
|
51
|
+
project folders with research partners. These can be accessed manually
|
|
52
|
+
via a web interface, but also programmatically with the webdav protocol!
|
|
53
|
+
With `fairdatanow` we want to learn how to easily find en download data
|
|
54
|
+
files from a Nextcloud storage directly in Jupyter notebooks in order to
|
|
55
|
+
explore them and create visualizations.
|
|
56
|
+
|
|
57
|
+
Under the hood the `fairdatanow` makes use of the Nextcloud Python
|
|
58
|
+
Framework [nc-py-api](https://pypi.org/project/nc-py-api) for
|
|
59
|
+
communication with the cloud server, and the powerful Python packages
|
|
60
|
+
[polars](https://pypi.org/project/polars/),
|
|
61
|
+
[itables](https://pypi.org/project/itables/) and
|
|
62
|
+
[anywidget](https://pypi.org/project/anywidget/) and for creating
|
|
63
|
+
interactive tables.
|
|
64
|
+
|
|
65
|
+
Although the package is still **under construction** it is already
|
|
66
|
+
available for installation from the python package index.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
settings.ini
|
|
6
|
+
setup.py
|
|
7
|
+
fairdatanow/__init__.py
|
|
8
|
+
fairdatanow/_modidx.py
|
|
9
|
+
fairdatanow/webdav.py
|
|
10
|
+
fairdatanow.egg-info/PKG-INFO
|
|
11
|
+
fairdatanow.egg-info/SOURCES.txt
|
|
12
|
+
fairdatanow.egg-info/dependency_links.txt
|
|
13
|
+
fairdatanow.egg-info/entry_points.txt
|
|
14
|
+
fairdatanow.egg-info/not-zip-safe
|
|
15
|
+
fairdatanow.egg-info/requires.txt
|
|
16
|
+
fairdatanow.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
fairdatanow
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
[DEFAULT]
|
|
2
|
+
# All sections below are required unless otherwise specified.
|
|
3
|
+
# See https://github.com/AnswerDotAI/nbdev/blob/main/settings.ini for examples.
|
|
4
|
+
|
|
5
|
+
### Python library ###
|
|
6
|
+
repo = fairdatanow
|
|
7
|
+
lib_name = %(repo)s
|
|
8
|
+
version = 0.2.0
|
|
9
|
+
min_python = 3.9
|
|
10
|
+
license = mit
|
|
11
|
+
black_formatting = False
|
|
12
|
+
|
|
13
|
+
### nbdev ###
|
|
14
|
+
doc_path = _docs
|
|
15
|
+
lib_path = fairdatanow
|
|
16
|
+
nbs_path = notebooks
|
|
17
|
+
recursive = True
|
|
18
|
+
tst_flags = notest
|
|
19
|
+
put_version_in_init = True
|
|
20
|
+
update_pyproject = True
|
|
21
|
+
|
|
22
|
+
### Docs ###
|
|
23
|
+
branch = master
|
|
24
|
+
custom_sidebar = False
|
|
25
|
+
doc_host = https://%(user)s.github.io
|
|
26
|
+
doc_baseurl = /%(repo)s
|
|
27
|
+
git_url = https://github.com/%(user)s/%(repo)s
|
|
28
|
+
title = %(lib_name)s
|
|
29
|
+
|
|
30
|
+
### PyPI ###
|
|
31
|
+
audience = Developers
|
|
32
|
+
author = Frank Ligterink
|
|
33
|
+
author_email = frank.ligterink@gmail.com
|
|
34
|
+
copyright = 2025 onwards, %(author)s
|
|
35
|
+
description = Experimental Python package to support working with data from (y)our Nextcloud server
|
|
36
|
+
keywords = nbdev jupyter notebook python
|
|
37
|
+
language = English
|
|
38
|
+
status = 3
|
|
39
|
+
user = fligt
|
|
40
|
+
|
|
41
|
+
### Optional ###
|
|
42
|
+
requirements = nc-py-api polars[all] itables anywidget
|
|
43
|
+
# dev_requirements =
|
|
44
|
+
# console_scripts =
|
|
45
|
+
# conda_user =
|
|
46
|
+
# package_data =
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
from pkg_resources import parse_version
|
|
2
|
+
from configparser import ConfigParser
|
|
3
|
+
import setuptools, shlex
|
|
4
|
+
assert parse_version(setuptools.__version__)>=parse_version('36.2')
|
|
5
|
+
|
|
6
|
+
# note: all settings are in settings.ini; edit there, not here
|
|
7
|
+
config = ConfigParser(delimiters=['='])
|
|
8
|
+
config.read('settings.ini', encoding='utf-8')
|
|
9
|
+
cfg = config['DEFAULT']
|
|
10
|
+
|
|
11
|
+
cfg_keys = 'version description keywords author author_email'.split()
|
|
12
|
+
expected = cfg_keys + "lib_name user branch license status min_python audience language".split()
|
|
13
|
+
for o in expected: assert o in cfg, "missing expected setting: {}".format(o)
|
|
14
|
+
setup_cfg = {o:cfg[o] for o in cfg_keys}
|
|
15
|
+
|
|
16
|
+
licenses = {
|
|
17
|
+
'apache2': ('Apache Software License 2.0','OSI Approved :: Apache Software License'),
|
|
18
|
+
'mit': ('MIT License', 'OSI Approved :: MIT License'),
|
|
19
|
+
'gpl2': ('GNU General Public License v2', 'OSI Approved :: GNU General Public License v2 (GPLv2)'),
|
|
20
|
+
'gpl3': ('GNU General Public License v3', 'OSI Approved :: GNU General Public License v3 (GPLv3)'),
|
|
21
|
+
'bsd3': ('BSD License', 'OSI Approved :: BSD License'),
|
|
22
|
+
}
|
|
23
|
+
statuses = [ '1 - Planning', '2 - Pre-Alpha', '3 - Alpha',
|
|
24
|
+
'4 - Beta', '5 - Production/Stable', '6 - Mature', '7 - Inactive' ]
|
|
25
|
+
py_versions = '3.6 3.7 3.8 3.9 3.10 3.11 3.12'.split()
|
|
26
|
+
|
|
27
|
+
requirements = shlex.split(cfg.get('requirements', ''))
|
|
28
|
+
if cfg.get('pip_requirements'): requirements += shlex.split(cfg.get('pip_requirements', ''))
|
|
29
|
+
min_python = cfg['min_python']
|
|
30
|
+
lic = licenses.get(cfg['license'].lower(), (cfg['license'], None))
|
|
31
|
+
dev_requirements = (cfg.get('dev_requirements') or '').split()
|
|
32
|
+
|
|
33
|
+
package_data = dict()
|
|
34
|
+
pkg_data = cfg.get('package_data', None)
|
|
35
|
+
if pkg_data:
|
|
36
|
+
package_data[cfg['lib_name']] = pkg_data.split() # split as multiple files might be listed
|
|
37
|
+
# Add package data to setup_cfg for setuptools.setup(..., **setup_cfg)
|
|
38
|
+
setup_cfg['package_data'] = package_data
|
|
39
|
+
|
|
40
|
+
setuptools.setup(
|
|
41
|
+
name = cfg['lib_name'],
|
|
42
|
+
license = lic[0],
|
|
43
|
+
classifiers = [
|
|
44
|
+
'Development Status :: ' + statuses[int(cfg['status'])],
|
|
45
|
+
'Intended Audience :: ' + cfg['audience'].title(),
|
|
46
|
+
'Natural Language :: ' + cfg['language'].title(),
|
|
47
|
+
] + ['Programming Language :: Python :: '+o for o in py_versions[py_versions.index(min_python):]] + (['License :: ' + lic[1] ] if lic[1] else []),
|
|
48
|
+
url = cfg['git_url'],
|
|
49
|
+
packages = setuptools.find_packages(),
|
|
50
|
+
include_package_data = True,
|
|
51
|
+
install_requires = requirements,
|
|
52
|
+
extras_require={ 'dev': dev_requirements },
|
|
53
|
+
dependency_links = cfg.get('dep_links','').split(),
|
|
54
|
+
python_requires = '>=' + cfg['min_python'],
|
|
55
|
+
long_description = open('README.md', encoding='utf-8').read(),
|
|
56
|
+
long_description_content_type = 'text/markdown',
|
|
57
|
+
zip_safe = False,
|
|
58
|
+
entry_points = {
|
|
59
|
+
'console_scripts': cfg.get('console_scripts','').split(),
|
|
60
|
+
'nbdev': [f'{cfg.get("lib_path")}={cfg.get("lib_path")}._modidx:d']
|
|
61
|
+
},
|
|
62
|
+
**setup_cfg)
|
|
63
|
+
|
|
64
|
+
|