Coverage for gws-app/gws/plugin/__init__.py: 100%

0 statements  

« prev     ^ index     » next       coverage.py v7.16.2, created at 2026-10-05 13:35 +0200

1"""Built-in plugins. 

2 

3Plugins provide the concrete object types of GBD WebSuite: layer types, auth 

4methods and providers, model fields, templates, OWS services and so on. Each 

5plugin is a package that subclasses the base classes from ``gws.base`` and 

6registers its classes with the ``gws.ext`` decorators, for example 

7``@gws.ext.object.layer('tile')`` together with 

8``@gws.ext.config.layer('tile')``. The registered name is the ``type`` used in 

9the configuration. 

10 

11Plugins are not imported by other code. The spec generator scans every 

12directory under ``gws/plugin`` (and the plugin directories listed in the 

13application manifest) and records the extension classes in the specs. When 

14the configuration refers to an extension type, the class is looked up in the 

15specs and its module is imported on demand. A plugin can also contain client 

16code in a ``js`` directory, which is built into the client bundle; some 

17plugins (``identify_tool``, ``location_tool``) are client-only and have no 

18Python code. 

19 

20Plugins import from ``gws.base`` and the lower layers, and from other plugins 

21where one builds on another (for example ``gekos`` uses ``alkis``, and 

22``alkis`` and ``qgis`` use ``postgres``). 

23 

24Subpackages: 

25 

26Authentication 

27 

28- ``account``: user accounts stored in a database table, with administration and onboarding. 

29- ``auth_method``: authentication methods (``web``, ``basic``, ``token``). 

30- ``auth_mfa``: multi-factor authentication adapters. 

31- ``auth_provider``: authentication providers. 

32- ``auth_session_manager``: session managers. 

33 

34Data sources and layers 

35 

36- ``geojson``: GeoJSON support. 

37- ``mbtiles_layer``: MBTiles layer. 

38- ``ows_client``: clients for remote OGC web services (WMS, WMTS, WFS). 

39- ``postgres``: PostgreSQL/PostGIS provider, layers, models and finders. 

40- ``qgis``: QGIS projects as sources for layers, search, models, legends and print templates. 

41- ``raster_layer``: raster layers from georeferenced image files. 

42- ``tile_layer``: tile layers from XYZ tile services. 

43 

44Models 

45 

46- ``model_field``: model field types. 

47- ``model_validator``: model validators. 

48- ``model_value``: model values. 

49- ``model_widget``: model widgets. 

50 

51Output and services 

52 

53- ``exporter``: feature exporters to vector file formats. 

54- ``legend``: legend types. 

55- ``ows_server``: OGC web services (WMS, WMTS, WFS, CSW) provided by GBD WebSuite. 

56- ``template``: template types. 

57 

58Search 

59 

60- ``gbd_geoservices``: GBD Geoservices search. 

61- ``nominatim``: place and address search with Nominatim. 

62 

63Client tools 

64 

65- ``annotate_tool``: annotate tool. 

66- ``dimension``: dimension tool. 

67- ``identify_tool``: identify tool (client only). 

68- ``location_tool``: shows the user's location from the browser geolocation (client only). 

69- ``mapshare``: map share tool. 

70- ``select_tool``: feature selection tool. 

71 

72Helpers and storage 

73 

74- ``csv_helper``: CSV helper. 

75- ``email_helper``: email helper. 

76- ``storage_provider``: storage providers for data saved by users. 

77- ``upload_helper``: helper for chunked file uploads. 

78- ``xml_helper``: helper for custom XML namespaces. 

79 

80Administration 

81 

82- ``admin_action``: administration pages (object inspector, cache viewer). 

83 

84Applications 

85 

86- ``alkis``: ALKIS cadastre search. 

87- ``gekos``: GekoS-Bau integration. 

88- ``qfieldcloud``: QField Cloud plugin. 

89 

90Example:: 

91 

92 import gws 

93 import gws.base.layer 

94 

95 @gws.ext.config.layer('my') 

96 class Config(gws.base.layer.Config): 

97 pass 

98 

99 @gws.ext.object.layer('my') 

100 class Object(gws.base.layer.image.Object): 

101 def configure(self): 

102 self.configure_layer() 

103 

104Configuration example, using plugin types:: 

105 

106 auth.providers+ { type "file" path "/data/passwd.json" } 

107 

108 map.layers+ { 

109 type "tile" 

110 provider.url "https://tile.openstreetmap.org/{z}/{x}/{y}.png" 

111 } 

112"""