Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pycdmsapi prototype #1

Open
isedwards opened this issue Oct 1, 2022 · 5 comments
Open

pycdmsapi prototype #1

isedwards opened this issue Oct 1, 2022 · 5 comments
Assignees

Comments

@isedwards
Copy link
Contributor

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
Copy link

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 isedwards changed the title Initial prototype pycdmsapi prototype Oct 2, 2022
@isedwards isedwards self-assigned this Oct 2, 2022
@isedwards
Copy link
Contributor Author

isedwards commented Oct 2, 2022

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

  • Make a one-time copy (not fork) the pygeoapi code into our pycdmsapi repository
  • Rename the package and ensure we have a fully working copy of the application (which will quickly be out of date)
  • Add pygeoapi @ git+https://github.com/geopython/pygeoapi.git@master as a dependency
  • Remove sections of the codebase and replace these with imports from pygeoapi where we need the retain the capability in pycdmsapi, e.g. from pygeoapi.provider.postgresql import PostgreSQLProvider
  • Maintain our own separate pygeoapi-config.yml that is renamed as pycdmsapi-config.yml - where the pygeoapi config options are a subset of the pycdmsapi config

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
Copy link
Contributor Author

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
Copy link

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

@faysal-ishtiaq
Copy link

faysal-ishtiaq commented Oct 21, 2022

We can divide the task into two parts:

  • convert pycdmsapi-config.yml to pycdmsapi-openapi.yml
  • spin up a server from openapi specification

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants