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

Set implementation version in config by default #385

Merged
merged 2 commits into from Jul 2, 2020

Conversation

CasperWA
Copy link
Member

@CasperWA CasperWA commented Jul 1, 2020

Set config defaults for provider and implementation.
This ensures that the version field is set for implementation.


Maybe all of this is not needed?
But it's important to get the version sub-field automated here.

@CasperWA CasperWA added enhancement New feature or request priority/medium Issue or PR with a consensus of medium priority labels Jul 1, 2020
@CasperWA CasperWA requested review from ml-evs and shyamd July 1, 2020 15:13
@codecov
Copy link

codecov bot commented Jul 1, 2020

Codecov Report

Merging #385 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #385      +/-   ##
==========================================
+ Coverage   90.22%   90.24%   +0.01%     
==========================================
  Files          55       55              
  Lines        2404     2408       +4     
==========================================
+ Hits         2169     2173       +4     
  Misses        235      235              
Flag Coverage Δ
#unittests 90.24% <100.00%> (+0.01%) ⬆️
Impacted Files Coverage Δ
optimade/server/config.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b9ce81c...224a7a8. Read the comment docs.

@shyamd
Copy link
Contributor

shyamd commented Jul 1, 2020

I chose to do this via the default values in the config so that someone using a modified version of our server could update the implementation.

Your code also overrides the provider no matter who is using it.

@CasperWA
Copy link
Member Author

CasperWA commented Jul 1, 2020

I chose to do this via the default values in the config so that someone using a modified version of our server could update the implementation.

Your code also overrides the provider no matter who is using it.

It doesn't override. It sets the defaults first, then updates the values with the provided ones - the same for the implementation.
However, I also see issues with this, specifically that all these values are OPTIONAL.
But also version is OPTIONAL - and I quite like the small feature that it dynamically retrieves __version__ from the package ...
But I can just minimize it so that only version is preset and then updated afterwards with the supplied provider config parameters?

optimade/server/config.py Outdated Show resolved Hide resolved
@shyamd
Copy link
Contributor

shyamd commented Jul 1, 2020

Just to clarify, we have no way of knowing how to fill in the Provider fields when someone provides partial information. It's very possible they want the other fields to be empty.

Set config defaults for `provider` and `implementation`.
This ensures that the `version` field is set for `implementation`.
@CasperWA CasperWA requested a review from shyamd July 2, 2020 21:38
@CasperWA CasperWA changed the title Set config defaults Set implementation version in config by default Jul 2, 2020
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

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

LGTM!

@ml-evs ml-evs merged commit 8941179 into Materials-Consortia:master Jul 2, 2020
@ml-evs ml-evs deleted the return_all_in_response branch July 2, 2020 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority/medium Issue or PR with a consensus of medium priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants