envlib-api 0.3.0__tar.gz → 0.4.0__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.
- {envlib_api-0.3.0 → envlib_api-0.4.0}/PKG-INFO +91 -5
- {envlib_api-0.3.0 → envlib_api-0.4.0}/README.md +89 -3
- {envlib_api-0.3.0 → envlib_api-0.4.0}/benchmarks/README.md +30 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/benchmarks/bench_api.py +22 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/__init__.py +1 -1
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/app.py +82 -4
- envlib_api-0.4.0/envlib_api/api/catalogue.py +277 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/edr.py +27 -1
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/grid.py +8 -1
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/resolve.py +17 -32
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/server.py +3 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/config.py +4 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/test_api_review.py +10 -5
- envlib_api-0.4.0/envlib_api/tests/test_catalogue.py +700 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/test_ops.py +3 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/build_mutants_api.py +10 -12
- envlib_api-0.4.0/planning/build_mutants_catalogue.py +292 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/build_mutants_grid.py +3 -3
- envlib_api-0.4.0/planning/close-checks-catalogue-2026-11-25.md +59 -0
- envlib_api-0.4.0/planning/close_check_catalogue.py +261 -0
- envlib_api-0.4.0/planning/edr-api-code-5-review-brief.md +189 -0
- envlib_api-0.4.0/planning/edr-api-code-5-review-fable.md +295 -0
- envlib_api-0.4.0/planning/edr-api-code-5-review-sonnet.md +275 -0
- envlib_api-0.4.0/planning/edr-api-code-5-review-synthesis.md +105 -0
- envlib_api-0.4.0/planning/edr-api-plan-5-frozen-pre-review.md +269 -0
- envlib_api-0.4.0/planning/edr-api-plan-5-review-brief.md +412 -0
- envlib_api-0.4.0/planning/edr-api-plan-5-review-fable.md +334 -0
- envlib_api-0.4.0/planning/edr-api-plan-5-review-sonnet.md +314 -0
- envlib_api-0.4.0/planning/edr-api-plan-5-review-synthesis.md +109 -0
- envlib_api-0.4.0/planning/edr-api-plan-5.md +398 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/mutants_api.json +6 -17
- envlib_api-0.4.0/planning/mutants_catalogue.json +422 -0
- envlib_api-0.4.0/planning/mutants_catalogue_result.txt +94 -0
- envlib_api-0.4.0/planning/mutants_envlib.json +266 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/mutants_grid.json +3 -3
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/mutate.py +7 -3
- envlib_api-0.4.0/planning/mutate_envlib.py +72 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/pyproject.toml +1 -1
- {envlib_api-0.3.0 → envlib_api-0.4.0}/uv.lock +4 -4
- {envlib_api-0.3.0 → envlib_api-0.4.0}/.dockerignore +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/.github/workflows/test.yml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/.gitignore +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/Dockerfile +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/LICENSE +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/benchmarks/ab.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/docker-compose.yml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/docker-swarm.yml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/__main__.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/__init__.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/compress.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/cost.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/encode.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/errors.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/params.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/read.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/stations.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/api/timesel.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/cli.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/healthcheck.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/mirror.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/refresher.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/__init__.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/api_support.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/conftest.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/grid_support.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/README.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/coveragejson/coveragejson.json +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/DataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/areaDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/areaLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/collection.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/collections.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/corridorDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/corridorLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/crsObject.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/cubeDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/cubeLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/extent.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/instancesDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/instancesLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/itemsDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/itemsLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/locationsDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/locationsLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/observedPropertyCollection.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/parameterNames.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/positionDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/positionLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/radiusDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/radiusLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/trajectoryDataQuery.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/trajectoryLink.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/collections/units.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/core/confClasses.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/core/exception.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/core/landingPage.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/core/link.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/anyAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/coverage.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/coverageBase.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/coverageCollection.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/coverageJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/covjsonI18n.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/covjsonObservedProperty.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/covjsonParameter.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/covjsonParameterGroup.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/covjsonUnit.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/domain.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/domainBase.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/ndArray.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/numericAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/numericRegularlySpacedAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/numericSingleValueAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/numericValuesAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/polygonValuesAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/primitiveValuesAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/referenceSystem.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/referenceSystemConnection.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/stringSingleValueAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/stringValuesAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/targetConcept.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/tiledNdArray.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/tupleValuesAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/valuesAxis.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/covjson/valuesAxisBase.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/edr-geojson/edrFeatureCollectionGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/edr-geojson/edrProperties.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/edr-geojson/observedProperty.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/edr-geojson/parameter.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/edr-geojson/unit.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/featureGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/geometrycollectionGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/linestringGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/multilinestringGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/multipointGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/multipolygonGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/pointGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/geojson/polygonGeoJSON.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/i18n.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/numberMatched.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/numberReturned.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/parameterGroup.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/schemas/edr/schemas/queries/instances.yaml +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/support.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/test_alerting_and_guards.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/test_api.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/test_grid.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/test_refresher.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/envlib_api/tests/test_schemas.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/mongo/api-role.json +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/mongo/init-users.js +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/mongo/refresher-role.json +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/close-check-rehearsal-2026-11-24.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/close-checks-grid-2026-11-25.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/close-checks-live-2026-11-24.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/close-checks-local-2026-11-24.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/close_check.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/close_check_api.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/close_check_grid.py +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-3-review-brief.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-3-review-fable.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-3-review-sonnet.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-3-review-synthesis.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-4-review-brief.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-4-review-fable.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-4-review-sonnet.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-code-4-review-synthesis.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-3-frozen-pre-review.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-3-review-brief.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-3-review-fable.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-3-review-sonnet.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-3-review-synthesis.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-3.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-4-frozen-pre-review.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-4-review-brief.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-4-review-fable.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-4-review-sonnet.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-4-review-synthesis.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-api-plan-4.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-code-2-review-brief.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-code-2-review-fable.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-code-2-review-sonnet.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-code-2-review-synthesis.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-plan-2-review-brief.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-plan-2-review-fable.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-plan-2-review-sonnet.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-plan-2-review-synthesis.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/edr-worker-plan-2.md +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/mutants.json +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/mutants_api_result.txt +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/mutants_grid_result.txt +0 -0
- {envlib_api-0.3.0 → envlib_api-0.4.0}/planning/mutants_result.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: envlib-api
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.4.0
|
|
4
4
|
Summary: The envlib data API service: an OGC API - EDR server for envlib datasets, and the refresher mirroring the envlib catalogue and dataset indexes into MongoDB
|
|
5
5
|
Project-URL: Source, https://github.com/envlib/envlib-api
|
|
6
6
|
Author-email: Mike Kittridge <mullenkamp1@gmail.com>
|
|
@@ -11,7 +11,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
11
11
|
Requires-Python: >=3.12
|
|
12
12
|
Requires-Dist: cfdb>=0.12.0
|
|
13
13
|
Requires-Dist: ebooklet[mongo]>=0.13.2
|
|
14
|
-
Requires-Dist: envlib>=0.1.
|
|
14
|
+
Requires-Dist: envlib>=0.1.9
|
|
15
15
|
Requires-Dist: fastapi>=0.115
|
|
16
16
|
Requires-Dist: orjson>=3.9
|
|
17
17
|
Requires-Dist: pyproj>=3.6
|
|
@@ -41,7 +41,7 @@ the swarm is "EDR plan 6: going public".
|
|
|
41
41
|
|---|---|
|
|
42
42
|
| `mongo` | MongoDB 9.0, on one node with a named volume, with auth and no published port. It holds only data derived from B2, so it has no backups. |
|
|
43
43
|
| `refresher` | Every 60 s it refreshes the catalogue, syncs the set of mirrored datasets with it, then refreshes every dataset. It is pinned to MongoDB's node. |
|
|
44
|
-
| `api` (local only so far) | The EDR API: station (`ts_ortho`) collections
|
|
44
|
+
| `api` (local only so far) | The EDR API: station (`ts_ortho`) collections with `/locations`, `/area` and `/radius`, and grid collections with `/position` and `/cube`, in CoverageJSON, CSV and GeoJSON; and the envlib catalogue at `/catalogue`. See "The API" below. |
|
|
45
45
|
|
|
46
46
|
Each cycle, in order:
|
|
47
47
|
1. **Refresh the catalogue.** It is an ebooklet RemoteConnGroup, mirrored like any dataset under the
|
|
@@ -87,6 +87,8 @@ imports it.
|
|
|
87
87
|
| `/collections/{id}/locations/{station_id}` | One station's series: a CoverageJSON `PointSeries`, or CSV. |
|
|
88
88
|
| `/collections/{id}/area?coords=POLYGON(...)` | The stations a WKT POLYGON or MULTIPOLYGON covers, boundary included: a `CoverageCollection` of `PointSeries`, or CSV. |
|
|
89
89
|
| `/collections/{id}/radius?coords=POINT(...)&within=…&within-units=km\|m` | The stations within a great-circle distance (WGS84). |
|
|
90
|
+
| `/catalogue` | The envlib catalogue: `Catalogue.query()` over HTTP, every version on request (see "The catalogue" below). |
|
|
91
|
+
| `/catalogue/distinct/{field}` | The distinct stored values of one queryable field: `Catalogue.distinct()`. |
|
|
90
92
|
|
|
91
93
|
**Query rules:**
|
|
92
94
|
- **`datetime`** is an instant or an interval, with `..` for an open end. Times are UTC: a naive
|
|
@@ -115,6 +117,16 @@ imports it.
|
|
|
115
117
|
(404), other methods (405) and anything unexpected (500).
|
|
116
118
|
- **Compression** follows `Accept-Encoding` (q-values honoured): zstd level 1, else gzip level 1, else
|
|
117
119
|
none.
|
|
120
|
+
- **CORS.** Every answer carries `Access-Control-Allow-Origin: *` and exposes `Retry-After`, whatever
|
|
121
|
+
the request, so a web page on any site can read the API from the browser (Mike, 2026-11-25). That
|
|
122
|
+
includes errors, FastAPI's `/api` and Starlette's trailing-slash redirects, because one ASGI
|
|
123
|
+
middleware (`Cors` in `envlib_api/api/app.py`) adds the headers to every answer as it starts. The
|
|
124
|
+
unexpected 500 is sent outside every middleware, so its handler sets them itself (code review
|
|
125
|
+
`edr-api-code-5`). The API is public, read-only and cookie-free, so this gives a
|
|
126
|
+
page nothing it could not fetch from a server. Because `*` does not depend on the request, no
|
|
127
|
+
`Vary: Origin` is sent, and a copy cached without an `Origin` still serves a browser. An `OPTIONS`
|
|
128
|
+
preflight answers 204 and allows `GET` only, with no extra request headers. Exposing `ETag` and
|
|
129
|
+
allowing `If-None-Match` wait for plan 6's conditional requests, and `HEAD` is plan 6's too.
|
|
118
130
|
|
|
119
131
|
**The caps** (`[api]` in the API's TOML; `envlib_api/config.py` has the defaults):
|
|
120
132
|
- `max_values`: the values returned (stations or cells × levels × time steps × parameters);
|
|
@@ -161,7 +173,8 @@ and code review `edr-api-code-4`):
|
|
|
161
173
|
cell, unmasked (Mike, 2026-11-25). The WRF grid is rotated about 37° against north, so a lon/lat
|
|
162
174
|
square returns about twice its own cells, and a thin strip many times more (28–70× measured on live
|
|
163
175
|
WRF; there is no bound); the caps count the rectangle. A bbox between centres (smaller than a cell)
|
|
164
|
-
answers 204. Malformed bboxes answer 400, numbers included (`1_0` is refused)
|
|
176
|
+
answers 204. Malformed bboxes answer 400, numbers included (`1_0` is refused), and so does a bbox
|
|
177
|
+
whose west lies more than 360° east of its east (`190,…,-190,…`), which no reading makes a box.
|
|
165
178
|
- **On a global lon/lat grid** (none is served today), a bbox across the axis's seam (±180 on a
|
|
166
179
|
−180..180 axis) returns the whole longitude axis, because the rectangle is one index range.
|
|
167
180
|
- **The cost before the caps:** the rectangle is found by projecting every cell centre to CRS84,
|
|
@@ -198,6 +211,72 @@ and code review `edr-api-code-4`):
|
|
|
198
211
|
- `POINT Z` answers 400 (use `z` for a level). In position CSV, a native coordinate column named
|
|
199
212
|
`lon` or `lat` gets the suffix `_native`.
|
|
200
213
|
|
|
214
|
+
### The catalogue
|
|
215
|
+
|
|
216
|
+
`/catalogue` and `/catalogue/distinct/{field}` serve the envlib catalogue as the mirror holds it
|
|
217
|
+
(`envlib_api/api/catalogue.py`; plan 5 and its review `edr-api-plan-5`). The matching rules are
|
|
218
|
+
envlib's: each request reads every mirrored catalogue document and calls `envlib.match_entries`,
|
|
219
|
+
`envlib.latest_per_dataset` or `envlib.distinct_values`, the functions `Catalogue.query()` and
|
|
220
|
+
`Catalogue.distinct()` call. So an HTTP query and a Python query of the same catalogue give the same
|
|
221
|
+
entries.
|
|
222
|
+
|
|
223
|
+
**`/catalogue` parameters** (anything else answers 400):
|
|
224
|
+
|
|
225
|
+
| Parameter | Meaning |
|
|
226
|
+
|---|---|
|
|
227
|
+
| any queryable field (`envlib.QUERYABLE_FIELDS`: the identity fields, `license`, `dataset_type`, `dataset_id`, `dataset_version_id`) | Comma-separated values, any of which matches, case-insensitive. An empty value (`product_code=`) asks for null |
|
|
228
|
+
| `bbox=w,s,e,n` | Intersects the stored bbox. Longitudes as on `/cube` (−360..360, west > east crossing 180, or 0–360). The numbers are parsed strictly here and passed to envlib as given, and envlib reads 0–360 boxes itself, so `Catalogue.query(bbox=...)` gives the same entries |
|
|
229
|
+
| `coords=POLYGON(...)` or `MULTIPOLYGON(...)` | Intersects the stored bbox. A polygon is also tried 360° east and west, so 0–360 longitudes work. Non-finite coordinates answer 400 |
|
|
230
|
+
| `coords=POINT(lon lat)&within=…&within-units=km\|m` | A stored bbox within that great-circle distance |
|
|
231
|
+
| `datetime` | Overlaps the stored time range: an instant, or an interval with `..` for an open end |
|
|
232
|
+
| `all-versions=true` | Every matching version. Otherwise the latest matching version of each dataset |
|
|
233
|
+
| `limit`, `after` | Paging (below) |
|
|
234
|
+
|
|
235
|
+
`bbox` and `coords` are alternatives. The spatial filters test each dataset's stored bbox, a coarse
|
|
236
|
+
filter that is never too small, as in envlib.
|
|
237
|
+
|
|
238
|
+
**Each entry** carries `dataset_version_id`, `dataset_id`, `latest`, `db_url`, the full catalogue
|
|
239
|
+
`metadata`, links, and an `envlib` snippet that opens that version.
|
|
240
|
+
- **`latest`** says whether this is the version the collection serves, over the whole catalogue and
|
|
241
|
+
whatever the filters. A time filter can return an older version, because envlib picks the latest
|
|
242
|
+
of the *matching* versions; that entry has `latest: false`.
|
|
243
|
+
- **Links:**
|
|
244
|
+
- on the latest entry of a served type, `alternate` points to its EDR collection. That collection
|
|
245
|
+
can still answer 404 `NotServed` (a dataset that breaks a convention) or 503 (its remote is
|
|
246
|
+
missing), because checking needs the dataset opened;
|
|
247
|
+
- on an older entry, `latest-version` (RFC 5829) points to the latest one in `/catalogue`;
|
|
248
|
+
- on every entry, `version-history` points to all its dataset's versions.
|
|
249
|
+
- Each collection links to the same `version-history`, and the landing page links to `/catalogue`
|
|
250
|
+
with the relation `https://envlib.xyz/rel/catalogue`.
|
|
251
|
+
|
|
252
|
+
**Order and paging.** Entries are sorted by `dataset_id`, then by `envlib.version_key` descending,
|
|
253
|
+
the order `latest_per_dataset` itself uses (`created_at`, then `dataset_version_id`), so each
|
|
254
|
+
dataset's served version comes first whatever its stamp looks like. `limit` is a whole number of
|
|
255
|
+
ASCII digits; it defaults to `catalogue_limit` (100, in `[api]`), and a larger value is clamped to it.
|
|
256
|
+
The `next` link carries every filter plus `after`: the page's last entry's `dataset_id`,
|
|
257
|
+
`created_at` text and `dataset_version_id`, each percent-encoded and joined by `|`. The next page
|
|
258
|
+
starts strictly after that key. So a change between pages never repeats an entry and never skips one
|
|
259
|
+
that was already there; an entry added before the cursor is not seen. The body carries
|
|
260
|
+
`numberMatched` and `numberReturned`.
|
|
261
|
+
|
|
262
|
+
**`/catalogue/distinct/{field}`** (`counts=true` for counts) answers `{"field", "values"}` or
|
|
263
|
+
`{"field", "counts": [{"value", "count"}]}`, in envlib's order, with null as `null`. It counts every
|
|
264
|
+
version, so a facet's counts can exceed `/catalogue`'s `numberMatched`. An unknown field answers 404.
|
|
265
|
+
|
|
266
|
+
**Limits:**
|
|
267
|
+
- a value containing a comma cannot be matched;
|
|
268
|
+
- a hand-typed `+` must be sent as `%2B` (`utc_offset=%2B00:00`): a bare `+` decodes as a space;
|
|
269
|
+
- a date-only `datetime` is the instant at 00:00, not the whole day;
|
|
270
|
+
- the mirror never lists an entry it refuses (one with no http(s) `db_url` or no `dataset_id`, or an
|
|
271
|
+
integer of 2⁶³ or more), and a changed entry whose member refresh keeps failing keeps its old
|
|
272
|
+
metadata until it succeeds;
|
|
273
|
+
- a new entry appears within one poll of its first successful mirror;
|
|
274
|
+
- every request reads the whole mirrored catalogue: 41 KB for today's 18 entries, and about 48 ms at
|
|
275
|
+
5,000 entries on loopback (plan review `edr-api-plan-5`);
|
|
276
|
+
- `/catalogue/distinct/{field}` answers 500 if a stored value of that field is a list or an object,
|
|
277
|
+
as envlib's `distinct()` raises on it. Only a hand-damaged entry holds one, since `Metadata` would
|
|
278
|
+
not publish it (code review `edr-api-code-5`).
|
|
279
|
+
|
|
201
280
|
**Consistency** (`envlib_api/api/resolve.py`). Every attr is read first, then the selection and the
|
|
202
281
|
cap, then the batched fetch and the reads, then `store.verify()`. `verify()` runs before every answer
|
|
203
282
|
computed from the store, a 413, 204 or 404 included.
|
|
@@ -218,7 +297,10 @@ It cannot interrupt a fetch in progress, so a request can overrun it by one B2 r
|
|
|
218
297
|
|
|
219
298
|
A collection whose store cannot be built is left out of `/collections` and logged. It never fails
|
|
220
299
|
the listing. A catalogue entry whose `created_at` does not parse counts as the oldest version, with a
|
|
221
|
-
warning
|
|
300
|
+
warning; the rule is envlib's (`envlib.latest_per_dataset`, since envlib 0.1.9), and the API has no
|
|
301
|
+
copy of its own. The warning is envlib's `warnings.warn`, routed to the log by
|
|
302
|
+
`logging.captureWarnings`, so it is logged once per process for each damaged entry, not on every
|
|
303
|
+
request. A latest version whose remote is `missing` hides an older working one, as envlib's
|
|
222
304
|
`query()` would.
|
|
223
305
|
|
|
224
306
|
**The API's MongoDB user** is `api`, with the role `envlib_api_reader` (`mongo/api-role.json`): `find`
|
|
@@ -403,6 +485,10 @@ ENVLIB_API_TEST_MONGO_URI='mongodb://root:testpw@127.0.0.1:27092/?authSource=adm
|
|
|
403
485
|
- `planning/mutate.py` runs the mutants in `planning/mutants.json` (the refresher) and
|
|
404
486
|
`planning/mutants_api.json` (the API). Every one must be KILLED except the documented equivalent
|
|
405
487
|
(`planning/mutants_result.txt`, `planning/mutants_api_result.txt`).
|
|
488
|
+
- The catalogue's mutants are `planning/mutants_catalogue.json` (the API side) and
|
|
489
|
+
`planning/mutants_envlib.json` (envlib's matching, run by `planning/mutate_envlib.py` on a copy of
|
|
490
|
+
envlib). `mutate.py` keeps an existing `PYTHONPATH` after the copy, so a mutant run can import an
|
|
491
|
+
unreleased envlib (`PYTHONPATH=../envlib MUTATE_ENVLIB_VERSION=0.1.9`).
|
|
406
492
|
- `planning/close_check_api.py` compares a running API with direct envlib reads of the live datasets.
|
|
407
493
|
- `benchmarks/` times the API's hot paths, and an A/B of the previous release against the candidate
|
|
408
494
|
is a release step (`benchmarks/README.md`).
|
|
@@ -16,7 +16,7 @@ the swarm is "EDR plan 6: going public".
|
|
|
16
16
|
|---|---|
|
|
17
17
|
| `mongo` | MongoDB 9.0, on one node with a named volume, with auth and no published port. It holds only data derived from B2, so it has no backups. |
|
|
18
18
|
| `refresher` | Every 60 s it refreshes the catalogue, syncs the set of mirrored datasets with it, then refreshes every dataset. It is pinned to MongoDB's node. |
|
|
19
|
-
| `api` (local only so far) | The EDR API: station (`ts_ortho`) collections
|
|
19
|
+
| `api` (local only so far) | The EDR API: station (`ts_ortho`) collections with `/locations`, `/area` and `/radius`, and grid collections with `/position` and `/cube`, in CoverageJSON, CSV and GeoJSON; and the envlib catalogue at `/catalogue`. See "The API" below. |
|
|
20
20
|
|
|
21
21
|
Each cycle, in order:
|
|
22
22
|
1. **Refresh the catalogue.** It is an ebooklet RemoteConnGroup, mirrored like any dataset under the
|
|
@@ -62,6 +62,8 @@ imports it.
|
|
|
62
62
|
| `/collections/{id}/locations/{station_id}` | One station's series: a CoverageJSON `PointSeries`, or CSV. |
|
|
63
63
|
| `/collections/{id}/area?coords=POLYGON(...)` | The stations a WKT POLYGON or MULTIPOLYGON covers, boundary included: a `CoverageCollection` of `PointSeries`, or CSV. |
|
|
64
64
|
| `/collections/{id}/radius?coords=POINT(...)&within=…&within-units=km\|m` | The stations within a great-circle distance (WGS84). |
|
|
65
|
+
| `/catalogue` | The envlib catalogue: `Catalogue.query()` over HTTP, every version on request (see "The catalogue" below). |
|
|
66
|
+
| `/catalogue/distinct/{field}` | The distinct stored values of one queryable field: `Catalogue.distinct()`. |
|
|
65
67
|
|
|
66
68
|
**Query rules:**
|
|
67
69
|
- **`datetime`** is an instant or an interval, with `..` for an open end. Times are UTC: a naive
|
|
@@ -90,6 +92,16 @@ imports it.
|
|
|
90
92
|
(404), other methods (405) and anything unexpected (500).
|
|
91
93
|
- **Compression** follows `Accept-Encoding` (q-values honoured): zstd level 1, else gzip level 1, else
|
|
92
94
|
none.
|
|
95
|
+
- **CORS.** Every answer carries `Access-Control-Allow-Origin: *` and exposes `Retry-After`, whatever
|
|
96
|
+
the request, so a web page on any site can read the API from the browser (Mike, 2026-11-25). That
|
|
97
|
+
includes errors, FastAPI's `/api` and Starlette's trailing-slash redirects, because one ASGI
|
|
98
|
+
middleware (`Cors` in `envlib_api/api/app.py`) adds the headers to every answer as it starts. The
|
|
99
|
+
unexpected 500 is sent outside every middleware, so its handler sets them itself (code review
|
|
100
|
+
`edr-api-code-5`). The API is public, read-only and cookie-free, so this gives a
|
|
101
|
+
page nothing it could not fetch from a server. Because `*` does not depend on the request, no
|
|
102
|
+
`Vary: Origin` is sent, and a copy cached without an `Origin` still serves a browser. An `OPTIONS`
|
|
103
|
+
preflight answers 204 and allows `GET` only, with no extra request headers. Exposing `ETag` and
|
|
104
|
+
allowing `If-None-Match` wait for plan 6's conditional requests, and `HEAD` is plan 6's too.
|
|
93
105
|
|
|
94
106
|
**The caps** (`[api]` in the API's TOML; `envlib_api/config.py` has the defaults):
|
|
95
107
|
- `max_values`: the values returned (stations or cells × levels × time steps × parameters);
|
|
@@ -136,7 +148,8 @@ and code review `edr-api-code-4`):
|
|
|
136
148
|
cell, unmasked (Mike, 2026-11-25). The WRF grid is rotated about 37° against north, so a lon/lat
|
|
137
149
|
square returns about twice its own cells, and a thin strip many times more (28–70× measured on live
|
|
138
150
|
WRF; there is no bound); the caps count the rectangle. A bbox between centres (smaller than a cell)
|
|
139
|
-
answers 204. Malformed bboxes answer 400, numbers included (`1_0` is refused)
|
|
151
|
+
answers 204. Malformed bboxes answer 400, numbers included (`1_0` is refused), and so does a bbox
|
|
152
|
+
whose west lies more than 360° east of its east (`190,…,-190,…`), which no reading makes a box.
|
|
140
153
|
- **On a global lon/lat grid** (none is served today), a bbox across the axis's seam (±180 on a
|
|
141
154
|
−180..180 axis) returns the whole longitude axis, because the rectangle is one index range.
|
|
142
155
|
- **The cost before the caps:** the rectangle is found by projecting every cell centre to CRS84,
|
|
@@ -173,6 +186,72 @@ and code review `edr-api-code-4`):
|
|
|
173
186
|
- `POINT Z` answers 400 (use `z` for a level). In position CSV, a native coordinate column named
|
|
174
187
|
`lon` or `lat` gets the suffix `_native`.
|
|
175
188
|
|
|
189
|
+
### The catalogue
|
|
190
|
+
|
|
191
|
+
`/catalogue` and `/catalogue/distinct/{field}` serve the envlib catalogue as the mirror holds it
|
|
192
|
+
(`envlib_api/api/catalogue.py`; plan 5 and its review `edr-api-plan-5`). The matching rules are
|
|
193
|
+
envlib's: each request reads every mirrored catalogue document and calls `envlib.match_entries`,
|
|
194
|
+
`envlib.latest_per_dataset` or `envlib.distinct_values`, the functions `Catalogue.query()` and
|
|
195
|
+
`Catalogue.distinct()` call. So an HTTP query and a Python query of the same catalogue give the same
|
|
196
|
+
entries.
|
|
197
|
+
|
|
198
|
+
**`/catalogue` parameters** (anything else answers 400):
|
|
199
|
+
|
|
200
|
+
| Parameter | Meaning |
|
|
201
|
+
|---|---|
|
|
202
|
+
| any queryable field (`envlib.QUERYABLE_FIELDS`: the identity fields, `license`, `dataset_type`, `dataset_id`, `dataset_version_id`) | Comma-separated values, any of which matches, case-insensitive. An empty value (`product_code=`) asks for null |
|
|
203
|
+
| `bbox=w,s,e,n` | Intersects the stored bbox. Longitudes as on `/cube` (−360..360, west > east crossing 180, or 0–360). The numbers are parsed strictly here and passed to envlib as given, and envlib reads 0–360 boxes itself, so `Catalogue.query(bbox=...)` gives the same entries |
|
|
204
|
+
| `coords=POLYGON(...)` or `MULTIPOLYGON(...)` | Intersects the stored bbox. A polygon is also tried 360° east and west, so 0–360 longitudes work. Non-finite coordinates answer 400 |
|
|
205
|
+
| `coords=POINT(lon lat)&within=…&within-units=km\|m` | A stored bbox within that great-circle distance |
|
|
206
|
+
| `datetime` | Overlaps the stored time range: an instant, or an interval with `..` for an open end |
|
|
207
|
+
| `all-versions=true` | Every matching version. Otherwise the latest matching version of each dataset |
|
|
208
|
+
| `limit`, `after` | Paging (below) |
|
|
209
|
+
|
|
210
|
+
`bbox` and `coords` are alternatives. The spatial filters test each dataset's stored bbox, a coarse
|
|
211
|
+
filter that is never too small, as in envlib.
|
|
212
|
+
|
|
213
|
+
**Each entry** carries `dataset_version_id`, `dataset_id`, `latest`, `db_url`, the full catalogue
|
|
214
|
+
`metadata`, links, and an `envlib` snippet that opens that version.
|
|
215
|
+
- **`latest`** says whether this is the version the collection serves, over the whole catalogue and
|
|
216
|
+
whatever the filters. A time filter can return an older version, because envlib picks the latest
|
|
217
|
+
of the *matching* versions; that entry has `latest: false`.
|
|
218
|
+
- **Links:**
|
|
219
|
+
- on the latest entry of a served type, `alternate` points to its EDR collection. That collection
|
|
220
|
+
can still answer 404 `NotServed` (a dataset that breaks a convention) or 503 (its remote is
|
|
221
|
+
missing), because checking needs the dataset opened;
|
|
222
|
+
- on an older entry, `latest-version` (RFC 5829) points to the latest one in `/catalogue`;
|
|
223
|
+
- on every entry, `version-history` points to all its dataset's versions.
|
|
224
|
+
- Each collection links to the same `version-history`, and the landing page links to `/catalogue`
|
|
225
|
+
with the relation `https://envlib.xyz/rel/catalogue`.
|
|
226
|
+
|
|
227
|
+
**Order and paging.** Entries are sorted by `dataset_id`, then by `envlib.version_key` descending,
|
|
228
|
+
the order `latest_per_dataset` itself uses (`created_at`, then `dataset_version_id`), so each
|
|
229
|
+
dataset's served version comes first whatever its stamp looks like. `limit` is a whole number of
|
|
230
|
+
ASCII digits; it defaults to `catalogue_limit` (100, in `[api]`), and a larger value is clamped to it.
|
|
231
|
+
The `next` link carries every filter plus `after`: the page's last entry's `dataset_id`,
|
|
232
|
+
`created_at` text and `dataset_version_id`, each percent-encoded and joined by `|`. The next page
|
|
233
|
+
starts strictly after that key. So a change between pages never repeats an entry and never skips one
|
|
234
|
+
that was already there; an entry added before the cursor is not seen. The body carries
|
|
235
|
+
`numberMatched` and `numberReturned`.
|
|
236
|
+
|
|
237
|
+
**`/catalogue/distinct/{field}`** (`counts=true` for counts) answers `{"field", "values"}` or
|
|
238
|
+
`{"field", "counts": [{"value", "count"}]}`, in envlib's order, with null as `null`. It counts every
|
|
239
|
+
version, so a facet's counts can exceed `/catalogue`'s `numberMatched`. An unknown field answers 404.
|
|
240
|
+
|
|
241
|
+
**Limits:**
|
|
242
|
+
- a value containing a comma cannot be matched;
|
|
243
|
+
- a hand-typed `+` must be sent as `%2B` (`utc_offset=%2B00:00`): a bare `+` decodes as a space;
|
|
244
|
+
- a date-only `datetime` is the instant at 00:00, not the whole day;
|
|
245
|
+
- the mirror never lists an entry it refuses (one with no http(s) `db_url` or no `dataset_id`, or an
|
|
246
|
+
integer of 2⁶³ or more), and a changed entry whose member refresh keeps failing keeps its old
|
|
247
|
+
metadata until it succeeds;
|
|
248
|
+
- a new entry appears within one poll of its first successful mirror;
|
|
249
|
+
- every request reads the whole mirrored catalogue: 41 KB for today's 18 entries, and about 48 ms at
|
|
250
|
+
5,000 entries on loopback (plan review `edr-api-plan-5`);
|
|
251
|
+
- `/catalogue/distinct/{field}` answers 500 if a stored value of that field is a list or an object,
|
|
252
|
+
as envlib's `distinct()` raises on it. Only a hand-damaged entry holds one, since `Metadata` would
|
|
253
|
+
not publish it (code review `edr-api-code-5`).
|
|
254
|
+
|
|
176
255
|
**Consistency** (`envlib_api/api/resolve.py`). Every attr is read first, then the selection and the
|
|
177
256
|
cap, then the batched fetch and the reads, then `store.verify()`. `verify()` runs before every answer
|
|
178
257
|
computed from the store, a 413, 204 or 404 included.
|
|
@@ -193,7 +272,10 @@ It cannot interrupt a fetch in progress, so a request can overrun it by one B2 r
|
|
|
193
272
|
|
|
194
273
|
A collection whose store cannot be built is left out of `/collections` and logged. It never fails
|
|
195
274
|
the listing. A catalogue entry whose `created_at` does not parse counts as the oldest version, with a
|
|
196
|
-
warning
|
|
275
|
+
warning; the rule is envlib's (`envlib.latest_per_dataset`, since envlib 0.1.9), and the API has no
|
|
276
|
+
copy of its own. The warning is envlib's `warnings.warn`, routed to the log by
|
|
277
|
+
`logging.captureWarnings`, so it is logged once per process for each damaged entry, not on every
|
|
278
|
+
request. A latest version whose remote is `missing` hides an older working one, as envlib's
|
|
197
279
|
`query()` would.
|
|
198
280
|
|
|
199
281
|
**The API's MongoDB user** is `api`, with the role `envlib_api_reader` (`mongo/api-role.json`): `find`
|
|
@@ -378,6 +460,10 @@ ENVLIB_API_TEST_MONGO_URI='mongodb://root:testpw@127.0.0.1:27092/?authSource=adm
|
|
|
378
460
|
- `planning/mutate.py` runs the mutants in `planning/mutants.json` (the refresher) and
|
|
379
461
|
`planning/mutants_api.json` (the API). Every one must be KILLED except the documented equivalent
|
|
380
462
|
(`planning/mutants_result.txt`, `planning/mutants_api_result.txt`).
|
|
463
|
+
- The catalogue's mutants are `planning/mutants_catalogue.json` (the API side) and
|
|
464
|
+
`planning/mutants_envlib.json` (envlib's matching, run by `planning/mutate_envlib.py` on a copy of
|
|
465
|
+
envlib). `mutate.py` keeps an existing `PYTHONPATH` after the copy, so a mutant run can import an
|
|
466
|
+
unreleased envlib (`PYTHONPATH=../envlib MUTATE_ENVLIB_VERSION=0.1.9`).
|
|
381
467
|
- `planning/close_check_api.py` compares a running API with direct envlib reads of the live datasets.
|
|
382
468
|
- `benchmarks/` times the API's hot paths, and an A/B of the previous release against the candidate
|
|
383
469
|
is a release step (`benchmarks/README.md`).
|
|
@@ -97,3 +97,33 @@ three 0.3.0 runs of that A/B: the median of the three medians, and their largest
|
|
|
97
97
|
24 ms, even with the transformer cached. pyproj repeats the operation search in every new thread. The
|
|
98
98
|
cache now holds the chosen operation as a pipeline; `planning/close-checks-grid-2026-11-25.md` has
|
|
99
99
|
the measurements.
|
|
100
|
+
|
|
101
|
+
## 0.4.0 (EDR plan 5: the catalogue)
|
|
102
|
+
|
|
103
|
+
New cases (the station world's catalogue has 2 entries, so the route cases time the route's own
|
|
104
|
+
overhead; `cpu_catalogue_match_1000` times envlib's matching at catalogue scale):
|
|
105
|
+
|
|
106
|
+
| Case | Median |
|
|
107
|
+
|---|---|
|
|
108
|
+
| `warm_catalogue` (all versions) | 1.71 ms |
|
|
109
|
+
| `warm_catalogue_filtered` (variable, bbox, datetime) | 1.83 ms |
|
|
110
|
+
| `warm_catalogue_distinct_counts` | 1.60 ms |
|
|
111
|
+
| `cpu_catalogue_match_1000` (`envlib.match_entries` over 1,000 entries) | 1.80 ms |
|
|
112
|
+
|
|
113
|
+
**The A/B against 0.3.0** (2026-11-25; `ab.py HEAD WORKTREE --rounds 3 --reps 7`, both on the local
|
|
114
|
+
envlib 0.1.9 through `PYTHONPATH`, since the API now calls its functions). Every ratio is inside A's
|
|
115
|
+
own run-to-run spread, so nothing moved. The largest is `warm_collections` at 1.059 against a spread
|
|
116
|
+
of 1.090: `resolve` now calls `envlib.latest_per_dataset`, and every answer gains two CORS headers.
|
|
117
|
+
The station and grid data routes range from 0.958 to 1.008.
|
|
118
|
+
|
|
119
|
+
**After code review `edr-api-code-5`** (2026-11-26; the same A/B, on the code with the review's fixes,
|
|
120
|
+
including the `Cors` ASGI middleware that wraps every answer):
|
|
121
|
+
- Most ratios sit inside A's spread. Four sit just outside it, by 2–5%: `warm_collections` (1.024
|
|
122
|
+
against 1.018), `warm_locations_list` (1.050 against 1.047), `warm_one_station_full` (1.024 against
|
|
123
|
+
1.019) and `warm_qc_one_station_full` (1.026 against 1.013).
|
|
124
|
+
- **The middleware measured on its own:** 48 µs per request on `/conformance` (1,241 µs without it,
|
|
125
|
+
1,289 µs with it; 5 alternating rounds of 2,000 requests through `TestClient`). On a 19 ms data
|
|
126
|
+
request that is 0.25%, an order of magnitude below the deltas above. Those deltas are noise around a
|
|
127
|
+
spread estimated from three rounds.
|
|
128
|
+
- **The new cases:** `warm_catalogue` 1.71 ms, `warm_catalogue_filtered` 1.78 ms,
|
|
129
|
+
`warm_catalogue_distinct_counts` 1.87 ms, and `cpu_catalogue_match_1000` 1.81 ms.
|
|
@@ -32,6 +32,7 @@ grid in the live WRF layout, whose CRS is built by cfdb-ingest's `WrfIngest` as
|
|
|
32
32
|
"""
|
|
33
33
|
|
|
34
34
|
import argparse
|
|
35
|
+
import datetime
|
|
35
36
|
import json
|
|
36
37
|
import os
|
|
37
38
|
import pathlib
|
|
@@ -45,6 +46,7 @@ import warnings
|
|
|
45
46
|
import boto3
|
|
46
47
|
import cfdb
|
|
47
48
|
import ebooklet
|
|
49
|
+
import envlib
|
|
48
50
|
import numpy as np
|
|
49
51
|
import pymongo
|
|
50
52
|
import pyproj
|
|
@@ -278,6 +280,10 @@ def main():
|
|
|
278
280
|
'all_stations_48h': get(f'/collections/{raw}/area', coords=POLY_ALL, datetime=last48),
|
|
279
281
|
'qc_all_stations_48h': get(f'/collections/{qc}/area', coords=POLY_ALL, datetime=last48),
|
|
280
282
|
'qc_one_station_full': get(f'/collections/{qc}/locations/{sid["qc"]}'),
|
|
283
|
+
## the catalogue (0.4.0): unfiltered, filtered, and a facet
|
|
284
|
+
'catalogue': get('/catalogue', **{'all-versions': 'true'}),
|
|
285
|
+
'catalogue_filtered': get('/catalogue', variable='streamflow', bbox='170,-46,175,-40', datetime=last48),
|
|
286
|
+
'catalogue_distinct_counts': get('/catalogue/distinct/variable', counts='true'),
|
|
281
287
|
}
|
|
282
288
|
cold = ('one_station_48h', 'one_station_full', 'all_stations_48h', 'qc_all_stations_48h')
|
|
283
289
|
## pure-CPU inputs shaped like requests
|
|
@@ -306,6 +312,18 @@ def main():
|
|
|
306
312
|
np.timedelta64(15, 'm'),
|
|
307
313
|
)
|
|
308
314
|
spec = timesel.parse('2026-01-01T05:30Z/2026-01-03T05:30Z')
|
|
315
|
+
with TestClient(create_app(api_config(), db=ac[name])) as cc:
|
|
316
|
+
template = cc.get('/catalogue').json()['entries'][0]['metadata']
|
|
317
|
+
many = [
|
|
318
|
+
{
|
|
319
|
+
**template,
|
|
320
|
+
'dataset_version_id': f'{i:024x}',
|
|
321
|
+
'dataset_id': f'{i // 3:024x}',
|
|
322
|
+
'variable': ('streamflow', 'rain')[i % 2],
|
|
323
|
+
}
|
|
324
|
+
for i in range(1000)
|
|
325
|
+
]
|
|
326
|
+
start = datetime.datetime(2020, 1, 1, tzinfo=datetime.UTC)
|
|
309
327
|
cpu = {
|
|
310
328
|
'cpu_covjson_one_station_full': lambda: encode.coverage_json(
|
|
311
329
|
params, stations, [0], times, data_one, {'streamflow': 4}, True
|
|
@@ -317,6 +335,10 @@ def main():
|
|
|
317
335
|
'cpu_zstd_one_station_full': lambda: compress.encode(body, 'zstd'),
|
|
318
336
|
'cpu_gzip_one_station_full': lambda: compress.encode(body, 'gzip'),
|
|
319
337
|
'cpu_timesel_15min_axis': lambda: timesel.resolve(spec, axis_15min),
|
|
338
|
+
## envlib's catalogue matching over 1,000 entries (the live catalogue has 18), as /catalogue calls it
|
|
339
|
+
'cpu_catalogue_match_1000': lambda: envlib.match_entries(
|
|
340
|
+
many, bbox=(170.0, -46.0, -178.0, -40.0), start_date=start, all_versions=True, variable='streamflow'
|
|
341
|
+
),
|
|
320
342
|
}
|
|
321
343
|
|
|
322
344
|
results = {}
|
|
@@ -11,9 +11,10 @@ import pymongo
|
|
|
11
11
|
import s3func
|
|
12
12
|
from fastapi import FastAPI, Request
|
|
13
13
|
from fastapi.responses import Response
|
|
14
|
+
from starlette.datastructures import MutableHeaders
|
|
14
15
|
from starlette.exceptions import HTTPException as StarletteHTTPException
|
|
15
16
|
|
|
16
|
-
from envlib_api.api import compress, cost, edr, encode, grid, params, read, resolve, timesel
|
|
17
|
+
from envlib_api.api import catalogue, compress, cost, edr, encode, grid, params, read, resolve, timesel
|
|
17
18
|
from envlib_api.api.errors import ApiError, NoContent
|
|
18
19
|
from envlib_api.api.stations import Stations, check_point, parse_wkt, within_metres
|
|
19
20
|
|
|
@@ -48,6 +49,18 @@ CACHE_ALARM = CacheRefusalAlarm()
|
|
|
48
49
|
logging.getLogger('ebooklet.mongo.store').addFilter(CACHE_ALARM)
|
|
49
50
|
|
|
50
51
|
|
|
52
|
+
## CORS on every answer, whatever the request (Mike, 2026-11-25; plan review edr-api-plan-5): the API
|
|
53
|
+
## is public, read-only and cookie-free, so any page may read it. `*` does not depend on the request's
|
|
54
|
+
## Origin, so no `Vary: Origin` is needed, and a copy cached at the edge from a request without Origin
|
|
55
|
+
## still reaches a browser with the header. The `Cors` middleware sets them on every answer, so they
|
|
56
|
+
## cannot be missed by an answer the routes do not build (FastAPI's /api, Starlette's trailing-slash
|
|
57
|
+
## redirects; code review edr-api-code-5). The unexpected 500 is sent by Starlette's
|
|
58
|
+
## ServerErrorMiddleware, outside every middleware, so its handler sets them itself.
|
|
59
|
+
CORS = {'Access-Control-Allow-Origin': '*', 'Access-Control-Expose-Headers': 'Retry-After'}
|
|
60
|
+
## A preflight: GET only, and no non-safelisted request headers (no If-None-Match until plan 6's 304).
|
|
61
|
+
PREFLIGHT = {**CORS, 'Access-Control-Allow-Methods': 'GET'}
|
|
62
|
+
|
|
63
|
+
|
|
51
64
|
def _respond(request, body, media_type, status=200, headers=None):
|
|
52
65
|
coding = compress.choose(request.headers.get('accept-encoding'))
|
|
53
66
|
hdrs = {'Vary': 'Accept-Encoding', **(headers or {})}
|
|
@@ -57,6 +70,39 @@ def _respond(request, body, media_type, status=200, headers=None):
|
|
|
57
70
|
return Response(content=body, status_code=status, media_type=media_type, headers=hdrs)
|
|
58
71
|
|
|
59
72
|
|
|
73
|
+
class Cors:
|
|
74
|
+
"""
|
|
75
|
+
A plain ASGI middleware: it adds the CORS headers to every HTTP answer as it starts, and answers
|
|
76
|
+
every OPTIONS request (a CORS preflight) with 204, GET only, before routing. A catch-all OPTIONS
|
|
77
|
+
route would turn the 404 of an unknown path into a 405. Lifespan and other scopes pass through.
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
def __init__(self, app):
|
|
81
|
+
self.app = app
|
|
82
|
+
|
|
83
|
+
async def __call__(self, scope, receive, send):
|
|
84
|
+
if scope['type'] != 'http':
|
|
85
|
+
await self.app(scope, receive, send)
|
|
86
|
+
return
|
|
87
|
+
if scope['method'] == 'OPTIONS':
|
|
88
|
+
await Response(status_code=204, headers=PREFLIGHT)(scope, receive, send)
|
|
89
|
+
return
|
|
90
|
+
|
|
91
|
+
async def send_with_cors(message):
|
|
92
|
+
if message['type'] == 'http.response.start':
|
|
93
|
+
headers = MutableHeaders(scope=message)
|
|
94
|
+
for name, value in CORS.items():
|
|
95
|
+
if name not in headers:
|
|
96
|
+
headers[name] = value
|
|
97
|
+
await send(message)
|
|
98
|
+
|
|
99
|
+
await self.app(scope, receive, send_with_cors)
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _no_content():
|
|
103
|
+
return Response(status_code=204, headers={'Vary': 'Accept-Encoding'})
|
|
104
|
+
|
|
105
|
+
|
|
60
106
|
def _base(cfg, request):
|
|
61
107
|
return (cfg.public_url or str(request.base_url)).rstrip('/')
|
|
62
108
|
|
|
@@ -170,6 +216,7 @@ def create_app(cfg, db=None, session=None):
|
|
|
170
216
|
redoc_url=None,
|
|
171
217
|
)
|
|
172
218
|
app.state.db = db
|
|
219
|
+
app.add_middleware(Cors)
|
|
173
220
|
|
|
174
221
|
@app.exception_handler(ApiError)
|
|
175
222
|
def _api_error(request, err):
|
|
@@ -187,7 +234,8 @@ def create_app(cfg, db=None, session=None):
|
|
|
187
234
|
"""Anything unhandled answers a JSON 500, never Starlette's plain text; the error is still logged."""
|
|
188
235
|
logger.error(f'Unhandled {type(err).__name__} on {request.url.path}: {err}', exc_info=err)
|
|
189
236
|
body = encode.json_body({'code': 'InternalError', 'description': 'The server failed to answer this request.'})
|
|
190
|
-
|
|
237
|
+
## sent outside every middleware (ServerErrorMiddleware), so the CORS headers are set here
|
|
238
|
+
return _respond(request, body, encode.JSON_TYPE, status=500, headers=CORS)
|
|
191
239
|
|
|
192
240
|
def _meta(request):
|
|
193
241
|
q = params.validate(request, params.META)
|
|
@@ -305,7 +353,7 @@ def create_app(cfg, db=None, session=None):
|
|
|
305
353
|
try:
|
|
306
354
|
stations, positions, single, times, data, precisions, cparams, etag = _run(cid, work)
|
|
307
355
|
except NoContent:
|
|
308
|
-
return
|
|
356
|
+
return _no_content()
|
|
309
357
|
if fmt == 'CSV':
|
|
310
358
|
body = encode.csv_body(stations, positions, times, data, precisions)
|
|
311
359
|
return _respond(request, body, encode.CSV_TYPE, headers={'ETag': etag})
|
|
@@ -393,7 +441,7 @@ def create_app(cfg, db=None, session=None):
|
|
|
393
441
|
try:
|
|
394
442
|
g, sel, data, precisions, cparams, etag = _run(cid, work)
|
|
395
443
|
except NoContent:
|
|
396
|
-
return
|
|
444
|
+
return _no_content()
|
|
397
445
|
if fmt == 'CSV':
|
|
398
446
|
return _respond(
|
|
399
447
|
request, encode.position_csv(g, sel, data, precisions), encode.CSV_TYPE, headers={'ETag': etag}
|
|
@@ -431,5 +479,35 @@ def create_app(cfg, db=None, session=None):
|
|
|
431
479
|
|
|
432
480
|
return _grid(request, cid, q, select, 'cube')
|
|
433
481
|
|
|
482
|
+
@app.get('/catalogue')
|
|
483
|
+
def catalogue_listing(request: Request):
|
|
484
|
+
"""
|
|
485
|
+
The envlib catalogue: `Catalogue.query()` over HTTP, every version on request
|
|
486
|
+
(`all-versions=true`), paged by a cursor. The rules are envlib's (`api/catalogue.py`).
|
|
487
|
+
"""
|
|
488
|
+
q = params.validate(request, catalogue.PARAMS)
|
|
489
|
+
params.output_format(q, ('JSON',), 'JSON')
|
|
490
|
+
kw, limit, cursor = catalogue.parse(q, cfg)
|
|
491
|
+
docs = _catalogue_docs()
|
|
492
|
+
body = catalogue.listing(_base(cfg, request), q, docs, kw, limit, cursor)
|
|
493
|
+
return _respond(request, encode.json_body(body), encode.JSON_TYPE)
|
|
494
|
+
|
|
495
|
+
@app.get('/catalogue/distinct/{field}')
|
|
496
|
+
def catalogue_distinct(field: str, request: Request):
|
|
497
|
+
"""The distinct stored values of one queryable field, over every version: `Catalogue.distinct()`."""
|
|
498
|
+
q = params.validate(request, catalogue.DISTINCT_PARAMS)
|
|
499
|
+
params.output_format(q, ('JSON',), 'JSON')
|
|
500
|
+
counts = catalogue.flag(q, 'counts')
|
|
501
|
+
catalogue.check_field(field) # the 404 comes before MongoDB is read
|
|
502
|
+
body = catalogue.distinct(field, _catalogue_docs(), counts)
|
|
503
|
+
return _respond(request, encode.json_body(body), encode.JSON_TYPE)
|
|
504
|
+
|
|
505
|
+
def _catalogue_docs():
|
|
506
|
+
try:
|
|
507
|
+
return catalogue.read_docs(db)
|
|
508
|
+
except pymongo.errors.PyMongoError as err:
|
|
509
|
+
logger.error(f'/catalogue: MongoDB failed: {err}')
|
|
510
|
+
raise resolve.unavailable(cfg, 'The database is unavailable.') from err
|
|
511
|
+
|
|
434
512
|
check_role(db)
|
|
435
513
|
return app
|