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

resolve environment variables in Path traitlets #1855

Merged
merged 2 commits into from
Mar 29, 2022

Conversation

kosack
Copy link
Contributor

@kosack kosack commented Mar 22, 2022

This small change allows one to use env vars in config files whenever a Path is requested. On the command-line, your shell already expands them, so this is mostly useful for configuration files.

e.g:

"DataWriter": {
    "output_path": "$HOME/Data/events.DL1.h5"
}
>>> print(d.output_path)

PosixPath('/Users/kkosack/Data/events.DL1.h5')

This is useful, for example, if you want to define your configuration files in relationship to some base directory.

@codecov
Copy link

codecov bot commented Mar 22, 2022

Codecov Report

Merging #1855 (7042af4) into master (d7f8a58) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #1855   +/-   ##
=======================================
  Coverage   92.22%   92.23%           
=======================================
  Files         190      190           
  Lines       15196    15211   +15     
=======================================
+ Hits        14015    14030   +15     
  Misses       1181     1181           
Impacted Files Coverage Δ
ctapipe/core/tests/test_traits.py 100.00% <100.00%> (ø)
ctapipe/core/traits.py 95.14% <100.00%> (+0.01%) ⬆️
ctapipe/coordinates/tests/test_coordinates.py 100.00% <0.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 d7f8a58...7042af4. Read the comment docs.

@kosack kosack requested a review from LukasNickel March 29, 2022 14:20
@kosack kosack merged commit e6f35c3 into cta-observatory:master Mar 29, 2022
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.

3 participants