rok4 2.1.5__tar.gz → 2.2.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.
Files changed (33) hide show
  1. {rok4-2.1.5 → rok4-2.2.3}/PKG-INFO +18 -1
  2. {rok4-2.1.5 → rok4-2.2.3}/README.md +27 -0
  3. rok4-2.2.3/README.pypi.md +44 -0
  4. {rok4-2.1.5 → rok4-2.2.3}/pyproject.toml +1 -1
  5. rok4-2.2.3/src/rok4/__init__.py +1 -0
  6. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/storage.py +18 -4
  7. rok4-2.2.3/src/rok4/style.py +542 -0
  8. {rok4-2.1.5 → rok4-2.2.3}/src/rok4.egg-info/PKG-INFO +18 -1
  9. {rok4-2.1.5 → rok4-2.2.3}/src/rok4.egg-info/SOURCES.txt +2 -0
  10. rok4-2.2.3/tests/test_style.py +480 -0
  11. rok4-2.1.5/README.pypi.md +0 -27
  12. rok4-2.1.5/src/rok4/__init__.py +0 -1
  13. {rok4-2.1.5 → rok4-2.2.3}/LICENSE.txt +0 -0
  14. {rok4-2.1.5 → rok4-2.2.3}/setup.cfg +0 -0
  15. {rok4-2.1.5 → rok4-2.2.3}/setup.py +0 -0
  16. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/enums.py +0 -0
  17. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/exceptions.py +0 -0
  18. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/layer.py +0 -0
  19. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/pyramid.py +0 -0
  20. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/raster.py +0 -0
  21. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/tile_matrix_set.py +0 -0
  22. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/utils.py +0 -0
  23. {rok4-2.1.5 → rok4-2.2.3}/src/rok4/vector.py +0 -0
  24. {rok4-2.1.5 → rok4-2.2.3}/src/rok4.egg-info/dependency_links.txt +0 -0
  25. {rok4-2.1.5 → rok4-2.2.3}/src/rok4.egg-info/requires.txt +0 -0
  26. {rok4-2.1.5 → rok4-2.2.3}/src/rok4.egg-info/top_level.txt +0 -0
  27. {rok4-2.1.5 → rok4-2.2.3}/tests/test_layer.py +0 -0
  28. {rok4-2.1.5 → rok4-2.2.3}/tests/test_pyramid.py +0 -0
  29. {rok4-2.1.5 → rok4-2.2.3}/tests/test_raster.py +0 -0
  30. {rok4-2.1.5 → rok4-2.2.3}/tests/test_storage.py +0 -0
  31. {rok4-2.1.5 → rok4-2.2.3}/tests/test_tile_matrix_set.py +0 -0
  32. {rok4-2.1.5 → rok4-2.2.3}/tests/test_utils.py +0 -0
  33. {rok4-2.1.5 → rok4-2.2.3}/tests/test_vector.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rok4
3
- Version: 2.1.5
3
+ Version: 2.2.3
4
4
  Summary: Python core libraries for ROK4 project
5
5
  Author-email: Géoportail IGN Developers <tout_rdev@ign.fr>
6
6
  License:
@@ -580,4 +580,21 @@ except Exception as exc:
580
580
  print(exc)
581
581
  ```
582
582
 
583
+ Following environment variables could be used, by module :
584
+
585
+ * `storage` : more details in the module developer documentation
586
+ * `ROK4_READING_LRU_CACHE_SIZE` : Cache size (0 for no limit)
587
+ * `ROK4_READING_LRU_CACHE_TTL` : Cache validity time (0 for no limit)
588
+ * `ROK4_CEPH_CONFFILE` : Ceph configuration file
589
+ * `ROK4_CEPH_USERNAME` : Ceph cluster user
590
+ * `ROK4_CEPH_CLUSTERNAME` : Ceph cluster name
591
+ * `ROK4_S3_KEY` : Key(s) for S3 server(s)
592
+ * `ROK4_S3_SECRETKEY` : Secret key(s) for S3 server(s)
593
+ * `ROK4_S3_URL` : URL(s) for S3 server(s)
594
+ * `ROK4_SSL_NO_VERIFY` : Disable SSL conrols for S3 access (any non empty value)
595
+ * `tile_matrix_set` :
596
+ * `ROK4_TMS_DIRECTORY` : Root directory (file or object) for tile matrix sets
597
+ * `style` :
598
+ * `ROK4_STYLES_DIRECTORY` : Root directory (file or object) for styles
599
+
583
600
  More examples in the developer documentation
@@ -27,6 +27,33 @@ except Exception as exc:
27
27
  print(exc)
28
28
  ```
