spio 0.0.6.post12__py3-none-any.whl → 0.0.7__py3-none-any.whl

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.

Potentially problematic release.


This version of spio might be problematic. Click here for more details.

@@ -0,0 +1,286 @@
1
+ Metadata-Version: 2.1
2
+ Name: spio
3
+ Version: 0.0.7
4
+ Summary: Magical Marvin SharePoint Library
5
+ Author: Roeland Maes
6
+ Author-email: roeland.maes@vito.be
7
+ Requires-Python: >=3.10,<4.0
8
+ Classifier: Programming Language :: Python :: 3
9
+ Classifier: Programming Language :: Python :: 3.10
10
+ Classifier: Programming Language :: Python :: 3.11
11
+ Classifier: Programming Language :: Python :: 3.12
12
+ Provides-Extra: full
13
+ Provides-Extra: pandas
14
+ Provides-Extra: pandas-parquet
15
+ Provides-Extra: pandas-xlsx
16
+ Requires-Dist: Office365-REST-Python-Client (>=2.3,<3.0)
17
+ Requires-Dist: msal_extensions (>=0.3,<0.4)
18
+ Description-Content-Type: text/markdown
19
+
20
+
21
+ # Spio
22
+
23
+ ## Description
24
+
25
+ Spio is a Python package that provides functionalities for reading and writing data to a SharePoint.
26
+ It can also handle various types of spatial and non-spatial data formats such as GeoTIFF, GeoPackage, NetCDF, CSV, Excel, and more.
27
+
28
+ ## Installation
29
+
30
+ To install the package, you can use the following command:
31
+
32
+ ```bash
33
+ pip install spio
34
+ ```
35
+
36
+ If you want to install the package with all the dependencies, you can use the following command:
37
+
38
+ ```bash
39
+ pip install spio[full]
40
+ ```
41
+
42
+ ## Building from Source
43
+
44
+ To build the package from source you can use the following commands:
45
+
46
+ ```bash
47
+ git clone https://git.vito.be/projects/MARVIN/repos/sharepoint_tools
48
+ cd sharepoint_tools
49
+ conda create -f conda_env.yml
50
+ conda activate spio
51
+ poetry install
52
+ ```
53
+
54
+ ## Configuration
55
+
56
+ Before using the package, you need to configure the settings to match your environment.
57
+ The configuration is managed through a `settings` module which should include all the necessary configurations.
58
+
59
+ ### **Settings Configuration**:
60
+ Ensure you have a `settings` file (e.g., `.secrets.yaml` or `settings.yaml`) that provides the necessary configuration options. Example:
61
+
62
+ ```python
63
+ from dynaconf import Dynaconf
64
+
65
+ settings = Dynaconf(
66
+ settings_files=['settings.yaml', '.secrets.yaml']
67
+ )
68
+ ```
69
+
70
+ The settings file should include the following configurations:
71
+
72
+ ```yaml
73
+ user_account: your.name@vito.be
74
+ ```
75
+
76
+ ### **Initialize Spio with Settings**:
77
+ You need to initialize Spio with your settings before using any functionalities.
78
+
79
+ ```python
80
+ from config import settings
81
+ from marvin.tools import spio
82
+
83
+ spio.init_spio(settings)
84
+ ```
85
+
86
+ ## Usage
87
+
88
+ Here are some example usages of the package:
89
+
90
+ ### Reading Data
91
+
92
+ - **Read GeoTIFF using Rasterio**:
93
+
94
+ ```python
95
+ from marvin.tools.spio import SPIO
96
+ import rasterio
97
+
98
+ geotiff_file = SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/geotiff.tiff')
99
+ with rasterio.open(geotiff_file.copy_bytes_io()) as src:
100
+ # Read the dataset's metadata
101
+ print("Metadata:", src.meta)
102
+ print("CRS:", src.crs)
103
+ print("Bounds:", src.bounds)
104
+ data = src.read()
105
+ print("data: ", data.shape)
106
+ ```
107
+
108
+ - **Read GeoTIFF using GDAL**:
109
+
110
+ ```python
111
+ from marvin.tools.spio import SPIO
112
+ from osgeo import gdal
113
+
114
+ with SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/geotiff.tiff') as spio:
115
+ dataset = gdal.Open(spio.copy_file())
116
+ band = dataset.GetRasterBand(1)
117
+ data = band.ReadAsArray()
118
+ print("data: ", data.shape)
119
+ # Close the dataset
120
+ del dataset
121
+ ```
122
+
123
+ - **Read GeoPackage**:
124
+
125
+ ```python
126
+ from marvin.tools.spio import SPIO
127
+ import geopandas as gpd
128
+
129
+ gdf = gpd.read_file(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/geopackage.gpkg'))
130
+ print("gdf: ", gdf)
131
+ ```
132
+
133
+ - **Read NetCDF (h5netcdf)**:
134
+
135
+ ```python
136
+ from marvin.tools.spio import SPIO
137
+ import xarray as xr
138
+
139
+ ds = xr.load_dataset(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/netcdf.nc')) # use engine='h5netcdf' if not detected correctly
140
+ print("ds: ", ds)
141
+ ```
142
+
143
+ - **Read NetCDF (netcdf4)**:
144
+
145
+ ```python
146
+ from marvin.tools.spio import SPIO
147
+ import xarray as xr
148
+
149
+ with SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/netcdf.nc') as spio:
150
+ ds = xr.load_dataset(spio.copy_file(), engine='netcdf4')
151
+ print("ds: ", ds)
152
+ ```
153
+
154
+ - **Read GRIB**:
155
+
156
+ ```python
157
+ from marvin.tools.spio import SPIO
158
+ import xarray as xr
159
+
160
+ with SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/grib.grb') as spio:
161
+ grb_ds = xr.load_dataset(spio.copy_file()) # engine='cfgrib'
162
+ print("grb_ds: ", grb_ds)
163
+ ```
164
+
165
+ - **Read Parquet**:
166
+
167
+ ```python
168
+ from marvin.tools.spio import SPIO
169
+ import pandas as pd
170
+
171
+ df = pd.read_parquet(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/data.parquet'))
172
+ print("df: ", df)
173
+ ```
174
+
175
+ - **Read CSV**:
176
+
177
+ ```python
178
+ from marvin.tools.spio import SPIO
179
+ import pandas as pd
180
+
181
+ df = pd.read_csv(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/data.csv'))
182
+ print(f"df: , df")
183
+
184
+ # read first lines
185
+ df_top = pd.read_csv(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/data.csv', read_chunks=SPIO.DEFAULT_CHUNK_SIZE), sep=';', nrows=10)
186
+ print(f"df_top: , df_top")
187
+ ```
188
+
189
+ - **Read Excel**:
190
+
191
+ ```python
192
+ from marvin.tools.spio import SPIO
193
+ import pandas as pd
194
+
195
+ df = pd.read_excel(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/data.xlsx'))
196
+ print("df: ", df)
197
+ ```
198
+
199
+
200
+ ### Writing Data
201
+
202
+ - **Write CSV**:
203
+
204
+ ```python
205
+ from marvin.tools.spio import SPIO
206
+ import pandas as pd
207
+
208
+ df = pd.read_csv('path/to/your/data.csv')
209
+ df.to_csv(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/data.csv'))
210
+ ```
211
+
212
+ - **Write Excel**:
213
+
214
+ ```python
215
+ from marvin.tools.spio import SPIO
216
+ import pandas as pd
217
+
218
+ df = pd.read_csv('path/to/your/data.csv')
219
+ df.to_excel(SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/data.xlsx'), engine='xlsxwriter')
220
+ ```
221
+
222
+ - **Write Text**:
223
+
224
+ ```python
225
+ from marvin.tools.spio import SPIO
226
+
227
+ with SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/data.txt') as spio:
228
+ spio.write_lines(['Hello, SPIO!'])
229
+ ```
230
+
231
+
232
+ - **Write GeoTiff**:
233
+
234
+ ```python
235
+ from marvin.tools.spio import SPIO
236
+ import rasterio
237
+
238
+ with rasterio.open('path/to/your/map.tiff') as src:
239
+ data = src.read()[0]
240
+ profile = src.profile
241
+
242
+ with SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/map.tiff') as spio: # rasterio will not flush or close the SPIO file, so we need to do it ourselves
243
+ with rasterio.open(spio, 'w', **profile) as dst:
244
+ dst.write(data, 1)
245
+ ```
246
+
247
+
248
+ - **Write GeoPackage Fiona**:
249
+
250
+ ```python
251
+ from marvin.tools.spio import SPIO
252
+ import geopandas as gpd
253
+
254
+ gdf = gpd.read_file('path/to/your/geopackage.gpkg')
255
+
256
+ with SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/geopackage.gpkg') as spio: # fiona will not flush or close the IO-object, so we need to do it ourselves
257
+ gdf.to_file(spio, layer='mylayer', driver='GPKG', engine='fiona')
258
+ ```
259
+
260
+ - **Write GeoPackage Fiona**:
261
+
262
+ ```python
263
+ from marvin.tools.spio import SPIO
264
+ import geopandas as gpd
265
+
266
+ gdf = gpd.read_file('path/to/your/geopackage.gpkg')
267
+
268
+ with SPIO('https://yourdomain.sharepoint.com/:i:/r/sites/your-site/path/to/your/geopackage.gpkg') as spio: # pyogrio will not flush the IO-object
269
+ gdf.to_file(spio.io_delegate(), layer='mylayer', driver='GPKG', engine='pyogrio') # pyogrio can only write to a real BytesIO object.
270
+ ```
271
+
272
+ ### Additional Functionalities
273
+
274
+ Spio also provides additional functions to handle different data formats and processes.
275
+ You can explore these in the https://git.vito.be/projects/MARVIN/repos/sharepoint_tools/browse/test/tst_spio.py.
276
+
277
+
278
+ ## Contributing
279
+
280
+ If you want to contribute to spio, please follow the standard contributing guidelines and push your changes to a new branch in
281
+ https://git.vito.be/projects/MARVIN/repos/sharepoint_tools
282
+
283
+ ## License
284
+
285
+ This project is licensed under the MIT License - see the LICENSE.md file for details.
286
+
@@ -0,0 +1,7 @@
1
+ src/marvin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
+ src/marvin/tools/default_config.ini,sha256=9uNt8Vz7Si2-Gf3mLRBGigT09eAtezbySikb-3OJgbE,320
3
+ src/marvin/tools/spio.py,sha256=r8yiidpaSpfbxVub76V_V666qzpRzG_YRC5xQNUAqHs,49159
4
+ spio-0.0.7.dist-info/LICENSE.md,sha256=GEfg4GmBQu1DR8FEGp-oHI-93USx2LvNXjZH-ZF1nX8,1035
5
+ spio-0.0.7.dist-info/METADATA,sha256=4tyFehpzOKZjL7Xww9uN6TGMb2JHez_eouqmR9xO8U8,8087
6
+ spio-0.0.7.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
+ spio-0.0.7.dist-info/RECORD,,
@@ -1,157 +0,0 @@
1
- Metadata-Version: 2.1
2
- Name: spio
3
- Version: 0.0.6.post12
4
- Summary: Magical Marvin SharePoint Library
5
- Author: Roeland Maes
6
- Author-email: roeland.maes@vito.be
7
- Requires-Python: >=3.10,<4.0
8
- Classifier: Programming Language :: Python :: 3
9
- Classifier: Programming Language :: Python :: 3.10
10
- Classifier: Programming Language :: Python :: 3.11
11
- Classifier: Programming Language :: Python :: 3.12
12
- Provides-Extra: full
13
- Provides-Extra: pandas
14
- Provides-Extra: pandas-parquet
15
- Provides-Extra: pandas-xlsx
16
- Requires-Dist: Office365-REST-Python-Client (>=2.3,<3.0)
17
- Requires-Dist: msal_extensions (>=0.3,<0.4)
18
- Description-Content-Type: text/markdown
19
-
20
-
21
- # Spio
22
-
23
- ## Description
24
-
25
- Spio is a Python package that provides functionalities for reading and writing data to a SharePoint.
26
- It can also handle various types of spatial and non-spatial data formats such as GeoTIFF, GeoPackage, NetCDF, CSV, Excel, and more.
27
-
28
- ## Installation
29
-
30
- To install the package, you can use the following command:
31
-
32
- ```bash
33
- pip config set global.extra-index-url https://repo.vito.be/artifactory/api/pypi/marvin-projects-pypi-local/simple
34
- pip install spio
35
- ```
36
-
37
- If you want to install the package with all the dependencies, you can use the following command:
38
-
39
- ```bash
40
- pip install spio[full]
41
- ```
42
-
43
- ## Building from Source
44
-
45
- To build the package from source you can use the following commands:
46
-
47
- ```bash
48
- git clone https://git.vito.be/projects/MARVIN/repos/sharepoint_tools
49
- cd sharepoint_tools
50
- conda create -f conda_env.yml
51
- conda activate spio
52
- poetry install
53
- ```
54
-
55
- ## Configuration
56
-
57
- Before using the package, you need to configure the settings to match your environment.
58
- The configuration is managed through a `settings` module which should include all the necessary configurations.
59
-
60
- ### **Settings Configuration**:
61
- Ensure you have a `settings` file (e.g., `.secrets.yaml` or `settings.yaml`) that provides the necessary configuration options. Example:
62
-
63
- ```python
64
- from dynaconf import Dynaconf
65
-
66
- settings = Dynaconf(
67
- settings_files=['settings.yaml', '.secrets.yaml']
68
- )
69
- ```
70
-
71
- The settings file should include the following configurations:
72
-
73
- ```yaml
74
- user_account: your.name@vito.be
75
- ```
76
-
77
- ### **Initialize Spio with Settings**:
78
- You need to initialize Spio with your settings before using any functionalities.
79
-
80
- ```python
81
- from config import settings
82
- from marvin.tools import spio
83
-
84
- spio.init_spio(settings)
85
- ```
86
-
87
- ## Usage
88
-
89
- Here are some example usages of the package:
90
-
91
- ### Reading Data
92
-
93
- - **Read GeoTIFF using Rasterio**:
94
-
95
- ```python
96
- from marvin.tools.spio import read_geotiff_rasterio
97
-
98
- geotiff_data = read_geotiff_rasterio('path/to/your/geotiff/file.tif')
99
- ```
100
-
101
- - **Read GeoPackage**:
102
-
103
- ```python
104
- from marvin.tools.spio import read_geopackage
105
-
106
- geopackage_data = read_geopackage('path/to/your/geopackage/file.gpkg')
107
- ```
108
-
109
- - **Read NetCDF**:
110
-
111
- ```python
112
- from marvin.tools.spio import read_netcdf
113
-
114
- netcdf_data = read_netcdf('path/to/your/netcdf/file.nc')
115
- ```
116
-
117
- - **Read CSV**:
118
-
119
- ```python
120
- from marvin.tools.spio import read_csv
121
-
122
- csv_data = read_csv('path/to/your/csv/file.csv')
123
- ```
124
-
125
- ### Writing Data
126
-
127
- - **Write CSV**:
128
-
129
- ```python
130
- from marvin.tools.spio import write_csv
131
-
132
- write_csv('path/to/your/output/file.csv', csv_data)
133
- ```
134
-
135
- - **Write Excel**:
136
-
137
- ```python
138
- from marvin.tools.spio import write_excel
139
-
140
- write_excel('path/to/your/output/file.xlsx', excel_data)
141
- ```
142
-
143
- ### Additional Functionalities
144
-
145
- Spio also provides additional functions to handle different data formats and processes.
146
- You can explore these in the https://git.vito.be/projects/MARVIN/repos/sharepoint_tools/browse/test/tst_spio.py file for more complex scenarios such as writing to OneDrive, processing NetCDF4 files, and more.
147
-
148
-
149
- ## Contributing
150
-
151
- If you want to contribute to spio, please follow the standard contributing guidelines and push your changes to a new branch in
152
- https://git.vito.be/projects/MARVIN/repos/sharepoint_tools
153
-
154
- ## License
155
-
156
- This project is licensed under the MIT License - see the LICENSE.md file for details.
157
-
@@ -1,7 +0,0 @@
1
- src/marvin/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
- src/marvin/tools/default_config.ini,sha256=9uNt8Vz7Si2-Gf3mLRBGigT09eAtezbySikb-3OJgbE,320
3
- src/marvin/tools/spio.py,sha256=r8yiidpaSpfbxVub76V_V666qzpRzG_YRC5xQNUAqHs,49159
4
- spio-0.0.6.post12.dist-info/LICENSE.md,sha256=GEfg4GmBQu1DR8FEGp-oHI-93USx2LvNXjZH-ZF1nX8,1035
5
- spio-0.0.6.post12.dist-info/METADATA,sha256=icnxaqk8pUHUosbJqP59M4KQme7qXzToH1KAV10DxBo,4051
6
- spio-0.0.6.post12.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
7
- spio-0.0.6.post12.dist-info/RECORD,,