huwise-utils-py 1.0.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.
- huwise_utils_py-1.0.0/.gitignore +139 -0
- huwise_utils_py-1.0.0/LICENSE +21 -0
- huwise_utils_py-1.0.0/PKG-INFO +163 -0
- huwise_utils_py-1.0.0/README.md +118 -0
- huwise_utils_py-1.0.0/pyproject.toml +128 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/__init__.py +110 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/_legacy/__init__.py +71 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/_legacy/getters.py +293 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/_legacy/setters.py +313 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/bulk.py +336 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/config.py +73 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/dataset.py +333 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/http.py +278 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/logger.py +15 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/py.typed +0 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/utils/__init__.py +10 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/utils/decorators.py +88 -0
- huwise_utils_py-1.0.0/src/huwise_utils_py/utils/validators.py +50 -0
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
86
|
+
__pypackages__/
|
|
87
|
+
|
|
88
|
+
# Celery stuff
|
|
89
|
+
celerybeat-schedule
|
|
90
|
+
celerybeat.pid
|
|
91
|
+
|
|
92
|
+
# SageMath parsed files
|
|
93
|
+
*.sage.py
|
|
94
|
+
|
|
95
|
+
# Environments
|
|
96
|
+
**/*.env
|
|
97
|
+
**/*.venv/
|
|
98
|
+
env/
|
|
99
|
+
venv/
|
|
100
|
+
ENV/
|
|
101
|
+
env.bak/
|
|
102
|
+
venv.bak/
|
|
103
|
+
|
|
104
|
+
# Spyder project settings
|
|
105
|
+
.spyderproject
|
|
106
|
+
.spyproject
|
|
107
|
+
|
|
108
|
+
# Rope project settings
|
|
109
|
+
.ropeproject
|
|
110
|
+
|
|
111
|
+
# mkdocs documentation
|
|
112
|
+
/site
|
|
113
|
+
|
|
114
|
+
# mypy
|
|
115
|
+
.mypy_cache/
|
|
116
|
+
.dmypy.json
|
|
117
|
+
dmypy.json
|
|
118
|
+
|
|
119
|
+
# Pyre type checker
|
|
120
|
+
.pyre/
|
|
121
|
+
|
|
122
|
+
# pytype static type analyzer
|
|
123
|
+
.pytype/
|
|
124
|
+
|
|
125
|
+
# Cython debug symbols
|
|
126
|
+
cython_debug/
|
|
127
|
+
|
|
128
|
+
# PyCharm
|
|
129
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
130
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
131
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
132
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
133
|
+
.idea/
|
|
134
|
+
|
|
135
|
+
# Website links
|
|
136
|
+
*.url
|
|
137
|
+
|
|
138
|
+
# Credential files. Should not exist in this project, but in case they do, we don't want to accidentally upload them
|
|
139
|
+
**/credentials.py
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Open Data Basel-Stadt
|
|
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,163 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: huwise-utils-py
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: A Python wrapper library for the Huwise Automation API
|
|
5
|
+
Project-URL: Homepage, https://github.com/opendatabs/huwise-utils-py
|
|
6
|
+
Project-URL: Documentation, https://opendatabs.github.io/huwise-utils-py
|
|
7
|
+
Project-URL: Repository, https://github.com/opendatabs/huwise-utils-py.git
|
|
8
|
+
Project-URL: Issues, https://github.com/opendatabs/huwise-utils-py/issues
|
|
9
|
+
Project-URL: Coding Standards, https://dcc-bs.github.io/documentation/coding/python.html
|
|
10
|
+
Author-email: Open Data Basel-Stadt <opendata@bs.ch>, Renato Farruggio <renato.farruggio@bs.ch>, Rstam Alosuh <rstam.aloush@bs.ch>, Orhan Saeedi <orhan.saeedi@bs.ch>
|
|
11
|
+
License: MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2024 Open Data Basel-Stadt
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
License-File: LICENSE
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Operating System :: OS Independent
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
39
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
40
|
+
Requires-Python: >=3.12
|
|
41
|
+
Requires-Dist: dcc-backend-common>=0.1.4
|
|
42
|
+
Requires-Dist: httpx>=0.27.0
|
|
43
|
+
Requires-Dist: rich>=14.3.2
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# huwise-utils-py
|
|
47
|
+
|
|
48
|
+
A Python library for the Huwise Automation API.
|
|
49
|
+
|
|
50
|
+
[](https://badge.fury.io/py/huwise-utils-py)
|
|
51
|
+
[](https://www.python.org/downloads/)
|
|
52
|
+
[](https://opensource.org/licenses/MIT)
|
|
53
|
+
|
|
54
|
+
## Features
|
|
55
|
+
|
|
56
|
+
- **Type-safe configuration** with Pydantic-based `HuwiseConfig`
|
|
57
|
+
- **Object-oriented API** with `HuwiseDataset` class and method chaining
|
|
58
|
+
- **Async support** for high-performance bulk operations
|
|
59
|
+
- **Structured logging** via `dcc-backend-common`
|
|
60
|
+
- **Dependency injection** support for testable code
|
|
61
|
+
- **Backwards compatible** function-based API available
|
|
62
|
+
|
|
63
|
+
## Installation
|
|
64
|
+
|
|
65
|
+
Using `uv` (recommended):
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
uv add huwise-utils-py
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or via `pip`:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
pip install huwise-utils-py
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Requirements
|
|
78
|
+
|
|
79
|
+
- **Python Version:** 3.12 or higher
|
|
80
|
+
- **API Key:** A valid API key from Huwise
|
|
81
|
+
|
|
82
|
+
## Quick Start
|
|
83
|
+
|
|
84
|
+
### Configuration
|
|
85
|
+
|
|
86
|
+
Create a `.env` file:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
HUWISE_API_KEY=your-api-key
|
|
90
|
+
HUWISE_DOMAIN=data.bs.ch
|
|
91
|
+
HUWISE_API_TYPE=automation/v1.0
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Using HuwiseDataset (Recommended)
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from huwise_utils_py import HuwiseDataset
|
|
98
|
+
|
|
99
|
+
# Create a dataset instance
|
|
100
|
+
dataset = HuwiseDataset(uid="da_abc123")
|
|
101
|
+
|
|
102
|
+
# Read metadata
|
|
103
|
+
title = dataset.get_title()
|
|
104
|
+
description = dataset.get_description()
|
|
105
|
+
|
|
106
|
+
# Update with method chaining
|
|
107
|
+
dataset.set_title("New Title", publish=False) \
|
|
108
|
+
.set_description("New description") \
|
|
109
|
+
.publish()
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Using Functions
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from huwise_utils_py import get_dataset_title, set_dataset_title
|
|
116
|
+
|
|
117
|
+
# Read
|
|
118
|
+
title = get_dataset_title(dataset_uid="da_abc123")
|
|
119
|
+
|
|
120
|
+
# Write
|
|
121
|
+
set_dataset_title("New Title", dataset_uid="da_abc123")
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Bulk Operations
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from huwise_utils_py import bulk_get_metadata, bulk_get_metadata_async
|
|
128
|
+
import asyncio
|
|
129
|
+
|
|
130
|
+
# Synchronous
|
|
131
|
+
metadata = bulk_get_metadata(["da_123", "da_456", "da_789"])
|
|
132
|
+
|
|
133
|
+
# Asynchronous (10-100x faster for many datasets)
|
|
134
|
+
metadata = asyncio.run(bulk_get_metadata_async(["da_123", "da_456", "da_789"]))
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## API Key Setup
|
|
138
|
+
|
|
139
|
+
To use `huwise-utils-py`, create an API key with these permissions:
|
|
140
|
+
|
|
141
|
+
- Browse all datasets
|
|
142
|
+
- Create new datasets
|
|
143
|
+
- Edit all datasets
|
|
144
|
+
- Publish own datasets
|
|
145
|
+
|
|
146
|
+
[For OGD Basel, create your API key here](https://data.bs.ch/account/api-keys/).
|
|
147
|
+
|
|
148
|
+
**Important:** Add `**/.env` to your `.gitignore` to protect your credentials.
|
|
149
|
+
|
|
150
|
+
## Documentation
|
|
151
|
+
|
|
152
|
+
Full documentation is available at [opendatabs.github.io/huwise-utils-py](https://opendatabs.github.io/huwise-utils-py).
|
|
153
|
+
|
|
154
|
+
## Further Links
|
|
155
|
+
|
|
156
|
+
- [GitHub Repository](https://github.com/opendatabs/huwise-utils-py)
|
|
157
|
+
- [PyPI Package](https://pypi.org/project/huwise-utils-py/)
|
|
158
|
+
- [Huwise Automation API Documentation](https://help.opendatasoft.com/apis/ods-automation-v1/)
|
|
159
|
+
- [DCC Python Coding Standards](https://dcc-bs.github.io/documentation/coding/python.html)
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# huwise-utils-py
|
|
2
|
+
|
|
3
|
+
A Python library for the Huwise Automation API.
|
|
4
|
+
|
|
5
|
+
[](https://badge.fury.io/py/huwise-utils-py)
|
|
6
|
+
[](https://www.python.org/downloads/)
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- **Type-safe configuration** with Pydantic-based `HuwiseConfig`
|
|
12
|
+
- **Object-oriented API** with `HuwiseDataset` class and method chaining
|
|
13
|
+
- **Async support** for high-performance bulk operations
|
|
14
|
+
- **Structured logging** via `dcc-backend-common`
|
|
15
|
+
- **Dependency injection** support for testable code
|
|
16
|
+
- **Backwards compatible** function-based API available
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
Using `uv` (recommended):
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
uv add huwise-utils-py
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or via `pip`:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install huwise-utils-py
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
- **Python Version:** 3.12 or higher
|
|
35
|
+
- **API Key:** A valid API key from Huwise
|
|
36
|
+
|
|
37
|
+
## Quick Start
|
|
38
|
+
|
|
39
|
+
### Configuration
|
|
40
|
+
|
|
41
|
+
Create a `.env` file:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
HUWISE_API_KEY=your-api-key
|
|
45
|
+
HUWISE_DOMAIN=data.bs.ch
|
|
46
|
+
HUWISE_API_TYPE=automation/v1.0
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Using HuwiseDataset (Recommended)
|
|
50
|
+
|
|
51
|
+
```python
|
|
52
|
+
from huwise_utils_py import HuwiseDataset
|
|
53
|
+
|
|
54
|
+
# Create a dataset instance
|
|
55
|
+
dataset = HuwiseDataset(uid="da_abc123")
|
|
56
|
+
|
|
57
|
+
# Read metadata
|
|
58
|
+
title = dataset.get_title()
|
|
59
|
+
description = dataset.get_description()
|
|
60
|
+
|
|
61
|
+
# Update with method chaining
|
|
62
|
+
dataset.set_title("New Title", publish=False) \
|
|
63
|
+
.set_description("New description") \
|
|
64
|
+
.publish()
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Using Functions
|
|
68
|
+
|
|
69
|
+
```python
|
|
70
|
+
from huwise_utils_py import get_dataset_title, set_dataset_title
|
|
71
|
+
|
|
72
|
+
# Read
|
|
73
|
+
title = get_dataset_title(dataset_uid="da_abc123")
|
|
74
|
+
|
|
75
|
+
# Write
|
|
76
|
+
set_dataset_title("New Title", dataset_uid="da_abc123")
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Bulk Operations
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
from huwise_utils_py import bulk_get_metadata, bulk_get_metadata_async
|
|
83
|
+
import asyncio
|
|
84
|
+
|
|
85
|
+
# Synchronous
|
|
86
|
+
metadata = bulk_get_metadata(["da_123", "da_456", "da_789"])
|
|
87
|
+
|
|
88
|
+
# Asynchronous (10-100x faster for many datasets)
|
|
89
|
+
metadata = asyncio.run(bulk_get_metadata_async(["da_123", "da_456", "da_789"]))
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## API Key Setup
|
|
93
|
+
|
|
94
|
+
To use `huwise-utils-py`, create an API key with these permissions:
|
|
95
|
+
|
|
96
|
+
- Browse all datasets
|
|
97
|
+
- Create new datasets
|
|
98
|
+
- Edit all datasets
|
|
99
|
+
- Publish own datasets
|
|
100
|
+
|
|
101
|
+
[For OGD Basel, create your API key here](https://data.bs.ch/account/api-keys/).
|
|
102
|
+
|
|
103
|
+
**Important:** Add `**/.env` to your `.gitignore` to protect your credentials.
|
|
104
|
+
|
|
105
|
+
## Documentation
|
|
106
|
+
|
|
107
|
+
Full documentation is available at [opendatabs.github.io/huwise-utils-py](https://opendatabs.github.io/huwise-utils-py).
|
|
108
|
+
|
|
109
|
+
## Further Links
|
|
110
|
+
|
|
111
|
+
- [GitHub Repository](https://github.com/opendatabs/huwise-utils-py)
|
|
112
|
+
- [PyPI Package](https://pypi.org/project/huwise-utils-py/)
|
|
113
|
+
- [Huwise Automation API Documentation](https://help.opendatasoft.com/apis/ods-automation-v1/)
|
|
114
|
+
- [DCC Python Coding Standards](https://dcc-bs.github.io/documentation/coding/python.html)
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "huwise-utils-py"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "A Python wrapper library for the Huwise Automation API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = {file = "LICENSE"}
|
|
11
|
+
authors = [
|
|
12
|
+
{name = "Open Data Basel-Stadt", email = "opendata@bs.ch"},
|
|
13
|
+
{name = "Renato Farruggio", email = "renato.farruggio@bs.ch"},
|
|
14
|
+
{name = "Rstam Alosuh", email = "rstam.aloush@bs.ch"},
|
|
15
|
+
{name = "Orhan Saeedi", email = "orhan.saeedi@bs.ch"},
|
|
16
|
+
]
|
|
17
|
+
requires-python = ">=3.12"
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"License :: OSI Approved :: MIT License",
|
|
23
|
+
"Operating System :: OS Independent",
|
|
24
|
+
"Intended Audience :: Developers",
|
|
25
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
26
|
+
]
|
|
27
|
+
dependencies = [
|
|
28
|
+
"dcc-backend-common>=0.1.4",
|
|
29
|
+
"httpx>=0.27.0",
|
|
30
|
+
"rich>=14.3.2",
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/opendatabs/huwise-utils-py"
|
|
35
|
+
Documentation = "https://opendatabs.github.io/huwise-utils-py"
|
|
36
|
+
Repository = "https://github.com/opendatabs/huwise-utils-py.git"
|
|
37
|
+
Issues = "https://github.com/opendatabs/huwise-utils-py/issues"
|
|
38
|
+
"Coding Standards" = "https://dcc-bs.github.io/documentation/coding/python.html"
|
|
39
|
+
|
|
40
|
+
[dependency-groups]
|
|
41
|
+
dev = [
|
|
42
|
+
"pytest>=8.0.0",
|
|
43
|
+
"pytest-asyncio>=0.23.0",
|
|
44
|
+
"ruff>=0.9.0",
|
|
45
|
+
"ty>=0.0.9",
|
|
46
|
+
"pre-commit>=4.0.0",
|
|
47
|
+
"coverage>=7.6.0",
|
|
48
|
+
]
|
|
49
|
+
docs = [
|
|
50
|
+
"mkdocs-material>=9.5.0",
|
|
51
|
+
"mkdocstrings[python]>=0.24.0",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
[tool.hatch.build.targets.sdist]
|
|
55
|
+
include = [
|
|
56
|
+
"/src",
|
|
57
|
+
]
|
|
58
|
+
|
|
59
|
+
[tool.hatch.build.targets.wheel]
|
|
60
|
+
packages = ["src/huwise_utils_py"]
|
|
61
|
+
|
|
62
|
+
[tool.ruff]
|
|
63
|
+
target-version = "py312"
|
|
64
|
+
line-length = 120
|
|
65
|
+
fix = true
|
|
66
|
+
|
|
67
|
+
[tool.ruff.lint]
|
|
68
|
+
select = [
|
|
69
|
+
# flake8-2020
|
|
70
|
+
"YTT",
|
|
71
|
+
# flake8-bandit
|
|
72
|
+
"S",
|
|
73
|
+
# flake8-bugbear
|
|
74
|
+
"B",
|
|
75
|
+
# flake8-builtins
|
|
76
|
+
"A",
|
|
77
|
+
# flake8-comprehensions
|
|
78
|
+
"C4",
|
|
79
|
+
# flake8-debugger
|
|
80
|
+
"T10",
|
|
81
|
+
# flake8-simplify
|
|
82
|
+
"SIM",
|
|
83
|
+
# isort
|
|
84
|
+
"I",
|
|
85
|
+
# mccabe
|
|
86
|
+
"C90",
|
|
87
|
+
# pycodestyle
|
|
88
|
+
"E", "W",
|
|
89
|
+
# pyflakes
|
|
90
|
+
"F",
|
|
91
|
+
# pygrep-hooks
|
|
92
|
+
"PGH",
|
|
93
|
+
# pyupgrade
|
|
94
|
+
"UP",
|
|
95
|
+
# ruff
|
|
96
|
+
"RUF",
|
|
97
|
+
# tryceratops
|
|
98
|
+
"TRY",
|
|
99
|
+
]
|
|
100
|
+
ignore = [
|
|
101
|
+
# LineTooLong
|
|
102
|
+
"E501",
|
|
103
|
+
# DoNotAssignLambda
|
|
104
|
+
"E731",
|
|
105
|
+
"TRY003",
|
|
106
|
+
]
|
|
107
|
+
|
|
108
|
+
[tool.ruff.lint.per-file-ignores]
|
|
109
|
+
"tests/*" = ["S101"]
|
|
110
|
+
|
|
111
|
+
[tool.ruff.format]
|
|
112
|
+
preview = true
|
|
113
|
+
indent-style = "space"
|
|
114
|
+
quote-style = "double"
|
|
115
|
+
skip-magic-trailing-comma = false
|
|
116
|
+
line-ending = "auto"
|
|
117
|
+
|
|
118
|
+
[tool.ruff.lint.isort]
|
|
119
|
+
known-first-party = ["huwise_utils_py"]
|
|
120
|
+
combine-as-imports = true
|
|
121
|
+
force-wrap-aliases = true
|
|
122
|
+
|
|
123
|
+
[tool.pytest.ini_options]
|
|
124
|
+
testpaths = ["tests"]
|
|
125
|
+
python_files = ["test_*.py"]
|
|
126
|
+
python_functions = ["test_*"]
|
|
127
|
+
asyncio_mode = "auto"
|
|
128
|
+
asyncio_default_fixture_loop_scope = "function"
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""Huwise Utils Python - A Python wrapper library for the Huwise Automation API.
|
|
2
|
+
|
|
3
|
+
This package provides a modern, type-safe interface for interacting with the Huwise
|
|
4
|
+
(formerly OpenDataSoft) Automation API to manage datasets, metadata, and more.
|
|
5
|
+
|
|
6
|
+
Example:
|
|
7
|
+
>>> from huwise_utils_py import HuwiseDataset
|
|
8
|
+
>>> dataset = HuwiseDataset(uid="da_abc123")
|
|
9
|
+
>>> dataset.set_title("New Title").set_description("Description").publish()
|
|
10
|
+
|
|
11
|
+
For function-based API:
|
|
12
|
+
>>> from huwise_utils_py import get_dataset_title, set_dataset_title
|
|
13
|
+
>>> title = get_dataset_title(dataset_uid="da_abc123")
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
# Function-based API
|
|
17
|
+
from huwise_utils_py._legacy import (
|
|
18
|
+
get_all_dataset_ids,
|
|
19
|
+
get_dataset_custom_view,
|
|
20
|
+
get_dataset_description,
|
|
21
|
+
get_dataset_keywords,
|
|
22
|
+
get_dataset_language,
|
|
23
|
+
get_dataset_license,
|
|
24
|
+
get_dataset_metadata,
|
|
25
|
+
get_dataset_metadata_temporal_period,
|
|
26
|
+
get_dataset_publisher,
|
|
27
|
+
get_dataset_theme,
|
|
28
|
+
get_dataset_title,
|
|
29
|
+
get_number_of_datasets,
|
|
30
|
+
get_template_metadata,
|
|
31
|
+
get_uid_by_id,
|
|
32
|
+
set_dataset_description,
|
|
33
|
+
set_dataset_keywords,
|
|
34
|
+
set_dataset_language,
|
|
35
|
+
set_dataset_license,
|
|
36
|
+
set_dataset_metadata_temporal_coverage_end_date,
|
|
37
|
+
set_dataset_metadata_temporal_coverage_start_date,
|
|
38
|
+
set_dataset_metadata_temporal_period,
|
|
39
|
+
set_dataset_public,
|
|
40
|
+
set_dataset_publisher,
|
|
41
|
+
set_dataset_theme,
|
|
42
|
+
set_dataset_title,
|
|
43
|
+
set_template_metadata,
|
|
44
|
+
)
|
|
45
|
+
from huwise_utils_py.bulk import (
|
|
46
|
+
bulk_get_dataset_ids,
|
|
47
|
+
bulk_get_dataset_ids_async,
|
|
48
|
+
bulk_get_metadata,
|
|
49
|
+
bulk_get_metadata_async,
|
|
50
|
+
bulk_update_metadata,
|
|
51
|
+
bulk_update_metadata_async,
|
|
52
|
+
)
|
|
53
|
+
from huwise_utils_py.config import HuwiseConfig
|
|
54
|
+
from huwise_utils_py.dataset import HuwiseDataset
|
|
55
|
+
from huwise_utils_py.http import AsyncHttpClient, HttpClient
|
|
56
|
+
from huwise_utils_py.logger import get_logger, init_logger
|
|
57
|
+
|
|
58
|
+
# Utilities
|
|
59
|
+
from huwise_utils_py.utils import retry, validate_dataset_identifier
|
|
60
|
+
|
|
61
|
+
__version__ = "1.0.0"
|
|
62
|
+
|
|
63
|
+
__all__ = [
|
|
64
|
+
"AsyncHttpClient",
|
|
65
|
+
"HttpClient",
|
|
66
|
+
# Core components (new API)
|
|
67
|
+
"HuwiseConfig",
|
|
68
|
+
"HuwiseDataset",
|
|
69
|
+
# Version
|
|
70
|
+
"__version__",
|
|
71
|
+
"bulk_get_dataset_ids",
|
|
72
|
+
"bulk_get_dataset_ids_async",
|
|
73
|
+
# Bulk operations (new API)
|
|
74
|
+
"bulk_get_metadata",
|
|
75
|
+
"bulk_get_metadata_async",
|
|
76
|
+
"bulk_update_metadata",
|
|
77
|
+
"bulk_update_metadata_async",
|
|
78
|
+
# Function-based API
|
|
79
|
+
"get_all_dataset_ids",
|
|
80
|
+
"get_dataset_custom_view",
|
|
81
|
+
"get_dataset_description",
|
|
82
|
+
"get_dataset_keywords",
|
|
83
|
+
"get_dataset_language",
|
|
84
|
+
"get_dataset_license",
|
|
85
|
+
"get_dataset_metadata",
|
|
86
|
+
"get_dataset_metadata_temporal_period",
|
|
87
|
+
"get_dataset_publisher",
|
|
88
|
+
"get_dataset_theme",
|
|
89
|
+
"get_dataset_title",
|
|
90
|
+
"get_logger",
|
|
91
|
+
"get_number_of_datasets",
|
|
92
|
+
"get_template_metadata",
|
|
93
|
+
"get_uid_by_id",
|
|
94
|
+
"init_logger",
|
|
95
|
+
# Utilities
|
|
96
|
+
"retry",
|
|
97
|
+
"set_dataset_description",
|
|
98
|
+
"set_dataset_keywords",
|
|
99
|
+
"set_dataset_language",
|
|
100
|
+
"set_dataset_license",
|
|
101
|
+
"set_dataset_metadata_temporal_coverage_end_date",
|
|
102
|
+
"set_dataset_metadata_temporal_coverage_start_date",
|
|
103
|
+
"set_dataset_metadata_temporal_period",
|
|
104
|
+
"set_dataset_public",
|
|
105
|
+
"set_dataset_publisher",
|
|
106
|
+
"set_dataset_theme",
|
|
107
|
+
"set_dataset_title",
|
|
108
|
+
"set_template_metadata",
|
|
109
|
+
"validate_dataset_identifier",
|
|
110
|
+
]
|