diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 86c0e98df..d8f4730f4 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,3 +1,13 @@ +ci: + autoupdate_schedule: quarterly + skip: + - copyright + - poetry-check + - poetry-lock + - ripsecrets + - jsonschema-gentypes + - jsonschema2md + repos: - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.7.1 @@ -18,6 +28,24 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - id: mixed-line-ending + - repo: https://github.com/camptocamp/jsonschema-gentypes + rev: 1.6.0 + hooks: + - id: jsonschema-gentypes + files: |- + (?x)( + ĵsonschema-gentypes.yaml$ + |^tilecloud_chain/schema\.json$ + ) + - repo: https://github.com/sbrunner/jsonschema2md2 + rev: 0.7.0 + hooks: + - id: jsonschema2md + files: tilecloud_chain/schema\.json + args: + - --pre-commit + - tilecloud_chain/schema.json + - tilecloud_chain/CONFIG.md - repo: https://github.com/sbrunner/hooks rev: 0.5.0 hooks: @@ -89,10 +117,3 @@ repos: - --tool=pydocstyle - --die-on-tool-error - --output-format=pylint -ci: - autoupdate_schedule: quarterly - skip: - - copyright - - poetry-check - - poetry-lock - - ripsecrets diff --git a/MANIFEST.in b/MANIFEST.in deleted file mode 100644 index 71a2a3817..000000000 --- a/MANIFEST.in +++ /dev/null @@ -1,14 +0,0 @@ -include README.md -include CHANGES.md -include tilecloud_chain/USAGE.rst -include requirements.txt -include production.ini -recursive-include tilecloud_chain/scaffolds/create * -include tilecloud_chain/OpenLayers.js -include tilecloud_chain/OpenLayers-style.css -include tilecloud_chain/layer-switcher-maximize.png -include tilecloud_chain/layer-switcher-minimize.png -include tilecloud_chain/openlayer.js -include tilecloud_chain/openlayer.html -include tilecloud_chain/*.jinja -include tilecloud_chain/schema.json diff --git a/Makefile b/Makefile index 90f9f2f7c..8ca29f355 100644 --- a/Makefile +++ b/Makefile @@ -57,7 +57,3 @@ tests-fast: done docker-compose exec -T test pytest -vv --color=yes --exitfirst #--last-failed - -PHONY: jsonschema -jsonschema: ## Generate the files related to the JSON schema - jsonschema-gentypes diff --git a/jsonschema-gentypes.yaml b/jsonschema-gentypes.yaml index 9cc658ccc..eb0752d45 100644 --- a/jsonschema-gentypes.yaml +++ b/jsonschema-gentypes.yaml @@ -2,12 +2,12 @@ headers: | """ Automatically generated file from a JSON schema. """ -callbacks: - - - pyupgrade - - --py38-plus - - --exit-zero-even-if-changed - - - black - - - isort + +pre_commit: + enabled: true + arguments: + - --color=never + generate: - source: tilecloud_chain/schema.json destination: tilecloud_chain/configuration.py diff --git a/pyproject.toml b/pyproject.toml index 0eb319925..f00468ab2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ classifiers = [ "Topic :: Scientific/Engineering :: GIS", "Typing :: Typed", ] -include = ["tilecloud_chain/py.typed"] +include = ["tilecloud_chain/py.typed", "tilecloud_chain/*.rst", "tilecloud_chain/*.md"] [tool.poetry.scripts] generate-tiles = "tilecloud_chain.generate:main" diff --git a/tilecloud_chain/CONFIG.md b/tilecloud_chain/CONFIG.md new file mode 100644 index 000000000..bdfb29bb2 --- /dev/null +++ b/tilecloud_chain/CONFIG.md @@ -0,0 +1,342 @@ +# TileCloud-chain configuration + +## Properties + +- **`defaults`** _(object)_: Used to put YAML references. +- **`grids`** _(object)_: The WMTS grid definitions by grid name, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-grids. Can contain additional properties. + - **Additional Properties**: Refer to _[#/definitions/grid](#definitions/grid)_. +- **`caches`** _(object)_: The tiles caches definitions by name, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-caches. Can contain additional properties. + - **Additional Properties**: Refer to _[#/definitions/cache](#definitions/cache)_. +- **`layers`** _(object)_: The layers definitions by name, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-layers. Can contain additional properties. + - **Additional Properties**: Refer to _[#/definitions/layer](#definitions/layer)_. +- **`process`** _(object)_: List of available commands by name, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#process. Can contain additional properties. + - **Additional Properties**: Refer to _[#/definitions/process](#definitions/process)_. +- **`generation`**: Refer to _[#/definitions/generation](#definitions/generation)_. +- **`sqs`** _(object)_: The Simple Queue Service configuration. Cannot contain additional properties. + - **`queue`** _(string)_: The queue name, default is 'tilecloud'. + - **`region`**: Refer to _[#/definitions/aws_region](#definitions/aws_region)_. +- **`sns`** _(object)_: The Simple Notification Service configuration, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-sns. Cannot contain additional properties. + - **`topic`** _(string)_: The topic. + - **`region`**: Refer to _[#/definitions/aws_region](#definitions/aws_region)_. +- **`redis`**: Refer to _[#/definitions/redis](#definitions/redis)_. +- **`openlayers`** _(object)_: Configuration used to generate the OpenLayers example page. Cannot contain additional properties. + - **`srs`** _(string)_: The projection code. Default: `"EPSG:2056"`. + - **`proj4js_def`** _(string)_: The proj4js definition, get it from https://epsg.io/. Default: `"+proj=somerc +lat_0=46.95240555555556 +lon_0=7.439583333333333 +k_0=1 +x_0=2600000 +y_0=1200000 +ellps=bessel +towgs84=674.374,15.056,405.346,0,0,0,0 +units=m +no_defs"`. + - **`center_x`** _(number)_: The center easting. Default: `2600000`. + - **`center_y`** _(number)_: The center northing. Default: `1200000`. + - **`zoom`** _(number)_: The initial zoom. Default: `3`. +- **`server`**: Refer to _[#/definitions/server](#definitions/server)_. +- **`cost`**: Refer to _[#/definitions/cost](#definitions/cost)_. +- **`metadata`**: Refer to _[#/definitions/metadata](#definitions/metadata)_. +- **`provider`**: Refer to _[#/definitions/provider](#definitions/provider)_. +- **`logging`**: Refer to _[#/definitions/logging](#definitions/logging)_. +- **`authentication`** _(object)_: The authentication configuration. Cannot contain additional properties. + - **`github_repository`** _(string)_: The GitHub repository name, on witch one we will check the access rights. + - **`github_access_type`** _(string)_: The kind of rights the user should have on the repository. Must be one of: `["push", "pull", "admin"]`. Default: `"pull"`. + +## Definitions + +- **`headers`** _(object)_: The headers that we send to the WMS backend. Can contain additional properties. + - **Additional Properties** _(string)_: The header value. +- **`grid`** _(object)_: The WMTS grid definition, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-grids. Cannot contain additional properties. + - **`resolution_scale`** _(integer)_: The scale used to build a FreeTileGrid typically '2'. + - **`resolutions`** _(array)_: The resolutions in pixel per meter. + - **Items** _(number)_ + - **`bbox`** _(array)_: The bounding box in meter. + - **Items** _(number)_ + - **`srs`** _(string)_: The projection reference. + - **`proj4_literal`** _(string)_: The Proj4 definition. + - **`unit`** _(string)_: The projection unit, default is 'm'. Default: `"m"`. + - **`tile_size`** _(integer)_: The tile size in pixel, default is 256. Default: `256`. + - **`matrix_identifier`** _(string)_: The identifier to use in the tiles URL, recommend to be resolution (default). Must be one of: `["zoom", "resolution"]`. Default: `"zoom"`. +- **`cache_wmtscapabilities_file`** _(string)_: The generated WMTS capabilities file name (by 'default 1.0.0/WMTSCapabilities.xml'). +- **`cache_http_url`** _(string)_: The HTTP URL %host will be replaces by one of the hosts. +- **`cache_hosts`** _(array)_: The host used to build the HTTP URLs. + - **Items** _(string)_ +- **`cache_http_urls`** _(array)_ + - **Items** _(string)_ +- **`cache_folder`** _(string)_: The root folder of the cache, default is ''. Default: `""`. +- **`cache_filesystem`** _(object)_: Can contain additional properties. + - **Additional Properties** _(string)_ + - **`type`** + - **`wmtscapabilities_file`**: Refer to _[#/definitions/cache_wmtscapabilities_file](#definitions/cache_wmtscapabilities_file)_. + - **`http_url`**: Refer to _[#/definitions/cache_http_url](#definitions/cache_http_url)_. + - **`hosts`**: Refer to _[#/definitions/cache_hosts](#definitions/cache_hosts)_. + - **`http_urls`**: Refer to _[#/definitions/cache_http_urls](#definitions/cache_http_urls)_. + - **`folder`**: Refer to _[#/definitions/cache_folder](#definitions/cache_folder)_. +- **`cache_s3`** _(object)_: Can contain additional properties. + - **Additional Properties** _(string)_ + - **`type`** + - **`wmtscapabilities_file`**: Refer to _[#/definitions/cache_wmtscapabilities_file](#definitions/cache_wmtscapabilities_file)_. + - **`http_url`**: Refer to _[#/definitions/cache_http_url](#definitions/cache_http_url)_. + - **`hosts`**: Refer to _[#/definitions/cache_hosts](#definitions/cache_hosts)_. + - **`http_urls`**: Refer to _[#/definitions/cache_http_urls](#definitions/cache_http_urls)_. + - **`tiles_url`** _(string)_: The template tiles URL on S3, the argument can be region, bucket and folder (default is 'http://s3-{region}.amazonaws.com/{bucket}/{folder}'). + - **`host`** _(string)_: The S3 host, default is 's3-eu-west-1.amazonaws.com'. + - **`bucket`** _(string)_: The S3 bucker name. + - **`region`**: Refer to _[#/definitions/aws_region](#definitions/aws_region)_. + - **`cache_control`** _(string)_: The Cache-Control used to store tiles on S3. + - **`folder`**: Refer to _[#/definitions/cache_folder](#definitions/cache_folder)_. +- **`cache_azure`** _(object)_: Azure Blob Storage. Can contain additional properties. + - **Additional Properties** _(string)_ + - **`type`** + - **`wmtscapabilities_file`**: Refer to _[#/definitions/cache_wmtscapabilities_file](#definitions/cache_wmtscapabilities_file)_. + - **`http_url`**: Refer to _[#/definitions/cache_http_url](#definitions/cache_http_url)_. + - **`hosts`**: Refer to _[#/definitions/cache_hosts](#definitions/cache_hosts)_. + - **`http_urls`**: Refer to _[#/definitions/cache_http_urls](#definitions/cache_http_urls)_. + - **`folder`**: Refer to _[#/definitions/cache_folder](#definitions/cache_folder)_. + - **`container`** _(string)_: The Azure container name. + - **`cache_control`** _(string)_: The Cache-Control used to store tiles on Azure. +- **`cache_mbtiles`** _(object)_: Can contain additional properties. + - **Additional Properties** _(string)_ + - **`type`** + - **`wmtscapabilities_file`**: Refer to _[#/definitions/cache_wmtscapabilities_file](#definitions/cache_wmtscapabilities_file)_. + - **`http_url`**: Refer to _[#/definitions/cache_http_url](#definitions/cache_http_url)_. + - **`hosts`**: Refer to _[#/definitions/cache_hosts](#definitions/cache_hosts)_. + - **`http_urls`**: Refer to _[#/definitions/cache_http_urls](#definitions/cache_http_urls)_. + - **`folder`**: Refer to _[#/definitions/cache_folder](#definitions/cache_folder)_. +- **`cache_bsddb`** _(object)_: Can contain additional properties. + - **Additional Properties** _(string)_ + - **`type`** + - **`wmtscapabilities_file`**: Refer to _[#/definitions/cache_wmtscapabilities_file](#definitions/cache_wmtscapabilities_file)_. + - **`http_url`**: Refer to _[#/definitions/cache_http_url](#definitions/cache_http_url)_. + - **`hosts`**: Refer to _[#/definitions/cache_hosts](#definitions/cache_hosts)_. + - **`http_urls`**: Refer to _[#/definitions/cache_http_urls](#definitions/cache_http_urls)_. + - **`folder`**: Refer to _[#/definitions/cache_folder](#definitions/cache_folder)_. +- **`cache`**: The tiles cache definition, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-caches. + - **Any of** + - : Refer to _[#/definitions/cache_filesystem](#definitions/cache_filesystem)_. + - : Refer to _[#/definitions/cache_s3](#definitions/cache_s3)_. + - : Refer to _[#/definitions/cache_azure](#definitions/cache_azure)_. + - : Refer to _[#/definitions/cache_mbtiles](#definitions/cache_mbtiles)_. + - : Refer to _[#/definitions/cache_bsddb](#definitions/cache_bsddb)_. +- **`layer_title`** _(string)_: The title, use to generate the capabilities. +- **`layer_grid`** _(string)_: The used grid name. +- **`layer_bbox`** _(array)_: The bounding box where we will generate the tiles. + - **Items** _(number)_ +- **`layer_min_resolution_seed`** _(number)_: The minimum resolutions to pre-generate. +- **`layer_px_buffer`** _(integer)_: The buffer in pixel used to calculate geometry intersection, default is 0. Default: `0`. +- **`layer_meta`** _(boolean)_: Use meta-tiles, default is False, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#meta-tiles. Default: `false`. +- **`layer_meta_size`** _(integer)_: The meta-tile size in tiles, default is 5. +- **`layer_meta_buffer`** _(integer)_: The meta-tiles buffer in pixels, default is 128. +- **`layer_layers`** _(string)_: The WMS layers. +- **`layer_wmts_style`** _(string)_: The WMTS style. +- **`layer_mime_type`** _(string)_: The MIME type of the tiles. +- **`layer_extension`** _(string)_: The layer extension. +- **`layer_dimension_name`** _(string)_: The dimension name. +- **`layer_dimensions`** _(array)_: The WMTS dimensions. + - **Items** _(object)_: Cannot contain additional properties. + - **`name`**: Refer to _[#/definitions/layer_dimension_name](#definitions/layer_dimension_name)_. + - **`generate`** _(array)_: The values that should be generate. + - **Items** _(string)_ + - **`values`** _(array)_: The values present in the capabilities. + - **Items** _(string)_ + - **`default`** _(string)_: The default value present in the capabilities. +- **`layer_legends`** _(array)_: The provided legend. + - **Items** _(object)_: Cannot contain additional properties. + - **`mime_type`** _(string)_: The mime type used in the WMS request. + - **`href`** _(string)_: The URL of the legend image. + - **`width`** _(string)_: The width of the legend image. + - **`height`** _(string)_: The height of the legend image. + - **`min_scale`** _(string)_: The max scale of the legend image. + - **`max_scale`** _(string)_: The max scale of the legend image. + - **`min_resolution`** _(string)_: The max resolution of the legend image. + - **`max_resolution`** _(string)_: The max resolution of the legend image. +- **`layer_legend_mime`** _(string)_: The mime type used to store the generated legend. +- **`layer_legend_extension`** _(string)_: The extension used to store the generated legend. +- **`layer_pre_hash_post_process`** _(string)_: Do an image post process before the empty hash check. +- **`layer_post_process`** _(string)_: Do an image post process after the empty hash check. +- **`layer_geoms`** _(array)_: The geometries used to determine where we should create the tiles, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-geomsql. + - **Items** _(object)_: Cannot contain additional properties. + - **`connection`** _(string)_: The PostgreSQL connection string. + - **`sql`** _(string)_: The SQL query that get the geometry in geom e.g. 'the_geom AS geom FROM my_table'. + - **`min_resolution`** _(number)_: The min resolution where the query is valid. + - **`max_resolution`** _(number)_: The max resolution where the query is valid. +- **`layer_empty_tile_detection`** _(object)_: The rules used to detect the empty tiles, use `generate-tiles --get-hash` to get what we can use, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-hash. Cannot contain additional properties. + - **`size`** _(integer)_: The tile size. + - **`hash`** _(string)_: The tile hash. +- **`layer_empty_metatile_detection`** _(object)_: The rules used to detect the empty meta-tiles, use `generate-tiles --get-hash` to get what we can use, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-hash. Cannot contain additional properties. + - **`size`** _(integer)_: The meta-tile size. + - **`hash`** _(string)_: The meta-tile hash. +- **`layer_cost`** _(object)_: The rules used to calculate the cost. Cannot contain additional properties. + - **`tileonly_generation_time`** _(number)_: The time to generate a tile without meta-tile. Default: `40`. + - **`tile_generation_time`** _(number)_: The time to generate a tile from the meta-tile. Default: `30`. + - **`metatile_generation_time`** _(number)_: The time to generate a meta-tile. Default: `30`. + - **`tile_size`** _(number)_: The tile mean size in bytes. Default: `20`. +- **`layer_wms`** _(object)_: Cannot contain additional properties. + - **`type`** + - **`title`**: Refer to _[#/definitions/layer_title](#definitions/layer_title)_. + - **`grid`**: Refer to _[#/definitions/layer_grid](#definitions/layer_grid)_. + - **`bbox`**: Refer to _[#/definitions/layer_bbox](#definitions/layer_bbox)_. + - **`min_resolution_seed`**: Refer to _[#/definitions/layer_min_resolution_seed](#definitions/layer_min_resolution_seed)_. + - **`px_buffer`**: Refer to _[#/definitions/layer_px_buffer](#definitions/layer_px_buffer)_. + - **`meta`**: Refer to _[#/definitions/layer_meta](#definitions/layer_meta)_. + - **`meta_size`**: Refer to _[#/definitions/layer_meta_size](#definitions/layer_meta_size)_. Default: `5`. + - **`meta_buffer`**: Refer to _[#/definitions/layer_meta_buffer](#definitions/layer_meta_buffer)_. Default: `128`. + - **`layers`**: Refer to _[#/definitions/layer_layers](#definitions/layer_layers)_. + - **`wmts_style`**: Refer to _[#/definitions/layer_wmts_style](#definitions/layer_wmts_style)_. + - **`mime_type`**: Refer to _[#/definitions/layer_mime_type](#definitions/layer_mime_type)_. + - **`extension`**: Refer to _[#/definitions/layer_extension](#definitions/layer_extension)_. + - **`dimensions`**: Refer to _[#/definitions/layer_dimensions](#definitions/layer_dimensions)_. + - **`legends`**: Refer to _[#/definitions/layer_legends](#definitions/layer_legends)_. + - **`legend_mime`**: Refer to _[#/definitions/layer_legend_mime](#definitions/layer_legend_mime)_. + - **`legend_extension`**: Refer to _[#/definitions/layer_legend_extension](#definitions/layer_legend_extension)_. + - **`pre_hash_post_process`**: Refer to _[#/definitions/layer_pre_hash_post_process](#definitions/layer_pre_hash_post_process)_. + - **`post_process`**: Refer to _[#/definitions/layer_post_process](#definitions/layer_post_process)_. + - **`geoms`**: Refer to _[#/definitions/layer_geoms](#definitions/layer_geoms)_. + - **`empty_tile_detection`**: Refer to _[#/definitions/layer_empty_tile_detection](#definitions/layer_empty_tile_detection)_. + - **`empty_metatile_detection`**: Refer to _[#/definitions/layer_empty_metatile_detection](#definitions/layer_empty_metatile_detection)_. + - **`cost`**: Refer to _[#/definitions/layer_cost](#definitions/layer_cost)_. + - **`url`** _(string)_: The WMS service URL. + - **`generate_salt`** _(boolean)_: Should generate a salt to drop the cache, default is False. + - **`query_layers`** _(string)_: The layers use for query (To be used with the server). + - **`info_formats`** _(array)_: The query info format. + - **Items** _(string)_ + - **`params`** _(object)_: Additional parameters to the WMS query (like dimension). Can contain additional properties. + - **Additional Properties** _(string)_: The parameter value. + - **`headers`**: Refer to _[#/definitions/headers](#definitions/headers)_. + - **`version`** _(string)_: The used WMS version (default is '1.1.1'). +- **`layer_mapnik`** _(object)_: Cannot contain additional properties. + - **`type`** + - **`title`**: Refer to _[#/definitions/layer_title](#definitions/layer_title)_. + - **`grid`**: Refer to _[#/definitions/layer_grid](#definitions/layer_grid)_. + - **`bbox`**: Refer to _[#/definitions/layer_bbox](#definitions/layer_bbox)_. + - **`min_resolution_seed`**: Refer to _[#/definitions/layer_min_resolution_seed](#definitions/layer_min_resolution_seed)_. + - **`px_buffer`**: Refer to _[#/definitions/layer_px_buffer](#definitions/layer_px_buffer)_. + - **`meta`**: Refer to _[#/definitions/layer_meta](#definitions/layer_meta)_. + - **`meta_size`**: Refer to _[#/definitions/layer_meta_size](#definitions/layer_meta_size)_. Default: `1`. + - **`meta_buffer`**: Refer to _[#/definitions/layer_meta_buffer](#definitions/layer_meta_buffer)_. Default: `0`. + - **`layers`**: Refer to _[#/definitions/layer_layers](#definitions/layer_layers)_. Default: `"__all__"`. + - **`wmts_style`**: Refer to _[#/definitions/layer_wmts_style](#definitions/layer_wmts_style)_. + - **`mime_type`**: Refer to _[#/definitions/layer_mime_type](#definitions/layer_mime_type)_. + - **`extension`**: Refer to _[#/definitions/layer_extension](#definitions/layer_extension)_. + - **`dimensions`**: Refer to _[#/definitions/layer_dimensions](#definitions/layer_dimensions)_. + - **`legends`**: Refer to _[#/definitions/layer_legends](#definitions/layer_legends)_. + - **`legend_mime`**: Refer to _[#/definitions/layer_legend_mime](#definitions/layer_legend_mime)_. + - **`legend_extension`**: Refer to _[#/definitions/layer_legend_extension](#definitions/layer_legend_extension)_. + - **`pre_hash_post_process`**: Refer to _[#/definitions/layer_pre_hash_post_process](#definitions/layer_pre_hash_post_process)_. + - **`post_process`**: Refer to _[#/definitions/layer_post_process](#definitions/layer_post_process)_. + - **`geoms`**: Refer to _[#/definitions/layer_geoms](#definitions/layer_geoms)_. + - **`empty_tile_detection`**: Refer to _[#/definitions/layer_empty_tile_detection](#definitions/layer_empty_tile_detection)_. + - **`empty_metatile_detection`**: Refer to _[#/definitions/layer_empty_metatile_detection](#definitions/layer_empty_metatile_detection)_. + - **`cost`**: Refer to _[#/definitions/layer_cost](#definitions/layer_cost)_. + - **`mapfile`** _(string)_: The Mapnik map file. + - **`data_buffer`** _(integer)_: The data buffer, default is 128. + - **`output_format`** _(string)_: The Mapnik output format, default is 'png'. Must be one of: `["png", "png256", "jpeg", "grid"]`. + - **`wms_url`** _(string)_: A WMS fallback URL (deprecated). + - **`resolution`** _(integer)_: The resolution, default is 4. + - **`layers_fields`** _(object)_: The Mapnik layers fields. Can contain additional properties. + - **Additional Properties** _(array)_: The Mapnik layer fields. + - **Items** _(string)_ + - **`drop_empty_utfgrid`** _(boolean)_: Drop if the tile is empty, default is False. +- **`layer`**: The layer definition, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-layers. + - **Any of** + - : Refer to _[#definitions/layer_wms](#efinitions/layer_wms)_. + - : Refer to _[#definitions/layer_mapnik](#efinitions/layer_mapnik)_. +- **`process`** _(array)_: A command. + - **Items** _(object)_: Cannot contain additional properties. + - **`cmd`** _(string)_: The shell command, available parameters: %(in)s, %(out)s, %(args)s, %(x)s, %(y)s, %(z)s. + - **`need_out`** _(boolean)_: The command will generate an output in a file, default is False. Default: `false`. + - **`arg`** _(object)_: Used to build the %(args). Cannot contain additional properties. + - **`default`** _(string)_: The arguments used by default. + - **`verbose`** _(string)_: The arguments used on verbose mode. + - **`debug`** _(string)_: The arguments used on debug mode. + - **`quiet`** _(string)_: The arguments used on quiet mode. +- **`generation`** _(object)_: The configuration used for the generation. Cannot contain additional properties. + - **`default_cache`** _(string)_: The default cache name to be used, default do 'default'. Default: `"default"`. + - **`default_layers`** _(array)_: The default layers to be generated. + - **Items** _(string)_ + - **`authorised_user`** _(string)_: The authorized user to generate the tiles (used to avoid permission issue on generated tiles) (main configuration). + - **`maxconsecutive_errors`** _(integer)_: The maximum number of consecutive errors (main configuration), default is 10. Default: `10`. + - **`error_file`** _(string)_: File name generated with the tiles in error, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#tiles-error-file (main configuration). + - **`number_process`** _(integer)_: Number of process used to generate the tiles (main configuration), default is 1. Default: `1`. +- **`aws_region`** _(string)_: The region, default is 'eu-west-1'. +- **`redis`** _(object)_: The Redis configuration (main configuration). Cannot contain additional properties. + - **`url`** _(string)_: The server URL (main configuration). + - **`sentinels`** _(array)_: The sentinels (main configuration). + - **Items** _(array)_: A sentinel (main configuration). + - **Items**: + - _string_: The sentinel host name (main configuration). + - : The sentinel port (main configuration). + - **Any of** + - _string_ + - _integer_ + - **`connection_kwargs`** _(object)_: The Redis connection arguments (main configuration). + - **`sentinel_kwargs`** _(object)_: The Redis sentinel arguments (main configuration). + - **`service_name`** _(string)_: The service name, default is 'mymaster' (main configuration). Default: `"mymaster"`. + - **`socket_timeout`** _(integer)_: The socket timeout (main configuration). + - **`db`** _(integer)_ + - **`queue`** _(string)_: The queue name (main configuration). Default: `"tilecloud"`. + - **`timeout`** _(integer)_: The timeout (main configuration), default is 5. Default: `5`. + - **`pending_timeout`** _(integer)_: The pending timeout (main configuration), default is 300. Default: `300`. + - **`max_retries`** _(integer)_: The max retries (main configuration), default is 5. Default: `5`. + - **`max_errors_age`** _(integer)_: The max error age (main configuration), default is 86400 (1 day). Default: `86400`. + - **`max_errors_nb`** _(integer)_: The max error number (main configuration), default is 100. Default: `100`. + - **`prefix`** _(string)_: The prefix (main configuration), default is 'tilecloud_cache'. Default: `"tilecloud_cache"`. + - **`expiration`** _(integer)_: The meta-tile in queue expiration (main configuration), default is 28800 (8 hours). Default: `28800`. + - **`pending_count`** _(integer)_: The pending count: the number of pending tiles get in one request (main configuration), default is 10. Default: `10`. + - **`pending_max_count`** _(integer)_: The pending max count: the maximum number of pending tiles get in one pass (if not generating other tiles, every second) (main configuration), default is 10000. Default: `10000`. +- **`server`** _(object)_: Configuration used by the tile server, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#distribute-the-tiles. Cannot contain additional properties. + - **`cache`** _(string)_: The used cache name. + - **`layers`** _(array)_: Layers available in the server, default is all layers. + - **Items** _(string)_ + - **`geoms_redirect`** _(boolean)_: Take care on the geometries, default is False. Default: `false`. + - **`static_allow_extension`** _(array)_: The allowed extension of static files, defaults to [jpeg, png, xml, js, html, css]. + - **Items** _(string)_ + - **`wmts_path`** _(string)_: The sub-path for the WMTS (main configuration), default is 'wmts'. Default: `"wmts"`. + - **`static_path`** _(string)_: The sub-path for the static files (main configuration), default is 'static'. Default: `"static"`. + - **`admin_path`** _(string)_: The sub-path for the admin (main configuration), default is 'admin'. Default: `"admin"`. + - **`expires`** _(integer)_: The browser cache expiration, default is 8 (hours). Default: `8`. + - **`predefined_commands`** _(array)_: The predefined commands used to generate the tiles. + - **Items** _(object)_: Cannot contain additional properties. + - **`command`** _(string)_: The command to run. + - **`name`** _(string)_: The name used in the admin interface. + - **`allowed_commands`** _(array)_: The allowed commands (main configuration). + - **Items** _(string)_ + - **`allowed_arguments`** _(array)_: The allowed arguments (main configuration). + - **Items** _(string)_ +- **`cost`** _(object)_: The configuration use to calculate the cast (unmaintained). Cannot contain additional properties. + - **`request_per_layers`** _(integer)_: Tile request per hours, default is 10 000 000. Default: `10000000`. + - **`s3`** _(object)_: The S3 cost (main configuration). Cannot contain additional properties. + - **`storage`** _(number)_: The storage cost in $ / Gio / month (main configuration). Default: `0.125`. + - **`put`** _(number)_: The cost of put in $ per 10 000 requests (main configuration). Default: `0.01`. + - **`get`** _(number)_: The cost of get in $ per 10 000 requests (main configuration). Default: `0.01`. + - **`download`** _(number)_: The cost of download in $ per Gio (main configuration). Default: `0.12`. + - **`cloudfront`** _(object)_: The CloudFront cost (main configuration). Cannot contain additional properties. + - **`get`** _(number)_: The cost of get in $ per 10 000 requests (main configuration). Default: `0.009`. + - **`download`** _(number)_: The cost of download in $ per Gio (main configuration). Default: `0.12`. + - **`sqs`** _(object)_: The SQS cost, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-sqs (main configuration). Cannot contain additional properties. + - **`request`** _(number)_: The cost of request in $ per 1 000 000 requests (main configuration). Default: `0.01`. +- **`metadata`** _(object)_: The configuration of the WMTS capabilities metadata. Cannot contain additional properties. + - **`title`** _(string)_: The title. + - **`abstract`** _(string)_: The abstract. + - **`servicetype`** _(string)_: The service type, default is 'OGC WMTS'. Default: `"OGC WMTS"`. + - **`keywords`** _(array)_: The keywords. + - **Items** _(string)_ + - **`fees`** _(string)_: The fees. + - **`access_constraints`** _(string)_: The access constraints. +- **`provider`** _(object)_: The provider. Cannot contain additional properties. + - **`name`** _(string)_ + - **`url`** _(string)_: The public URL. + - **`contact`** _(object)_: The contact. Cannot contain additional properties. + - **`name`** _(string)_ + - **`position`** _(string)_ + - **`info`** _(object)_: The information. Cannot contain additional properties. + - **`phone`** _(object)_: The phone. Cannot contain additional properties. + - **`voice`** _(string)_: The voice number. + - **`fax`** _(string)_: The fax number. + - **`address`** _(object)_: The address. Cannot contain additional properties. + - **`delivery`** _(string)_: The delivery. + - **`city`** _(string)_: The city. + - **`area`** _(string)_: The area. + - **`postal_code`** _(integer)_: The postal code. + - **`country`** _(string)_: The country. + - **`email`** _(string)_: The email. +- **`logging`** _(object)_: The logging configuration to database, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#logging (main configuration). Cannot contain additional properties. + - **`database`** _(object)_: The database (main configuration). Cannot contain additional properties. + - **`host`** _(string)_: The host (main configuration). + - **`port`** _(integer)_: The port (main configuration), default is 5432. Default: `5432`. + - **`dbname`** _(string)_: The database name (main configuration). + - **`table`** _(string)_: The table name (main configuration). + - **`user`** _(string)_: The user name (main configuration). + - **`password`** _(string)_: The password (main configuration). diff --git a/tilecloud_chain/configuration.py b/tilecloud_chain/configuration.py index 470431cd9..d13e54c88 100644 --- a/tilecloud_chain/configuration.py +++ b/tilecloud_chain/configuration.py @@ -5,6 +5,8 @@ from typing import Any, Dict, List, Literal, Tuple, TypedDict, Union +from typing_extensions import Required + ADMIN_PATH_DEFAULT = "admin" """Default value of the field path 'Server admin_path'""" @@ -160,8 +162,6 @@ class Authentication(TypedDict, total=False): Azure Blob Storage -WARNING: The required are not correctly taken in account, -See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 WARNING: Normally the types should be a mix of each other instead of Union. See: https://github.com/camptocamp/jsonschema-gentypes/issues/7 @@ -175,13 +175,13 @@ class CacheAzureTyped(TypedDict, total=False): hosts: "CacheHost" http_urls: "CacheHttpUrls" folder: "CacheFolder" - container: str + container: Required[str] """ Container. The Azure container name - required + Required property """ cache_control: str @@ -196,8 +196,6 @@ class CacheAzureTyped(TypedDict, total=False): """ Cache BSDDB. -WARNING: The required are not correctly taken in account, -See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 WARNING: Normally the types should be a mix of each other instead of Union. See: https://github.com/camptocamp/jsonschema-gentypes/issues/7 @@ -217,8 +215,6 @@ class CacheBsddbTyped(TypedDict, total=False): """ Cache filesystem. -WARNING: The required are not correctly taken in account, -See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 WARNING: Normally the types should be a mix of each other instead of Union. See: https://github.com/camptocamp/jsonschema-gentypes/issues/7 @@ -268,8 +264,6 @@ class CacheFilesystemTyped(TypedDict, total=False): """ Cache MBtiles. -WARNING: The required are not correctly taken in account, -See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 WARNING: Normally the types should be a mix of each other instead of Union. See: https://github.com/camptocamp/jsonschema-gentypes/issues/7 @@ -289,8 +283,6 @@ class CacheMbtilesTyped(TypedDict, total=False): """ Cache S3. -WARNING: The required are not correctly taken in account, -See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 WARNING: Normally the types should be a mix of each other instead of Union. See: https://github.com/camptocamp/jsonschema-gentypes/issues/7 @@ -317,13 +309,13 @@ class CacheS3Typed(TypedDict, total=False): The S3 host, default is 's3-eu-west-1.amazonaws.com' """ - bucket: str + bucket: Required[str] """ Bucket. The S3 bucker name - required + Required property """ region: "AwsRegion" @@ -419,70 +411,16 @@ class Configuration(TypedDict, total=False): """ generation: "Generation" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - sqs: "Sqs" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - sns: "Sns" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - redis: "Redis" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - openlayers: "Openlayers" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - server: "Server" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - cost: "Cost" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - metadata: "Metadata" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - provider: "Provider" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - logging: "Logging" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - authentication: "Authentication" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ class Contact(TypedDict, total=False): @@ -499,10 +437,6 @@ class Contact(TypedDict, total=False): """Position.""" info: "Info" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ class Cost(TypedDict, total=False): @@ -522,22 +456,8 @@ class Cost(TypedDict, total=False): """ s3: "S3Cost" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - cloudfront: "CloudfrontCost" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - sqs: "SqsCost" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ DEFAULT_CACHE_DEFAULT = "default" @@ -567,40 +487,40 @@ class Database(TypedDict, total=False): default: 5432 """ - dbname: str + dbname: Required[str] """ Database. The database name (main configuration) - required + Required property """ - table: str + table: Required[str] """ Table. The table name (main configuration) - required + Required property """ - user: str + user: Required[str] """ User. The user name (main configuration) - required + Required property """ - password: str + password: Required[str] """ Password. The password (main configuration) - required + Required property """ @@ -706,16 +626,16 @@ class Grid(TypedDict, total=False): The scale used to build a FreeTileGrid typically '2' """ - resolutions: List[Union[int, float]] + resolutions: Required[List[Union[int, float]]] """ Resolutions. The resolutions in pixel per meter - required + Required property """ - bbox: List[Union[int, float]] + bbox: Required[List[Union[int, float]]] """ Bounding box. @@ -724,10 +644,10 @@ class Grid(TypedDict, total=False): minLength: 4 maxLength: 4 - required + Required property """ - srs: str + srs: Required[str] """ SRS. @@ -735,7 +655,7 @@ class Grid(TypedDict, total=False): pattern: ^EPSG:[0-9]+$ - required + Required property """ proj4_literal: str @@ -782,16 +702,7 @@ class Info(TypedDict, total=False): """ phone: "Phone" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - address: "Address" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ LAYER_META_BUFFER_DEFAULT = 128 @@ -898,22 +809,22 @@ class LayerEmptyMetaTileDetection(TypedDict, total=False): The rules used to detect the empty meta-tiles, use `generate-tiles --get-hash` to get what we can use, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-hash """ - size: int + size: Required[int] """ Size. The meta-tile size - required + Required property """ - hash: str + hash: Required[str] """ Hash. The meta-tile hash - required + Required property """ @@ -924,22 +835,22 @@ class LayerEmptyTileDetection(TypedDict, total=False): The rules used to detect the empty tiles, use `generate-tiles --get-hash` to get what we can use, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-hash """ - size: int + size: Required[int] """ Title. The tile size - required + Required property """ - hash: str + hash: Required[str] """ Hash. The tile hash - required + Required property """ @@ -1008,12 +919,8 @@ class LayerMapnik(TypedDict, total=False): type: Literal["mapnik"] title: "LayerTitle" - grid: "LayerGrid" - """ - required - - required - """ + grid: Required["LayerGrid"] + """Required property""" bbox: "LayerBoundingBox" min_resolution_seed: "LayerMinResolutionSeed" @@ -1022,28 +929,14 @@ class LayerMapnik(TypedDict, total=False): meta_size: "LayerMetaSize" meta_buffer: "LayerMetaBuffer" layers: "LayerLayers" - """required""" - - wmts_style: "LayerWmtsStyle" - """ - required + wmts_style: Required["LayerWmtsStyle"] + """Required property""" - required - """ + mime_type: Required["LayerMimeType"] + """Required property""" - mime_type: "LayerMimeType" - """ - required - - required - """ - - extension: "LayerExtension" - """ - required - - required - """ + extension: Required["LayerExtension"] + """Required property""" dimensions: "LayerDimensions" legends: "LayerLegends" @@ -1053,23 +946,8 @@ class LayerMapnik(TypedDict, total=False): post_process: "LayerPostProcess" geoms: "LayerGeometries" empty_tile_detection: "LayerEmptyTileDetection" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - empty_metatile_detection: "LayerEmptyMetaTileDetection" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - cost: "LayerCost" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - mapfile: str """ MapFile. @@ -1201,12 +1079,8 @@ class LayerWms(TypedDict, total=False): type: Literal["wms"] title: "LayerTitle" - grid: "LayerGrid" - """ - required - - required - """ + grid: Required["LayerGrid"] + """Required property""" bbox: "LayerBoundingBox" min_resolution_seed: "LayerMinResolutionSeed" @@ -1214,29 +1088,17 @@ class LayerWms(TypedDict, total=False): meta: "LayerMeta" meta_size: "LayerMetaSize" meta_buffer: "LayerMetaBuffer" - layers: "LayerLayers" - """required""" + layers: Required["LayerLayers"] + """Required property""" - wmts_style: "LayerWmtsStyle" - """ - required + wmts_style: Required["LayerWmtsStyle"] + """Required property""" - required - """ + mime_type: Required["LayerMimeType"] + """Required property""" - mime_type: "LayerMimeType" - """ - required - - required - """ - - extension: "LayerExtension" - """ - required - - required - """ + extension: Required["LayerExtension"] + """Required property""" dimensions: "LayerDimensions" legends: "LayerLegends" @@ -1246,30 +1108,15 @@ class LayerWms(TypedDict, total=False): post_process: "LayerPostProcess" geoms: "LayerGeometries" empty_tile_detection: "LayerEmptyTileDetection" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - empty_metatile_detection: "LayerEmptyMetaTileDetection" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - cost: "LayerCost" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ - - url: str + url: Required[str] """ URL. The WMS service URL - required + Required property """ generate_salt: bool @@ -1326,13 +1173,8 @@ class Logging(TypedDict, total=False): The logging configuration to database, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#logging (main configuration) """ - database: "Database" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - - required - """ + database: Required["Database"] + """Required property""" MAP_INITIAL_ZOOM_DEFAULT = 3 @@ -1384,13 +1226,13 @@ class Metadata(TypedDict, total=False): The configuration of the WMTS capabilities metadata """ - title: str + title: Required[str] """ Title. The title - required + Required property """ abstract: str @@ -1577,10 +1419,6 @@ class Provider(TypedDict, total=False): """ contact: "Contact" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ QUEUE_DEFAULT = "tilecloud" @@ -1928,13 +1766,13 @@ class Sns(TypedDict, total=False): The Simple Notification Service configuration, see https://github.com/camptocamp/tilecloud-chain/blob/master/tilecloud_chain/USAGE.rst#configure-sns """ - topic: str + topic: Required[str] """ Topic. The topic - required + Required property """ region: "AwsRegion" @@ -2031,28 +1869,28 @@ class SqsCost(TypedDict, total=False): class _LayerDimensionsItem(TypedDict, total=False): - name: "LayerDimensionName" - """required""" + name: Required["LayerDimensionName"] + """Required property""" - generate: List["_GenerateItem"] + generate: Required[List["_GenerateItem"]] """ Generate. The values that should be generate - required + Required property """ - values: List["_ValuesItem"] + values: Required[List["_ValuesItem"]] """ Values. The values present in the capabilities - required + Required property """ - default: str + default: Required[str] r""" Default. @@ -2060,27 +1898,27 @@ class _LayerDimensionsItem(TypedDict, total=False): pattern: ^[a-zA-Z0-9_\-\+~\.]+$ - required + Required property """ class _LayerGeometriesItem(TypedDict, total=False): - connection: str + connection: Required[str] """ Connection. The PostgreSQL connection string - required + Required property """ - sql: str + sql: Required[str] """ SQL. The SQL query that get the geometry in geom e.g. 'the_geom AS geom FROM my_table' - required + Required property """ min_resolution: Union[int, float] @@ -2099,7 +1937,7 @@ class _LayerGeometriesItem(TypedDict, total=False): class _LayerLegendsItem(TypedDict, total=False): - mime_type: str + mime_type: Required[str] r""" MIME type. @@ -2107,16 +1945,16 @@ class _LayerLegendsItem(TypedDict, total=False): pattern: ^[a-zA-Z0-9!#$%^&\*_\-\+{}\|'.`~]+/[a-zA-Z0-9!#$%^&\*_\-\+{}\|'.`~]+$ - required + Required property """ - href: str + href: Required[str] """ Href. The URL of the legend image - required + Required property """ width: str @@ -2187,13 +2025,13 @@ class _PredefinedCommandsItem(TypedDict, total=False): class _ProcessCommandItem(TypedDict, total=False): - cmd: str + cmd: Required[str] """ Command. The shell command, available parameters: %(in)s, %(out)s, %(args)s, %(x)s, %(y)s, %(z)s. - required + Required property """ need_out: bool @@ -2206,10 +2044,6 @@ class _ProcessCommandItem(TypedDict, total=False): """ arg: "Argument" - """ - WARNING: The required are not correctly taken in account, - See: https://github.com/camptocamp/jsonschema-gentypes/issues/6 - """ _SentinelsItem = Tuple["SentinelHost", "SentinelPort"]