opencdms-dev / pycdmsapi

Experimental repository for future production opencdms-api release
MIT License
0 stars 0 forks source link

pycdmsapi prototype #1

Open isedwards opened 1 year ago

isedwards commented 1 year ago

For the OpenCDMS Web API Reference Implementation, we would like to follow the framework-agnostic approach taken by pygeoapi which does not import dependencies from any particular Python web framework.

This first issue aims to investigate possible approaches. Should we: a) create a completely separate package that follows the same principals and borrows some code b) create a completely separate package that imports and reuses capabilities from pygeoapi where possible c) maintain a fork of pygeoapi d) ...

faysal-ishtiaq commented 1 year ago

a) among the three options, I think approach one will give us more freedom and better long-term outcome. b) I am not sure how do we do this... i.e. which parts to take, which parts to implement ourselves etc c) this might be another good option in terms of initial outcome, but I think eventually we have to go down a different path in future

isedwards commented 1 year ago

We could begin from scratch an create the new pycdmsapi application inspired by pygeoapi. Or we could:

Then we can begin to add our own modules that are CDMS specific, e.g. pycdmsapi/provider will contain CDMS provider plugins like class ClimsoftProvider(pycdmsapi.provider.BaseProvider) etc.

isedwards commented 1 year ago

Starting with a copy of the pygeoapi code base would be ideal - because we would be starting with a working application. However, on reflection I don't think we can adopt the existing code en masse like this because the contributors to the pygeoapi project have not agreed to our project's Contributor's Licence Agreement (CLA).

Therefore - I think the only way forward is approach (a): "create a completely separate package that follows the same principals and borrows some code".

In this repository I've created a fresh package called pycdmsapi and registered this with PyPI.

faysal-ishtiaq commented 1 year ago

If we could create an example pycdmsapi-config.yml, I could borrow some code from pygeoapi and implement a demo.

faysal-ishtiaq commented 1 year ago

We can divide the task into two parts:

Converting pycdmsapi config to openapi specification depends largely on how would pycdmsapi config look like.

To spin up a server from Open API specification we can take similar approach taken by openapi generator (https://openapi-generator.tech/docs/generators). It's done using mustache template.

https://openapi-generator.tech/docs/generators

Or we can take completely different approach, we can generate a fastapi app from pycdmsapi config file. Which automatically generates openapi spec.