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

Adding language support to Birdy #164

Merged
merged 19 commits into from
Apr 21, 2020
Merged

Adding language support to Birdy #164

merged 19 commits into from
Apr 21, 2020

Conversation

f-PLT
Copy link
Contributor

@f-PLT f-PLT commented Feb 14, 2020

Do not merge before a OWSLib version containing language support has been released. (Currently only on master branch)

Has been tested using local copy of OWSLib library taken from it's master branch.

Before merging

  • Added language support to Birdy
  • Review, improvements/comments
  • Release of new OWSLib version that includes language support
  • Update required OWSLib version in requirements.txt, environment.yml and where also necessary

Overview

This PR applies changes to integrate language support being integrated in PyWPS and OWSLib geopython/OWSLib#654

Changes:

  • Language parameter to WPSClient and BirdyCLI classes
  • Basic getter and setter functions for WPSClient language property.
  • Two simple tests

Added language parameter to WPSClient
and BirdyCLI classes to bring in line with
changes to OWSLib. Only works with
updated OWSLib module.
Was only used while playing with tests and learning
about the code base. Forgot to remove.
birdy/client/base.py Outdated Show resolved Hide resolved
Co-Authored-By: Trevor James Smith <10819524+Zeitsperre@users.noreply.github.com>
birdy/client/base.py Outdated Show resolved Hide resolved
"""
self._converters = converters
self._interactive = progress
self._mode = ASYNC if progress else SYNC
self._notebook = notebook.is_notebook()
self._inputs = {}
self._outputs = {}
self._language = language
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not necessary (the language property takes its value in self._wps.language)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, right. Didn't remove this one after adding the language property functions.

"""
def __init__(self, name=None, url=None, caps_xml=None, desc_xml=None, **attrs):
def __init__(self, name=None, url=None, caps_xml=None, desc_xml=None, language=None, **attrs):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this is doing what you want for the cli... I think you want to add the language option in _update_commands.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm.. I added it mainly so it could be passed on for self.wps = WebProcessingService(...), so an instance of the BirdyCLI class could be initiated with a language, but it might be a lack of comprehension of how click.MultiCommand works and is used.

Should I remove the language parameter from the init and WebProcessingService instantiation and only add it as a command?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not familiar enough with click either... I would need to check into this more.

If you want, you can focus this PR on adding language support for the client only, or find how to add it as a parameter to the cli also.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright, well I don't think adding it to the cli is bad per say, as it still is a class that has a wps as a parameter, which can receive a language parameter. It might not be a best practice for click though...

I have time to dig a bit more into click. If it turns out to be a time sink or I get submerged by other assignments, I'll revert what I changed to BirdyCli and we'll save it for a future PR.

@huard
Copy link
Contributor

huard commented Mar 12, 2020

Status ?

@davidcaron
Copy link
Collaborator

@f-PLT I should have some time today to look at this.

@f-PLT
Copy link
Contributor Author

f-PLT commented Mar 12, 2020

I tested my modifications of the WPSClient class with a local copy of OWSLib that includes the language parameter changes, so that aspect should be ok.

For BirdyCli, I have a working prototype of the language command, but requires more testing, which I have not had time to do, having been assigned other tasks in the meantime. It's also the first time I try my hands at a Click.MultiCommand implementation, so I expect improvements/corrections can be made.

In all cases, will require a release of OWSLib that includes the language parameter, and should be pretty quick once it's out.

@huard
Copy link
Contributor

huard commented Mar 12, 2020

@cehbrecht Possible to have a minor owslib release for the language support ?

@cehbrecht
Copy link
Member

@huard I will prepare a 0.19.2 owslib release ...

@davidcaron
Copy link
Collaborator

davidcaron commented Mar 12, 2020

@f-PLT take a look at 993aff5 You can test with https://finch.crim.ca/wps

@f-PLT
Copy link
Contributor Author

f-PLT commented Mar 12, 2020

Perfect, will get on it tomorrow morning.

@davidcaron
Copy link
Collaborator

@f-PLT tests should pass with the changes in this branch: https://github.com/bird-house/birdy/tree/pr-164-fix-tests

test_help() and test_show_languages() require an online
wps (Emu, in this case)
@f-PLT
Copy link
Contributor Author

f-PLT commented Mar 30, 2020

Integrated David's changes. CLI tests however now require to be online tests (with Emu). I also tested Birdy manually and everything seems to work.

I do, however, get the three following test failures for the full test suites.

tests/test_client.py::test_wps_wordcounter FAILED
tests/test_client.py::test_asobj FAILED
tests/test_client.py::test_inputs FAILED  

I'm using a docker deployment of Emu, as per the documentation. I also get those failures if running the tests from the master branch of Birdy.

I don't know if it's something on my part or if it's an expected/known behavior, being new to Birdy's development.

@f-PLT f-PLT requested a review from Zeitsperre March 30, 2020 21:09
@Zeitsperre
Copy link
Contributor

@f-PLT I'm tagging @cehbrecht as he's much more capable of tackling these errors than I.

@cehbrecht
Copy link
Member

@f-PLT code looks good to me. I was checking with a local instance of emu and tests all passed. Thanks for the good work :)

@f-PLT f-PLT requested a review from davidcaron March 31, 2020 16:09
@f-PLT f-PLT changed the title WIP : Adding language support to Birdy Adding language support to Birdy Apr 14, 2020
@huard
Copy link
Contributor

huard commented Apr 20, 2020

I've added an explicit test using the Emu branch with the new translation process and everything is working fine.

@f-PLT @cehbrecht At the moment, language and languages are part of the WPSClient instance scope, along with processes. So in theory, a process identifier with one of these two names would create a namespace clash.

Options:

  • We could store language and languages into a _settings attribute.
  • We could prefix language and languages with an underscore.
  • We could check if a process shadows an existing attribute and raise a warning.

Thoughts ?

@huard
Copy link
Contributor

huard commented Apr 20, 2020

I suggest we merge this PR as is, and then open a new ticket to review settings access and modifications in general.

@cehbrecht
Copy link
Member

Options:

* We could store language and languages into a `_settings` attribute.

* We could prefix language and languages with an underscore.

* We could check if a process shadows an existing attribute and raise a warning.

Thoughts ?

I would vote for the first two options.

@cehbrecht
Copy link
Member

I suggest we merge this PR as is, and then open a new ticket to review settings access and modifications in general.

I agree.

@huard huard merged commit b660066 into bird-house:master Apr 21, 2020
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

Successfully merging this pull request may close these issues.

None yet

6 participants