29
29
 
30
+ Les variables d'environnement suivantes peuvent être nécessaires, par module :
31
+
32
+ * `storage` : plus de détails dans la documentation technique du module
33
+ * `ROK4_READING_LRU_CACHE_SIZE` : Nombre d'élément dans le cache de lecture (0 pour ne pas avoir de limite)
34
+ * `ROK4_READING_LRU_CACHE_TTL` : Durée de validité d'un élément du cache, en seconde (0 pour ne pas avoir de limite)
35
+ * `ROK4_CEPH_CONFFILE` : Fichier de configuration du cluster Ceph
36
+ * `ROK4_CEPH_USERNAME` : Compte d'accès au cluster Ceph
37
+ * `ROK4_CEPH_CLUSTERNAME` : Nom du cluster Ceph
38
+ * `ROK4_S3_KEY` : Clé(s) de(s) serveur(s) S3
39
+ * `ROK4_S3_SECRETKEY` : Clé(s) secrète(s) de(s) serveur(s) S3
40
+ * `ROK4_S3_URL` : URL de(s) serveur(s) S3
41
+ * `ROK4_SSL_NO_VERIFY` : Désactivation de la vérification SSL pour les accès S3 (n'importe quelle valeur non vide)
42
+ * `tile_matrix_set` :
43
+ * `ROK4_TMS_DIRECTORY` : Dossier racine (fichier ou objet) des tile matrix sets
44
+ * `style` :
45
+ * `ROK4_STYLES_DIRECTORY` : Dossier racine (fichier ou objet) des styles
46
+
47
+ Readings uses a LRU cache system with a TTL. It's possible to configure it with environment variables :
48
+ - ROK4_READING_LRU_CACHE_SIZE : Number of cached element. Default 64. Set 0 or a negative integer to configure a cache without bound. A power of two make cache more efficient.
49
+ - ROK4_READING_LRU_CACHE_TTL : Validity duration of cached element, in seconds. Default 300. 0 or negative integer to get cache without expiration date.
50
+
51
+ To disable cache (always read data on storage), set ROK4_READING_LRU_CACHE_SIZE to 1 and ROK4_READING_LRU_CACHE_TTL to 1.
52
+
53
+ Using CEPH storage requires environment variables :
54
+
55
+ Using S3 storage requires environment variables :
56
+
30
57
  Plus d'exemple dans la documentation développeur.
31
58
 
32
59
 
@@ -0,0 +1,44 @@
1
+ # ROK4 Python libraries
2
+
3
+ ![ROK4 Logo](https://rok4.github.io/assets/images/rok4.png)
4
+
5
+ The `rok4` package help to use [ROK4 project](https://rok4.github.io/) concepts, like Tile Matrix Sets, data pyramids or layers.
6
+
7
+ ## Installation
8
+
9
+ Required system packages :
10
+ * debian : `apt install python3-rados python3-gdal`
11
+
12
+ The `rok4` package is available on :
13
+ * [PyPI](https://pypi.org/project/rok4/) : `pip install rok4`
14
+ * [GitHub](https://github.com/rok4/core-python/releases/) : `pip install https://github.com/rok4/core-python/releases/download/<version>/rok4-<version>-py3-none-any.whl`
15
+
16
+ ## Usage
17
+
18
+ ```python
19
+ from rok4.tile_matrix_set import TileMatrixSet
20
+
21
+ try:
22
+ tms = TileMatrixSet("file:///path/to/tms.json")
23
+ except Exception as exc:
24
+ print(exc)
25
+ ```
26
+
27
+ Following environment variables could be used, by module :
28
+
29
+ * `storage` : more details in the module developer documentation
30
+ * `ROK4_READING_LRU_CACHE_SIZE` : Cache size (0 for no limit)
31
+ * `ROK4_READING_LRU_CACHE_TTL` : Cache validity time (0 for no limit)
32
+ * `ROK4_CEPH_CONFFILE` : Ceph configuration file
33
+ * `ROK4_CEPH_USERNAME` : Ceph cluster user
34
+ * `ROK4_CEPH_CLUSTERNAME` : Ceph cluster name
35
+ * `ROK4_S3_KEY` : Key(s) for S3 server(s)
36
+ * `ROK4_S3_SECRETKEY` : Secret key(s) for S3 server(s)
37
+ * `ROK4_S3_URL` : URL(s) for S3 server(s)
38
+ * `ROK4_SSL_NO_VERIFY` : Disable SSL conrols for S3 access (any non empty value)
39
+ * `tile_matrix_set` :
40
+ * `ROK4_TMS_DIRECTORY` : Root directory (file or object) for tile matrix sets
41
+ * `style` :
42
+ * `ROK4_STYLES_DIRECTORY` : Root directory (file or object) for styles
43
+
44
+ More examples in the developer documentation
@@ -1,7 +1,7 @@
1
1
  [project]
2
2
 
3
3
  name = "rok4"
4
- version = "2.1.5"
4
+ version = "2.2.3"
5
5
 
6
6
  description = "Python core libraries for ROK4 project"
7
7
  readme = "README.pypi.md"
@@ -0,0 +1 @@
1
+ __version__ = "2.2.3"
@@ -1,6 +1,7 @@
1
1
  """Provide functions to read or write data
2
2
 
3
3
  Available storage types are :
4
+
4
5
  - S3 (path are preffixed with `s3://`)
5
6
  - CEPH (path are prefixed with `ceph://`)
6
7
  - FILE (path are prefixed with `file://`, but it is the default paths' interpretation)
@@ -10,17 +11,20 @@ Available storage types are :
10
11
  According to functions, all storage types are not necessarily available.
11
12
 
12
13
  Readings uses a LRU cache system with a TTL. It's possible to configure it with environment variables :
14
+
13
15
  - ROK4_READING_LRU_CACHE_SIZE : Number of cached element. Default 64. Set 0 or a negative integer to configure a cache without bound. A power of two make cache more efficient.
14
16
  - ROK4_READING_LRU_CACHE_TTL : Validity duration of cached element, in seconds. Default 300. 0 or negative integer to get cache without expiration date.
15
17
 
16
18
  To disable cache (always read data on storage), set ROK4_READING_LRU_CACHE_SIZE to 1 and ROK4_READING_LRU_CACHE_TTL to 1.
17
19
 
18
20
  Using CEPH storage requires environment variables :
21
+
19
22
  - ROK4_CEPH_CONFFILE
20
23
  - ROK4_CEPH_USERNAME
21
24
  - ROK4_CEPH_CLUSTERNAME
22
25
 
23
26
  Using S3 storage requires environment variables :
27
+
24
28
  - ROK4_S3_KEY
25
29
  - ROK4_S3_SECRETKEY
26
30
  - ROK4_S3_URL
@@ -48,9 +52,21 @@ from typing import Dict, Tuple, Union
48
52
  import boto3
49
53
  import botocore.exceptions
50
54
  import requests
51
- from osgeo import gdal
52
55
 
53
56
  # conditional import
57
+
58
+ try:
59
+ from osgeo import gdal
60
+
61
+ # Enable GDAL/OGR exceptions
62
+ gdal.UseExceptions()
63
+
64
+ GDAL_AVAILABLE: bool = True
65
+ except ImportError:
66
+ GDAL_AVAILABLE: bool = False
67
+ gdal = None
68
+
69
+
54
70
  try:
55
71
  import rados
56
72
 
@@ -65,8 +81,6 @@ from rok4.exceptions import MissingEnvironmentError, StorageError
65
81
 
66
82
  # -- GLOBALS --
67
83
 
68
- # Enable GDAL/OGR exceptions
69
- gdal.UseExceptions()
70
84
 
71
85
  __CEPH_CLIENT = None
72
86
  __CEPH_IOCTXS = {}
@@ -1067,7 +1081,7 @@ def get_osgeo_path(path: str) -> str:
1067
1081
 
1068
1082
  storage_type, unprefixed_path, tray_name, base_name = get_infos_from_path(path)
1069
1083
 
1070
- if storage_type == StorageType.S3:
1084
+ if storage_type == StorageType.S3 and GDAL_AVAILABLE:
1071
1085
  s3_client, bucket_name = __get_s3_client(tray_name)
1072
1086
 
1073
1087
  gdal.SetConfigOption("AWS_SECRET_ACCESS_KEY", s3_client["secret_key"])