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

A few fixes related to usage as a library #119

Merged
merged 7 commits into from Jan 9, 2020
Merged

A few fixes related to usage as a library #119

merged 7 commits into from Jan 9, 2020

Conversation

ml-evs
Copy link
Member

@ml-evs ml-evs commented Jan 7, 2020

This PR mostly contains fixes that allow this package to be used as a library (i.e. non-editable install).

  • Change optimade.config to look in the cwd instead of optimade install directory for server.cfg file and moved the server_template.cfg into the server directory so it can be included as package data.
  • Removed package_data from setup.py in lieu of explicitly specifying all test data and associated config files in MANIFEST.in.

Aside from that, it fixes some small issues:

  • stop the single structure endpoint returning data_returned: 1 when the structure is not found.
  • check all test paths when mocking
  • do an editable install when running pre-commit for CI: some strange behavior here changes the openapi spec depending on the install method.

@codecov
Copy link

codecov bot commented Jan 7, 2020

Codecov Report

Merging #119 into master will decrease coverage by 0.08%.
The diff coverage is 64.28%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #119      +/-   ##
==========================================
- Coverage   82.81%   82.73%   -0.09%     
==========================================
  Files          39       39              
  Lines        1810     1813       +3     
==========================================
+ Hits         1499     1500       +1     
- Misses        311      313       +2
Flag Coverage Δ
#unittests 82.73% <64.28%> (-0.09%) ⬇️
Impacted Files Coverage Δ
optimade/server/entry_collections.py 83.96% <100%> (ø) ⬆️
optimade/server/main.py 91.83% <33.33%> (-1.92%) ⬇️
optimade/server/main_index.py 89.47% <33.33%> (-2.2%) ⬇️
optimade/server/config.py 76.54% <80%> (ø) ⬆️

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 8510ff5...70074eb. Read the comment docs.

@CasperWA
Copy link
Member

CasperWA commented Jan 8, 2020

* Change `optimade.config` to look in the cwd instead of optimade install directory for `server.cfg` file and moved the `server_template.cfg` into the server directory so it can be included as package data.

This should be possible also with the MANIFEST.in file. But for the template file, it is of no importance where it is, as long as the server.cfg is created somewhere easily accessible.

Aside from that, it fixes two small issues:

* stop the single structure endpoint returning `data_returned: 1` when the structure is not found.

Huh, thought I fixed that earlier - probably missed it. Thanks! 👍

Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

Great work @ml-evs!

Have you tried to test if the package data is included with the new setup?

openapi/openapi.json Outdated Show resolved Hide resolved
optimade/server/config.py Show resolved Hide resolved
@CasperWA
Copy link
Member

CasperWA commented Jan 9, 2020

I have updated the README with information on where to put server.cfg and have made sure it also works (at least for starting up the servers - I trust GH Actions to check the inner workings of the servers.

@CasperWA CasperWA requested a review from ltalirz January 9, 2020 10:51
Copy link
Member

@CasperWA CasperWA left a comment

Choose a reason for hiding this comment

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

This is firing on all cylinders now, thanks @ml-evs!

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

2 participants