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

Warn on non-default ATOMATE2_CONFIG_FILE that's not found #794

Merged
merged 5 commits into from
Apr 1, 2024

Conversation

janosh
Copy link
Member

@janosh janosh commented Mar 30, 2024

just a small QoL improvement to warn users when they set a custom ATOMATE2_CONFIG_FILE but the file doesn't exist

@utf i added tests to assert

  • no warning if config path is default and file does not exist
  • warning if config path is non-default and file does not exist

also used monkeypatch.setenv("ATOMATE2_CONFIG_FILE", ...) which is auto-reverted on test-exit to avoid polluting other tests

@janosh janosh added testing Test all the things ux User experience labels Mar 30, 2024
@@ -10,6 +10,7 @@
from pydantic_settings import BaseSettings, SettingsConfigDict

_DEFAULT_CONFIG_FILE_PATH = "~/.atomate2.yaml"
_ENV_PREFIX = "atomate2_"
Copy link
Member Author

Choose a reason for hiding this comment

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

should this be upper-cased?

@janosh
Copy link
Member Author

janosh commented Mar 30, 2024

CI failure caused by pytorch==2.2.2 / dgl incompat which will be fixed in #722

@janosh janosh merged commit ad8257c into main Apr 1, 2024
3 of 6 checks passed
@janosh janosh deleted the warn-on-non-default-config-path-not-found branch April 1, 2024 11:05
hrushikesh-s pushed a commit to hrushikesh-s/atomate2 that referenced this pull request Jun 28, 2024
…sproject#794)

* move _ENV_PREFIX = "atomate2_" into module scope

* construct env var name ATOMATE2_CONFIG_FILE from _ENV_PREFIX and use in warn/err msg

use monkeypatch.setenv to restore env var after test

* Add warning for non-existent non-default config file

* test no warning if config path is default and file does not exist

* test warning if config path is non-default and file does not exist
@utf utf added the house-keeping Formatting and code quality tweaks label Aug 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
house-keeping Formatting and code quality tweaks testing Test all the things ux User experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants