-
Notifications
You must be signed in to change notification settings - Fork 111
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
Enhance run()
placeholder substitutions to honor configuration defaults
#7509
base: maint
Are you sure you want to change the base?
Conversation
…ults Previously, `run()` would not recognize configuration defaults for placeholder substitution. This means that any placeholders globally declared in `datalad.interface.common_cfg`, or via `register_config()` in DataLad extensions would not be effective. This changeset makes run's `format_command()` helper include such defaults explicitly, and thereby enable the global declaration of substitution defaults. Moreoever a `{python}` placeholder is now defined via this mechanism, and points to the value of `sys.executable` by default. This particular placeholder was found to be valueable for improving the portability of run-recording across (specific) Python versions, or across different (virtual) environments. See datalad/datalad-container#224 for an example use case. A corresponding test is included. The ability to keep run-records paramterizable, in particular, for interpreters can also aid longevity (think platform-specific choices to call a system Python executable `python3` for some years, and then switch back. Related datalad/datalad-container#250
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## maint #7509 +/- ##
==========================================
- Coverage 91.56% 91.56% -0.01%
==========================================
Files 325 325
Lines 43443 43457 +14
Branches 5827 5828 +1
==========================================
+ Hits 39780 39791 +11
- Misses 3648 3651 +3
Partials 15 15 ☔ View full report in Codecov by Sentry. |
MacOS failure looks unrelated (web remote). |
This is the companion of datalad/datalad#7509 Closes datalad#478
This is the companion of datalad/datalad#7509 Closes datalad#478
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need to understand it better: isn't this just a singular case of a larger common (?) pattern that in many (most?) cases we would actually like something like this for any Dataset.config
access since dataset's config should be a "union" with system/user/env-overloads settings?
I dont know if this is a common case. Typically, access that requires acknowledging a configurable default goes via |
Reported by @yarikoptic in https://github.com/datalad/datalad/pull/7509/files#r1358426552 This changeset adds protection against processing non-substitution configuration items. It also reduces duplication a bit more. In contrast to the change proposal in datalad/datalad#7509 the (intermediate) set size is minimized by using a early filter.
appveyor might have stalled (restarted).[gw1] PASSED ../datalad/support/tests/test_sshconnector.py::test_bundle_invariance
../datalad/support/tests/test_sshrun.py::test_exit_code CommandError: 'ssh -o ControlPath=/home/appveyor/.cache/datalad/sockets/bad871d9 datalad-test 'exit 42'' failed with exitcode 42
[gw1] XPASS ../datalad/support/tests/test_sshrun.py::test_exit_code
../datalad/support/tests/test_sshrun.py::test_no_stdin_swallow
[gw1] PASSED ../datalad/support/tests/test_sshrun.py::test_no_stdin_swallow
../datalad/support/tests/test_sshrun.py::test_fancy_quotes
[gw1] PASSED ../datalad/support/tests/test_sshrun.py::test_fancy_quotes
../datalad/support/tests/test_sshrun.py::test_ssh_option
[gw1] SKIPPED ../datalad/support/tests/test_sshrun.py::test_ssh_option
../datalad/support/tests/test_sshrun.py::test_ssh_ipv4_6_incompatible
[gw1] PASSED ../datalad/support/tests/test_sshrun.py::test_ssh_ipv4_6_incompatible
../datalad/support/tests/test_sshrun.py::test_ssh_ipv4_6 ssh: Could not resolve hostname 127.0.0.1: Address family for hostname not supported
[gw1] PASSED ../datalad/support/tests/test_sshrun.py::test_ssh_ipv4_6
../datalad/support/tests/test_stats.py::test_ActivityStats_basic
[gw1] PASSED ../datalad/support/tests/test_stats.py::test_ActivityStats_basic
../datalad/support/tests/test_stats.py::test_ActivityStats_comparisons
[gw1] PASSED ../datalad/support/tests/test_stats.py::test_ActivityStats_comparisons
../datalad/support/tests/test_stats.py::test_add
[gw1] PASSED ../datalad/support/tests/test_stats.py::test_add
../datalad/support/tests/test_status.py::test_FileStatus_basic
[gw1] PASSED ../datalad/support/tests/test_status.py::test_FileStatus_basic
../datalad/support/tests/test_vcr_.py::test_use_cassette_if_no_vcr OSX restarted... travis seems no more (I ended subscription but was hoping that opensource thing would kick in... will check later) |
Previously,
run()
would not recognize configuration defaults for placeholder substitution. This means that any placeholders globally declared indatalad.interface.common_cfg
, or viaregister_config()
in DataLad extensions would not be effective.This changeset makes run's
format_command()
helper include such defaults explicitly, and thereby enable the global declaration of substitution defaults.Moreoever a
{python}
placeholder is now defined via this mechanism, and points to the value ofsys.executable
by default. This particular placeholder was found to be valueable for improving the portability of run-recording across (specific) Python versions, or across different (virtual) environments. Seedatalad/datalad-container#224 for an example use case.
A corresponding test is included.
The ability to keep run-records paramterizable, in particular, for interpreters can also aid longevity (think platform-specific choices to call a system Python executable
python3
for some years, and then switch back.Related datalad/datalad-container#250