diff --git a/.github/scripts/common.sh b/.github/scripts/common.sh index a1fa7255e..be395cbc7 100644 --- a/.github/scripts/common.sh +++ b/.github/scripts/common.sh @@ -4,6 +4,6 @@ CI_CONDA_DIR=/tmp/conda CI_CONDA_SH=$CI_CONDA_DIR/etc/profile.d/conda.sh ci_conda_activate() { - source $CI_CONDA_SH + . $CI_CONDA_SH conda activate } diff --git a/.github/scripts/format-check.sh b/.github/scripts/format-check.sh index d795bfbbd..ad8be5496 100755 --- a/.github/scripts/format-check.sh +++ b/.github/scripts/format-check.sh @@ -11,6 +11,6 @@ unformatted() { return 0 } -source $(dirname ${BASH_SOURCE[0]})/common.sh +. $(dirname ${BASH_SOURCE[0]})/common.sh ci_conda_activate CONDEV_SHELL_CMD=unformatted condev-shell diff --git a/.github/scripts/install-conda.sh b/.github/scripts/install-conda.sh index b7562179b..7d78bc0aa 100755 --- a/.github/scripts/install-conda.sh +++ b/.github/scripts/install-conda.sh @@ -1,5 +1,5 @@ set -eux -source $(dirname ${BASH_SOURCE[0]})/common.sh +. $(dirname ${BASH_SOURCE[0]})/common.sh url=https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Miniforge3-Linux-x86_64.sh installer=/tmp/$(basename $url) wget --no-verbose -O $installer $url diff --git a/.github/scripts/make-docs.sh b/.github/scripts/make-docs.sh index 1f187e543..45eab3b0b 100755 --- a/.github/scripts/make-docs.sh +++ b/.github/scripts/make-docs.sh @@ -1,6 +1,6 @@ set -ae -source $(dirname ${BASH_SOURCE[0]})/common.sh +. $(dirname ${BASH_SOURCE[0]})/common.sh ci_conda_activate cd docs -source install-deps +. install-deps make docs diff --git a/.github/scripts/make-package.sh b/.github/scripts/make-package.sh index 8e55921cc..5f42f6c80 100755 --- a/.github/scripts/make-package.sh +++ b/.github/scripts/make-package.sh @@ -1,5 +1,5 @@ set -ae -source $(dirname ${BASH_SOURCE[0]})/common.sh +. $(dirname ${BASH_SOURCE[0]})/common.sh ci_conda_activate set -x make package diff --git a/.github/scripts/publish.sh b/.github/scripts/publish.sh index ef39948e5..d3a985afa 100755 --- a/.github/scripts/publish.sh +++ b/.github/scripts/publish.sh @@ -1,5 +1,5 @@ set -ae -source $(dirname ${BASH_SOURCE[0]})/common.sh +. $(dirname ${BASH_SOURCE[0]})/common.sh ci_conda_activate set -ux f=recipe/meta.json diff --git a/.github/scripts/test.sh b/.github/scripts/test.sh index acaedeafc..1fdc349e8 100755 --- a/.github/scripts/test.sh +++ b/.github/scripts/test.sh @@ -20,7 +20,7 @@ run_tests() { return $status } -source $(dirname ${BASH_SOURCE[0]})/common.sh +. $(dirname ${BASH_SOURCE[0]})/common.sh ci_conda_activate for version in ${SUPPORTED_PYTHON_VERSIONS[*]}; do PYTHON_VERSION=$version diff --git a/docs/deps b/docs/deps index a16afe9c8..1d74a3edd 100755 --- a/docs/deps +++ b/docs/deps @@ -14,5 +14,5 @@ for dep in deps: pkg, ver = m.groups() if re.match(r"^\d", ver): ver = f"={ver}" - specs.append(f"'{pkg}{ver}'") + specs.append(f"{pkg}{ver}") print(" ".join(sorted(specs))) diff --git a/format b/format index f67cd3332..826f96323 100755 --- a/format +++ b/format @@ -10,6 +10,6 @@ echo "=> Running docformatter" (cd src && docformatter . || test $? -eq 3) echo "=> Running jq" -for a in $(find src -type f -name "*.jsonschema"); do +for a in $(find src -not -path "*/.*" -type f -name "*.json*"); do b=$(jq -S . $a) && echo "$b" >$a || (echo " in $a"; false) done diff --git a/recipe/meta.json b/recipe/meta.json index cdccd2d82..b56cc1342 100644 --- a/recipe/meta.json +++ b/recipe/meta.json @@ -1,6 +1,6 @@ { "build": "py_0", - "buildnum": "0", + "buildnum": 0, "name": "uwtools", "packages": { "dev": [ diff --git a/src/uwtools/config/formats/base.py b/src/uwtools/config/formats/base.py index 8c64b7cc0..37b736226 100644 --- a/src/uwtools/config/formats/base.py +++ b/src/uwtools/config/formats/base.py @@ -210,6 +210,13 @@ def compare_config( log.info(diffline.rstrip()) return False + @property + def config_file(self) -> Optional[Path]: + """ + Return the path to the config file from which this object was instantiated, if applicable. + """ + return self._config_file + def dereference(self, context: Optional[dict] = None) -> None: """ Render as much Jinja2 syntax as possible. diff --git a/src/uwtools/resources/info.json b/src/uwtools/resources/info.json index 147828162..bc21a6c20 100644 --- a/src/uwtools/resources/info.json +++ b/src/uwtools/resources/info.json @@ -1,4 +1,4 @@ { - "version": "2.5.0", - "buildnum": "0" + "buildnum": "0", + "version": "2.5.0" } diff --git a/src/uwtools/tests/config/formats/test_base.py b/src/uwtools/tests/config/formats/test_base.py index 491d43a08..c3557d3cc 100644 --- a/src/uwtools/tests/config/formats/test_base.py +++ b/src/uwtools/tests/config/formats/test_base.py @@ -194,6 +194,11 @@ def test_compare_config_ini(caplog, salad_base): assert not logged(caplog, line) +def test_config_file(config): + assert config.config_file.name == "config.yaml" + assert config.config_file.is_file() + + def test_dereference(tmp_path): # Test demonstrates that: # - Config dereferencing ignores environment variables.