Skip to main content

XPublish OGC Core

Enable Xpublish plugins that support various OGC standards to serve via fully OGC compliant routes.

This works by creating an app_router that restructures the Xpublish API around OGC API - Common conventions, and registering new hookspecs that other OGC plugins (for example xpublish-edr) implement to contribute their conformance classes, collection metadata, and data queries.

Endpoints

Path Description
/ Landing page with self, service-desc (/openapi.json), service-doc (/docs), conformance, and data links (including the http://www.opengis.net/def/rel/ogc/1.0/... link relations)
/conformance OGC API - Common conformance classes, plus every class declared by plugins via the ogc_conformance_classes hook
/collections One collection per published dataset, built from dataset attributes plus plugin contributions
/collections/{collection_id} A single collection, with data_queries aggregated from the ogc_collection_dataqueries hook. Unknown ids return an OGC exception shaped 404

If xpublish-ogc-core is installed it is loaded automatically through the xpublish.plugin entry point. The landing page title and description are configurable on the plugin, by instantiating it explicitly (note that passing plugins to xpublish.Rest disables entry point auto-loading, so list every plugin you want):

import xpublish
from xpublish_edr import CfEdrPlugin
from xpublish_ogc_core import OgcCorePlugin

rest = xpublish.Rest(
    datasets,
    plugins={
        "ogc-core": OgcCorePlugin(title="My data server", description="..."),
        "edr": CfEdrPlugin(),
    },
)

Hookspecs

Other OGC plugins implement these hookspecs (declared on OgcPluginSpec):

  • ogc_router(deps) — return an APIRouter mounted at the application root, for OGC routes like /collections/{collection_id}/position.
  • ogc_conformance_classes() — return a list of conformance class URIs (http://www.opengis.net/spec/...) to aggregate into /conformance.
  • ogc_collection_metadata(collection_id, ds, deps) — return a dict of collection members (extent, parameter_names, crs, output_formats, ...) merged into the collection objects served at /collections and /collections/{collection_id}.
  • ogc_collection_dataqueries(collection_id, ds, deps) — return a dict of data query descriptions (position, area, cube, ...) merged into the collection's data_queries.

Schema-driven development

Development on this plugin, and for other OGC plugins is driven by the official OGC schemas and test suites:

  • The official OGC schemas are vendored under src/xpublish_ogc_core/schemas/ so tests run offline (refresh with uv run scripts/update_schemas.py): the OGC API - Common Part 1 building blocks plus the collections shapes from OGC API - Features Part 1 (the "common" document, which core's own responses validate against), and the bundled OpenAPI documents published by the OGC API - EDR and OGC API - Tiles standards for the plugins implementing them.

  • xpublish_ogc_core.testing is shipped with the package so downstream plugins can validate their own responses against the official component schemas (the document argument picks the schema set, defaulting to "edr"):

    from xpublish_ogc_core.testing import validate_response
    
    validate_response("landingPage", client.get("/").json(), document="common")
    validate_response("collection", client.get("/collections/air").json())
    validate_response(
        "tileSet",
        client.get("/datasets/air/tiles/WebMercatorQuad").json(),
        document="tiles",
    )
    

    Validation failures raise with the jsonschema error messages, pointing at the exact spec violation.

  • Plugins are also suggested to use Schemathesis for hypothesis testing their advertised endpoints. xpublish_ogc_core.testing.bundled_schema() helps with loading the schema and then hypothesis testing against the spec. The tests can be run in coordination with those generated by the plguins themselves.

    plugin_schema = schemathesis.openapi.from_asgi("/openapi.json", build_app())
    
    
    ogc_schema = (
        testing.bundled_schema(with_app=build_app())
        .exclude(path_regex=r"^/collections/\{collectionId\}/items")
        .exclude(path_regex=r"^/collections/\{collectionId\}/instances")
        .exclude(path_regex=r"^/collections/\{collectionId\}/locations")
        .exclude(path_regex=r"^/collections/\{collectionId\}/radius")
        .exclude(path_regex=r"^/collections/\{collectionId\}/trajectory")
        .exclude(path_regex=r"^/collections/\{collectionId\}/corridor")
    )
    
    
    @schemathesis.pytest.parametrize(
        plugin=plugin_schema,
        ogc=ogc_schema,
    )
    def test_schema(case):
        # the EDR query parameters (WKT coords, comma separated bbox) are looser
        # than their OpenAPI parameter schemas can express, so 422 rejections of
        # schema-compliant inputs are expected
        case.call_and_validate(excluded_checks=[positive_data_acceptance])
    
  • xpublish_ogc_core.teamengine is also shipped to help facilitate other plugins testing with the OGC CITE test suites running in Docker.

    from xpublish_ogc_core import teamengine
    
    with (
        teamengine.serve_app(rest.app) as app_url,
        teamengine.teamengine_container(
            "ogccite/ets-ogcapi-edr10:1.3-teamengine-6.0.0-RC2"
        ) as engine_url,
    ):
        result = teamengine.run_suite(
            engine_url,
            "ogcapi-edr10",
            {"iut": app_url, "apiDefinition": f"{app_url}/openapi.json"},
        )
    
    assert not result.failure_names(), result.summary()
    

Metadata

Release files for xpublish-ogc-core 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xpublish-ogc-core 0.1.4
File Size Uploaded Provenance Actions
xpublish_ogc_core-0.1.4.tar.gz 69.9 kB With provenance Details for xpublish_ogc_core-0.1.4.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for xpublish-ogc-core 0.1.4
File Interpreter ABI Platform Actions
xpublish_ogc_core-0.1.4-py3-none-any.whl Python 3 none any Details for xpublish_ogc_core-0.1.4-py3-none-any.whl

Total release size: 133.3 kB

Release files / xpublish_ogc_core-0.1.4.tar.gz

Download URL xpublish_ogc_core-0.1.4.tar.gz
Size 69.9 kB
Tags Source
SHA-256 checksum
How to use checksums
84e42a19ad7796cc70621428ad4c91a6d069ce0c20db5c651dbada0bb6d42248
BLAKE2b-256 checksum
How to use checksums
19965cfb0ae01119338571f48a814bb1cb54ad04a94d31972dc0cc0ebfb2f205
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Release files / xpublish_ogc_core-0.1.4-py3-none-any.whl

Download URL xpublish_ogc_core-0.1.4-py3-none-any.whl
Size 63.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ae46535e8a3ae4b47a8615b8f88d303f08696144b648025f63e29b373da4cfc
BLAKE2b-256 checksum
How to use checksums
3008c2c11714dd98fa61767c60e98f9c11c097da57f127d399c8b4d05e457b08
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

Security for xpublish-ogc-core 0.1.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for xpublish_ogc_core-0.1.4.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 15, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page