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

MPRester lazily get endpoint and api_key #936

Merged
merged 25 commits into from
Oct 3, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Sep 28, 2024

Summary

@DanielYang59 DanielYang59 marked this pull request as ready for review September 28, 2024 03:54
@DanielYang59 DanielYang59 changed the title Lazily get endpoint and api_key MPRester lazily get endpoint and api_key Sep 28, 2024
@DanielYang59 DanielYang59 marked this pull request as draft September 28, 2024 05:43
@DanielYang59 DanielYang59 marked this pull request as ready for review September 28, 2024 05:45
@DanielYang59
Copy link
Contributor Author

DanielYang59 commented Sep 29, 2024

@tschaume This one is ready for review, thanks!

Also try to ping @janosh if you are interested in commenting :)

Copy link
Member

@janosh janosh left a comment

Choose a reason for hiding this comment

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

thanks @DanielYang59, looks great! esp. those new tests 👍

@DanielYang59
Copy link
Contributor Author

DanielYang59 commented Oct 2, 2024

The test failure is owing to restricted access to repo secret from a fork:

With the exception of GITHUB_TOKEN, secrets are not passed to the runner when a workflow is triggered from a forked repository.

And is passing locally:

=================================================== test session starts ====================================================
platform darwin -- Python 3.12.6, pytest-8.3.3, pluggy-1.5.0
rootdir: /Users/yang/developer/api
configfile: pyproject.toml
plugins: typeguard-4.3.0
collected 31 items                                                                                                         

tests/test_client.py ...............................                                                                 [100%]

tests/test_client.py Outdated Show resolved Hide resolved
Copy link
Member

@tschaume tschaume left a comment

Choose a reason for hiding this comment

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

I think it looks good - I'll try to get it merged and released.

mp_api/client/mprester.py Show resolved Hide resolved
tests/test_client.py Outdated Show resolved Hide resolved
tests/test_client.py Outdated Show resolved Hide resolved
@tschaume tschaume merged commit 96b9e37 into materialsproject:main Oct 3, 2024
2 of 4 checks passed
@tschaume
Copy link
Member

tschaume commented Oct 3, 2024

@DanielYang59 release candidate is out for this 🎉 See https://pypi.org/project/mp-api/0.43.0rc0/

@DanielYang59 DanielYang59 deleted the lazy-get-api-key branch October 4, 2024 02:20
@DanielYang59
Copy link
Contributor Author

Great! Thanks a lot for reviewing!

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.

MP_API_KEY is retrieved at import time
3 participants